From 9b50cd2f40f1420e7292e82e424a944879c33483 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 21 Jul 2025 19:12:09 +0200 Subject: [PATCH] nouveau/headers: Add raw INC methods in nv_push rust impl Allows to push new cmd headers explicitly. Signed-off-by: Mary Guillemard Reviewed-by: Faith Ekstrand Part-of: --- src/nouveau/headers/nv_push_rs/lib.rs | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/nouveau/headers/nv_push_rs/lib.rs b/src/nouveau/headers/nv_push_rs/lib.rs index 7f823b6771e..077358fbaee 100644 --- a/src/nouveau/headers/nv_push_rs/lib.rs +++ b/src/nouveau/headers/nv_push_rs/lib.rs @@ -197,6 +197,31 @@ impl Push { self.push_mthd_bits(class_to_subc(M::CLASS), M::ADDR, mthd.to_bits()); } + pub fn push_mthd_0inc(&mut self, mthd: M) { + assert!(mthd.to_bits() == 0); + + self.last_inc = self.mem.len(); + let header = MthdHeader::new( + MthdType::ZeroInc, + class_to_subc(M::CLASS), + M::ADDR, + 0, + ); + self.mem.push(header.into_bits()); + } + + pub fn push_mthd_1inc(&mut self, mthd: M) { + self.last_inc = self.mem.len(); + let header = MthdHeader::new( + MthdType::OneInc, + class_to_subc(M::CLASS), + M::ADDR, + 0, + ); + self.mem.push(header.into_bits()); + self.mem.push(mthd.to_bits()); + } + pub fn push_array_method(&mut self, i: usize, mthd: M) { self.push_mthd_bits( class_to_subc(M::CLASS), @@ -205,6 +230,31 @@ impl Push { ); } + pub fn push_array_mthd_0inc(&mut self, i: usize, mthd: M) { + assert!(mthd.to_bits() == 0); + + self.last_inc = self.mem.len(); + let header = MthdHeader::new( + MthdType::ZeroInc, + class_to_subc(M::CLASS), + M::addr(i), + 0, + ); + self.mem.push(header.into_bits()); + } + + pub fn push_array_mthd_1inc(&mut self, i: usize, mthd: M) { + self.last_inc = self.mem.len(); + let header = MthdHeader::new( + MthdType::OneInc, + class_to_subc(M::CLASS), + M::addr(i), + 1, + ); + self.mem.push(header.into_bits()); + self.mem.push(mthd.to_bits()); + } + /// Push an array of dwords into the push buffer pub fn push_inline_data(&mut self, data: &[u32]) { if let Some(last) = self.mem.get_mut(self.last_inc) {