From 50a0f9bd884f5100961dc070585bb49a673c8b87 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 27 Jun 2025 16:25:39 -0400 Subject: [PATCH] nil: Add a new GOBType for Z24 on Blackwell+ It's a different memory layout from Ada and earlier. Part-of: --- src/nouveau/nil/modifiers.rs | 2 +- src/nouveau/nil/tiling.rs | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/nouveau/nil/modifiers.rs b/src/nouveau/nil/modifiers.rs index 3941ef86515..b573b37f74c 100644 --- a/src/nouveau/nil/modifiers.rs +++ b/src/nouveau/nil/modifiers.rs @@ -62,7 +62,7 @@ impl GOBType { GOBType::Linear => { panic!("Linear modifierss are handled elsewhere"); } - GOBType::FermiZS => { + GOBType::FermiZS | GOBType::BlackwellZ24 => { panic!("Modifiers are not supported for Z/S images"); } GOBType::FermiColor => GOBKindVersion::Fermi, diff --git a/src/nouveau/nil/tiling.rs b/src/nouveau/nil/tiling.rs index 1e822b990ca..aeb151a8cbf 100644 --- a/src/nouveau/nil/tiling.rs +++ b/src/nouveau/nil/tiling.rs @@ -9,6 +9,7 @@ use crate::image::{ }; use crate::ILog2Ceil; +use nil_rs_bindings::*; use nvidia_headers::classes::{cl9097, clc597, clcd97}; #[repr(u8)] @@ -92,6 +93,9 @@ pub enum GOBType { /// `CopyGOBBlackwell2D2BPP` implements CPU copies for 16-bit Blackwell /// color 2D GOBs. Blackwell16Bit, + + /// The Blackwell+ GOB format for 24-bit depth images + BlackwellZ24, } impl GOBType { @@ -100,14 +104,18 @@ impl GOBType { format: Format, ) -> GOBType { if dev.cls_eng3d >= clcd97::BLACKWELL_A { - if format.is_depth_or_stencil() { - GOBType::FermiZS - } else { - match format.el_size_B() { + match pipe_format::from(format) { + PIPE_FORMAT_Z24X8_UNORM + | PIPE_FORMAT_X8Z24_UNORM + | PIPE_FORMAT_Z24_UNORM_S8_UINT + | PIPE_FORMAT_S8_UINT_Z24_UNORM + | PIPE_FORMAT_X24S8_UINT + | PIPE_FORMAT_S8X24_UINT => GOBType::BlackwellZ24, + _ => match format.el_size_B() { 1 => GOBType::Blackwell8Bit, 2 => GOBType::Blackwell16Bit, _ => GOBType::TuringColor2D, - } + }, } } else if dev.cls_eng3d >= clc597::TURING_A { if format.is_depth_or_stencil() { @@ -133,7 +141,8 @@ impl GOBType { | GOBType::FermiColor | GOBType::TuringColor2D | GOBType::Blackwell8Bit - | GOBType::Blackwell16Bit => Extent4D::new(64, 8, 1, 1), + | GOBType::Blackwell16Bit + | GOBType::BlackwellZ24 => Extent4D::new(64, 8, 1, 1), } }