From ca5259ec32f1f344a7c481e515bc1a4254f689e2 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 21 Jul 2025 19:26:23 +0200 Subject: [PATCH] nouveau/headers: Fix nv_push rust push_inline_data implementation Signed-off-by: Mary Guillemard Fixes: 66954d997d8 ("nouveau/headers: Add an nv_push crate in Rust") Part-of: (cherry picked from commit c64d8a05481fa81d11cc84714a7e42bce1142050) --- .pick_status.json | 2 +- src/nouveau/headers/nv_push_rs/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 835f599271c..2d4d95f0873 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1784,7 +1784,7 @@ "description": "nouveau/headers: Fix nv_push rust push_inline_data implementation", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "66954d997d801743156f5eeda7a23ba1d9b6c098", "notes": null diff --git a/src/nouveau/headers/nv_push_rs/lib.rs b/src/nouveau/headers/nv_push_rs/lib.rs index d3a5955279f..7dfaa445d07 100644 --- a/src/nouveau/headers/nv_push_rs/lib.rs +++ b/src/nouveau/headers/nv_push_rs/lib.rs @@ -206,7 +206,10 @@ impl Push { /// Push an array of dwords into the push buffer pub fn push_inline_data(&mut self, data: &[u32]) { - if self.last_inc != usize::MAX { + if let Some(last) = self.mem.get_mut(self.last_inc) { + let last = MthdHeader::from_bits_mut(last); + last.add_len(data.len().try_into().unwrap()); + } else { panic!("Inline data must only be placed after a method header"); } self.mem.extend_from_slice(data);