nil: Add support for Blackwell 8 and 16-bit modifiers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Backport-to: 25.2
Reviewed-by: James Jones <jajones@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36336>
This commit is contained in:
Faith Ekstrand 2025-07-23 16:47:16 -04:00 committed by Marge Bot
parent 3247452b2c
commit f1cb63a21d

View file

@ -35,6 +35,8 @@ impl TryFrom<u64> for GOBKindVersion {
pub enum SectorLayout {
TegraK1 = 0,
Desktop = 1,
Blackwell8Bpp = 2,
Blackwell16Bpp = 3,
}
impl TryFrom<u64> for SectorLayout {
@ -44,6 +46,8 @@ impl TryFrom<u64> for SectorLayout {
match sector_layout {
0 => Ok(SectorLayout::TegraK1),
1 => Ok(SectorLayout::Desktop),
2 => Ok(SectorLayout::Blackwell8Bpp),
3 => Ok(SectorLayout::Blackwell16Bpp),
_ => Err("Invalid gob/kind version"),
}
}
@ -55,7 +59,7 @@ struct GOBTypeModifierInfo {
sector_layout: SectorLayout,
}
const GOB_TYPE_MODIFIER_INFOS: [GOBTypeModifierInfo; 3] = [
const GOB_TYPE_MODIFIER_INFOS: [GOBTypeModifierInfo; 5] = [
GOBTypeModifierInfo {
gob_type: GOBType::FermiColor,
gob_kind_version: GOBKindVersion::Fermi,
@ -71,6 +75,16 @@ const GOB_TYPE_MODIFIER_INFOS: [GOBTypeModifierInfo; 3] = [
gob_kind_version: GOBKindVersion::Turing,
sector_layout: SectorLayout::Desktop,
},
GOBTypeModifierInfo {
gob_type: GOBType::Blackwell8Bit,
gob_kind_version: GOBKindVersion::Turing,
sector_layout: SectorLayout::Blackwell8Bpp,
},
GOBTypeModifierInfo {
gob_type: GOBType::Blackwell16Bit,
gob_kind_version: GOBKindVersion::Turing,
sector_layout: SectorLayout::Blackwell16Bpp,
},
];
impl GOBType {
@ -149,7 +163,7 @@ impl TryFrom<u64> for BlockLinearModifier {
} else if !bv.get_bit(4) {
Err("modifier is not block linear")
} else if bv.get_bit_range_u64(5..12) != 0
|| bv.get_bit_range_u64(26..56) != 0
|| bv.get_bit_range_u64(28..56) != 0
{
Err("unknown reserved bits")
} else {
@ -172,7 +186,7 @@ impl BlockLinearModifier {
bv.set_bit(4, true); // Must be 1, to indicate block-linear layout.
bv.set_field(12..20, pte_kind);
bv.set_field(20..22, gob_kind_version as u8);
bv.set_field(22..23, sector_layout as u8);
bv.set_field2(22..23, 26..28, sector_layout as u8);
bv.set_field(23..26, compression_type as u8);
bv.set_field(56..64, DRM_FORMAT_MOD_VENDOR_NVIDIA);
BlockLinearModifier { drm_modifier }
@ -195,7 +209,9 @@ impl BlockLinearModifier {
pub fn sector_layout(&self) -> SectorLayout {
let bv = BitView::new(&self.drm_modifier);
bv.get_bit_range_u64(22..23).try_into().unwrap()
(bv.get_bit_range_u64(22..23) | (bv.get_bit_range_u64(26..28) << 1))
.try_into()
.unwrap()
}
pub fn compression_type(&self) -> CompressionType {