diff --git a/src/nouveau/nil/modifiers.rs b/src/nouveau/nil/modifiers.rs index 00d33429c6a..6c838002729 100644 --- a/src/nouveau/nil/modifiers.rs +++ b/src/nouveau/nil/modifiers.rs @@ -35,6 +35,8 @@ impl TryFrom for GOBKindVersion { pub enum SectorLayout { TegraK1 = 0, Desktop = 1, + Blackwell8Bpp = 2, + Blackwell16Bpp = 3, } impl TryFrom for SectorLayout { @@ -44,6 +46,8 @@ impl TryFrom 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 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 {