nouveau/headers: Fix nv_push rust push_inline_data implementation

Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 66954d997d ("nouveau/headers: Add an nv_push crate in Rust")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36093>
(cherry picked from commit c64d8a0548)
This commit is contained in:
Mary Guillemard 2025-07-21 19:26:23 +02:00 committed by Eric Engestrom
parent 76724bd376
commit ca5259ec32
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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);