AGC: 8 and 16 bpp SW_64KB_Z_X mip tails use Navi10's limits; addrlib halves them on gfx1013 (dsMipmapHtileFix) #1590

Closed
opened 2026-10-08 13:54:37 +00:00 by kr4y4 · 0 comments
kr4y4 commented 2026-10-08 13:54:37 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-08T13:54:37Z.


ComputeMipLayout gives 8 and 16 bpp SW_64KB_Z_X surfaces the same mip-tail limits as Navi10. AMD's addrlib uses smaller limits for every GFX10 chip except Navi10, including gfx1013. On those chips, the mipmapped Z_X layouts AnyPS5 computes are too small and every level is shifted.

addrlib (Mesa main, src/amd/addrlib/src/gfx10/gfx10addrlib.cpp):

  • m_settings.dsMipmapHtileFix = 1 (L1003), and only ASICREV_IS_NAVI10_P clears it (L1008-1010).
  • With the flag set, for a Z-order swizzle and element index 0 or 1 (8 or 16 bpp), the mip-tail maximum dimensions are divided by Block256_2d[index] / Block256_2d[2] (L3923-3926).
  • gfx1013 (Cyan Skillfish, revision 0x82) keeps the flag.

AnyPS5: GetMipTailLayout (Graphics/src/TextureTiling.cpp) uses the unshrunk thin 64 KiB tail limits for kZ64KBX at every element size, which is the Navi10 behaviour.

Measured by compiling addrlib unmodified (MinGW GCC 15.2), calling Addr2ComputeSurfaceInfo/Addr2ComputeSurfaceAddrFromCoord, and comparing with AnyPS5's TextureTiling.cpp. The config is FAMILY_NV, GB_ADDR_CONFIG 0x00100044 (16 pipes, 256 B interleave), pipeBankXor 0.

SW_64KB_Z_X 8 bpp 256×256, 9 mips surface size first tail mip mip 0 at (0,0) mip 1 at (0,0)
addrlib, gfx1013 (rev 0x82) 196,608 2 0x20000 0x10000
AnyPS5 131,072 1 0x10000 0x8000
addrlib, Navi10 (rev 0x01) 131,072 1 (matches AnyPS5)

Another case: 16 bpp 128×128, full mip chain, has mip 0 at 0x10000 (addrlib, gfx1013) against 0x8000 (AnyPS5).

The same comparison over linear, 256B, 4KB and 64KB S/D/S_T/D_T/Z_X/S_X/D_X/R_X, 8–128 bpp, BC1/BC7, and assorted sizes, mip counts and arrays matches bit for bit for 2D, apart from this case. With addrlib set to Navi10, the remaining 2D results all match. 3D SW_64KB_D_X and linear 3D will be reported separately.

Effect if the PS5 behaves like addrlib's gfx1013:

  • Mipmapped D16 depth, R8 and R16 Z_X textures are read from the wrong offsets.
  • AnyPS5's surface size is smaller than the guest's, so write-back can land in neighbouring memory.

Not established: that the PS5 GPU uses the same setting. Everything here rests on addrlib's per-chip flag, not on a PS5 measurement.

Possible fix, if the flag applies: in GetMipTailLayout, for kZ64KBX with element index 0 or 1, halve widthLimit, and for index 0 also halve heightLimit. Tail slot positions don't change. With that change, the comparison has no mismatches. No existing test covers it: the Z_X tests use 32 and 64 bpp.

Found with AI assistance (Claude Code); the numbers above come from the compiled addrlib comparison described.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5763048486 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1590). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-08T13:54:37Z. --- `ComputeMipLayout` gives 8 and 16 bpp `SW_64KB_Z_X` surfaces the same mip-tail limits as Navi10. AMD's addrlib uses smaller limits for every GFX10 chip except Navi10, including gfx1013. On those chips, the mipmapped Z_X layouts AnyPS5 computes are too small and every level is shifted. **addrlib** (Mesa main, `src/amd/addrlib/src/gfx10/gfx10addrlib.cpp`): - `m_settings.dsMipmapHtileFix = 1` (L1003), and only `ASICREV_IS_NAVI10_P` clears it (L1008-1010). - With the flag set, for a Z-order swizzle and element index 0 or 1 (8 or 16 bpp), the mip-tail maximum dimensions are divided by `Block256_2d[index] / Block256_2d[2]` (L3923-3926). - gfx1013 (Cyan Skillfish, revision 0x82) keeps the flag. **AnyPS5:** `GetMipTailLayout` (`Graphics/src/TextureTiling.cpp`) uses the unshrunk thin 64 KiB tail limits for `kZ64KBX` at every element size, which is the Navi10 behaviour. **Measured** by compiling addrlib unmodified (MinGW GCC 15.2), calling `Addr2ComputeSurfaceInfo`/`Addr2ComputeSurfaceAddrFromCoord`, and comparing with AnyPS5's `TextureTiling.cpp`. The config is FAMILY_NV, GB_ADDR_CONFIG 0x00100044 (16 pipes, 256 B interleave), pipeBankXor 0. | `SW_64KB_Z_X` 8 bpp 256×256, 9 mips | surface size | first tail mip | mip 0 at (0,0) | mip 1 at (0,0) | |---|---|---|---|---| | addrlib, gfx1013 (rev 0x82) | 196,608 | 2 | 0x20000 | 0x10000 | | AnyPS5 | 131,072 | 1 | 0x10000 | 0x8000 | | addrlib, Navi10 (rev 0x01) | 131,072 | 1 | (matches AnyPS5) | | Another case: 16 bpp 128×128, full mip chain, has mip 0 at 0x10000 (addrlib, gfx1013) against 0x8000 (AnyPS5). The same comparison over linear, 256B, 4KB and 64KB S/D/S_T/D_T/Z_X/S_X/D_X/R_X, 8–128 bpp, BC1/BC7, and assorted sizes, mip counts and arrays matches bit for bit for 2D, apart from this case. With addrlib set to Navi10, the remaining 2D results all match. 3D `SW_64KB_D_X` and linear 3D will be reported separately. **Effect if the PS5 behaves like addrlib's gfx1013:** - Mipmapped D16 depth, R8 and R16 `Z_X` textures are read from the wrong offsets. - AnyPS5's surface size is smaller than the guest's, so write-back can land in neighbouring memory. **Not established:** that the PS5 GPU uses the same setting. Everything here rests on addrlib's per-chip flag, not on a PS5 measurement. **Possible fix**, if the flag applies: in `GetMipTailLayout`, for `kZ64KBX` with element index 0 or 1, halve `widthLimit`, and for index 0 also halve `heightLimit`. Tail slot positions don't change. With that change, the comparison has no mismatches. No existing test covers it: the Z_X tests use 32 and 64 bpp. Found with AI assistance (Claude Code); the numbers above come from the compiled addrlib comparison described.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#1590
No description provided.