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>
This commit is contained in:
Mary Guillemard 2025-07-21 19:26:23 +02:00 committed by Marge Bot
parent 63cdad6bb7
commit c64d8a0548

View file

@ -207,7 +207,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);