fix(agc): expand comp-to-single DCC keys in a DCC decompress pass #2939
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2939"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-10T18:40:31Z.
What
PPSA28416 (STAR WARS: Galactic Racer, UE5) stops on
mainat its first presentation:The keys are not actually mixed. Every key of the target is
0x10. The target is a 9x1 RGBA16F SW_64KB_R_X surface with pipe-aligned DCC (256 keys over its 64 KiB tile), and the pass is a CB DCC decompress (CB_COLOR_CONTROL.MODE6).0x10is the comp-to-single code,GFX9_DCC_CLEAR_SINGLEin Mesa'ssrc/amd/common/ac_descriptors.h. radv uses it for DCC fast clears that need no fast-clear eliminate (gfx8_get_fast_clear_parametersinradv_meta_clear.c). Itsbuild_clear_dcc_comp_to_single_shaderwrites the clear color into one texel per DCC block, at the block's origin (coord = global_id * dcc_block_size), so a comp-to-single block's value is its top-left texel.ByteKeysdid not know the code, so uniform0x10keys read asMixed.Changes:
DccKeys::ClearSingle(byte0x10). It is not anIsDccClearcode, because it has no fixed clear value, so every other key reader treats it as it treated these keys before (stored texels, refusal).RunColorMetadataPass: a DCC decompress over uniform comp-to-single keys of a non-linear target flushes pending results, gives every texel of the target's extent the element at the start of its 256-byte block (ColorTargetLayout::Offset), stores uncompressed keys, and refreshes a resident image. A fast-clear eliminate over these keys throws, because whether it expands comp-to-single blocks is not modeled. Mixed keys still throw as before.In every non-linear gfx10 swizzle a 256-byte micro-block is one DCC block, and its top-left texel has all in-block address bits zero, so it sits at the block's first byte. The test checks this through the layout instead of assuming it. It expects every texel to equal the original texel at
(x & ~7, y & ~7)of the 8x8 block of a 4-byte SW_64KB_R_X target.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 4080.
agc_driver_graphics: a 128x128 SW_64KB_R_X target with pipe-aligned and unaligned DCC, with0x10keys. A fast-clear eliminate throws and leaves the texels and keys unchanged. A DCC decompress gives every 8x8 block its first texel and stores uncompressed keys over the expected key count.ctest -R "agc_driver|dcc|display_buffer": 257/257 pass. Full suite: 712/712 pass (5 VideoOut tests skipped, as onmain).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-10T22:00:27Z.
Built dfe2967c on main
262c0316on Linux (GCC 16.2.1, RTX 5080);agc_driver_graphicsand the full suite pass apart fromagc_driver_dcc_keys_first_write, which also fails on main here.One case that I think should throw and doesn't: in the new test I set only the first 256 key bytes to 0x10 and the remaining 3840 to 0xff (and in a second run to 0x00), then ran the DCC decompress on the pipe-aligned target. It doesn't throw, the texels are rewritten and all 4096 keys come back as 0xff. So a surface whose keys are mixed past the first 256 is expanded as if it were all comp-to-single.
The test only uses a 4-byte format. I did not try an 8-byte one.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:41:29Z.
Checked on Linux (RADV): build +
agc_driver_graphics/agc_driver_prepared_graphicspass on the PR rebased onto main, and the new cases fail without the change. Confirmed by @fma-rc on Linux RTX 5080.Added one commit of ours:
docs/dev/TechnicalDebt.md: the comp-to-single entry now says "uniform" is judged over the key bytes the driver reads (one per 256 surface bytes, see "DCC key stores"), so keys that differ past that range, as @fma-rc found, are expanded like the other clear codes.Not verified: the block value on real hardware (taken from radv's
build_clear_dcc_comp_to_single_shader), 8-byte elements (the test covers 4-byte) and the title itself. Merging on green CI.