nouveau/headers: Add raw INC methods in nv_push rust impl

Allows to push new cmd headers explicitly.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36093>
This commit is contained in:
Mary Guillemard
2025-07-21 19:12:09 +02:00
committed by Marge Bot
parent c64d8a0548
commit 9b50cd2f40
+50
View File
@@ -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<M: Mthd>(&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<M: Mthd>(&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<M: ArrayMthd>(&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<M: ArrayMthd>(&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<M: ArrayMthd>(&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) {