Repository navigation
fix(agc): decode PS4 texture bases, linear-aligned targets and thin-tiled 3D textures - #9891
Conversation
…nt through the GCN decode PresentDisplayBuffer presents a tiled display buffer from its resident image when a draw rendered it. Otherwise it uploaded the buffer with GpuColorTransfer in the PS5 render-target layout, which needs 64 KiB alignment and does not know GCN tiling. A PS4 title that flips a buffer before drawing into it, with its buffers 32 KiB aligned, failed with "null or misaligned address". A GCN-tiled buffer without a resident image is now read through ReadDisplayBuffer, which decodes the GCN layout and checks the buffer's own 4 KiB alignment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a GCN T#, word 0 and bits 0-5 of word 1 hold the 256-byte base address; bits 6-7 of word 1 are MTYPE_L2 (shadPS4's resource.h: base_address : 38, mtype_l2 : 2). The decode read 40 bits, so a T# with MTYPE_L2 set addressed bit 46 (0x4002_xxxx_xxxx), which no guest page backs: "storage texture has no committed guest pages". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…GCN pitch alignment A PS4 color target with tile mode index 8 (ARRAY_LINEAR_ALIGNED) used the PS5 linear layout, which pads the pitch to 256 bytes. GCN aligns a linear-aligned pitch to max(8, 64 / bytes per element) elements, as AddrLib's SiLib::HwlGetPitchAlignmentLinear does for a surface that is not interleaved and as this driver's PS4 texture layout already does. A 320-element 16-bit target failed "PS4 color target pitch or slice is not padded the way its tile mode pads them", and its rows would have been addressed 384 elements apart. ColorTileMode::GcnLinear has that pitch alignment and is linear and GCN everywhere else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thin-tiled PS4 volume is stored like a layered surface whose level n holds max(1, depth >> n) slices, padded to a power of two with POW2_PAD. It becomes one 3D image of its depth; thick modes still throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GCN T# whose MIN_LOD sets the two bits above its 38-bit base decodes to the base alone, and GCN linear-aligned color targets pad a row to max(8, 64 / element bytes) elements while PS5 linear targets keep 256 bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The test report explicitly says fix 1 has no automated coverage. Could you add a focused display-buffer test for |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@savvaniss, a dependency note for 822a9ea ( AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
@savvaniss I checked @ntamas94's note against this head and it holds. With 822a9ea, a GCN-tiled flip that has no resident image goes through Before this commit those flips failed with "null or misaligned address". With it they present a wrong picture without any error, so I'd rather not merge it before the decode is fixed. #9673 is that fix, and it merges cleanly with this branch. Could you add |
|
@savvaniss This PR now conflicts with main in |
GuestTextureResource keeps this branch's gcnPitch, gcnPow2Pad and gcnLinearGeneral and main's fmaskCmaskAddress. layeredDepthStorage drops the layer-pitch refusal, since main's LayeredDepthStorage now places each layer at GuestLayerOffset, and keeps this branch's refusal of level-major PS4 surfaces, whose layers GuestLayerOffset does not place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in main 07da04f through the boykopovar#9431 merge offered as Get-fix#22. main replaced the DB depth copy compute pass (RunDepthCopyPass) with a draw through the normal path, so this branch's linear check in it goes with it: a depth copy into a GcnLinear target is now drawn like any other draw into a linear target that is not resident. The texture tiling test keeps both sides' includes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean merged, no rebase. The head is now
On the RX 9070 XT with the validation layer, 50 AGC, depth, texture and VideoOut flip tests:
The three revert checks still fail with the same messages on the new base. The body has the details, and #9879 is a new overlap on the resident-target lines. AI-assisted: yes (Claude Code) |
|
@savvaniss The metadata and depth-copy merge points are answered, but the display-decoder dependency is still open. The current four-byte DecodeDisplayBuffer loop still uses the PS5 tiling formula for DisplayTilingGcn, while this PR sends nonresident GCN flips through it. Please carry the #9673 fix or add Depends on: #9673 as requested in comment 6353541175. #9431 also remains an open prerequisite; the compatibility merge offered to its author does not by itself establish its landing or full qualification. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (4, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 483 tests)Skipped (47)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Hi savvaniss, main moved today and this PR no longer merges cleanly. Could you merge main into this branch and resolve them, keeping what those PRs added? A merge commit is fine; no need to rebase or force-push. Once it's pushed we'll re-review the merge. |
This branch and main both contain 26d651d, so a default merge uses a virtual base and reports conflicts in GuestTextureResource.hpp, TextureTiling.hpp/.cpp, TextureDetiler.cpp and State.cpp that neither side made. Merged against main's last merge base cc26ab4 instead: no conflicts, and the result differs from main by exactly this branch's own changes.
|
Hi XairRrR, Could you take another look at #9891? Head
Our local build of this head: the 43 focused tests pass (the two display-present entries skip as above). |
GuestTextureResource.cpp: main moved the 40-bit base read into descriptorBaseAddress(words); this branch reads it as descriptorBase(words), which masks 38 bits under GCN guest shaders. Keep this branch's descriptorBase(words) << 8u at that site. Main's new TextureResourceAllocationAddress still uses the 40-bit descriptorBaseAddress.
|
Hi savvaniss, We merged current main into #9891 again (only GuestTextureResource.cpp conflicted). Main now reads the texture base through One thing to check: main also added |
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 512 tests)Skipped (46)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
…t base TextureResourceAllocationAddress read 40 bits of the T# base, so a PS4 T# with MTYPE_L2 set looked up the allocation of an address above bit 46. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean Yes, it should. Bits 6-7 of word 1 are MTYPE_L2 on a PS4 T#, so with them set |
XairRrR
left a comment
There was a problem hiding this comment.
Re-checked — approved
All four blocking findings from my last review are resolved. Since then, current main was merged in, the non-resident GCN flip goes through the common present tail, #9673's 4-byte decode fix is carried here, IsNullTextureResource and TextureResourceAllocationAddress read the 38-bit PS4 base, and GcnDetile.cpp gained a thin-mode 3D case.
What changed since my last review
My last review was of 375f5630ba. Since then:
mainwas merged in several times. #9431 is now onmain, so the diff againstmainis only this PR's 16 files.- New commits:
574321b323:DecodeDisplayBuffer's 4-byte loop usestexelOffset.145e53d6c2: the early return is gone, and a newagc_driver_gcn_display_presenttest was added.83ca6990ae:IsNullTextureResourcereads the base through a shared helper.63cc6f846c: a volume case inGcnDetile.cpp.393648d082: debt text.ca0255b639: 38-bit mask indescriptorBaseAddress, used byTextureResourceAllocationAddress, with a check inagc_driver_graphics.
- The author replied point by point (2026-10-30). They did not extend
video_out_flip_ps4because VideoOut onmaincannot register a tiled PS4 buffer yet. That reason is valid. The new test calls the driver's present entry point instead.
What I ran
- PR head
ca0255b639dc987f8b9a6a347646b7868a4f6346,maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8, merged treee5f2fcc260cc0adbd7d99e94b417b57246b8bfd0. - Debian 13 VM, 32 vCPU (Xeon Gold 6136), GCC 14.2.0, Release, Ninja, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19), no GPU.
git diff --check a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8...ca0255b639dc987f8b9a6a347646b7868a4f6346
python3 tools/check_conventions.py --base a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
ctest --test-dir build -j4 -V -R '^(agc_driver_graphics|agc_driver_gcn_detile|agc_driver_gcn_display_present|agc_shader_memory)$'
# negative control 1: only the 38-bit mask in descriptorBaseAddress put back to 0xffffffffffull
ninja -C build agc_driver_graphics_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R '^agc_driver_graphics$'
# negative control 2: Graphics/src/TextureTiling.cpp and Graphics/include/TextureTiling.hpp from main
git show a4eca2a056:<path> > <path>
ninja -C build agc_driver_gcn_detile_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R '^agc_driver_gcn_detile$'
# restore from the merged tree, rebuild, rerun with the validation layer
git show e5f2fcc260:<path> > <path>
git status --porcelain # empty
ninja -C build agc_driver_graphics_tests agc_driver_gcn_detile_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ... ctest --test-dir build -V -R '^(agc_driver_graphics|agc_driver_gcn_detile)$'| Check | Result |
|---|---|
Merge into main |
clean (script) |
git diff --check |
clean |
check_conventions.py |
All conventions checks passed. |
Build on Linux/GCC 14, including PipelineJournal.cpp, whose size guards assert State == 928 and ShaderStages == 164 |
passes |
| Script's selected test run | 2136 ran, 0 new failures, 0 timeouts. 7 known failures also fail on main. 2 main_sync_renames_* tests that fail on main pass here. |
agc_driver_graphics, agc_driver_gcn_detile, agc_shader_memory with the validation layer |
pass |
agc_driver_gcn_display_present |
skipped (SDL offscreen, no Vulkan surface) |
VUID- lines / was not found but was requested |
0 / 0. The loader log shows VK_LAYER_KHRONOS_validation inserted for the instance and the device. |
Negative controls
# 40-bit mask back in descriptorBaseAddress only
1/1 Test #1585: agc_driver_graphics ..............***Failed 34.12 sec
AGC graphics: a PS4 T# with MTYPE_L2 set looked up its allocation at an address other than its 38-bit base
# TextureTiling.cpp/.hpp as on main
1/1 Test #1027: agc_driver_gcn_detile ............***Failed 3.97 sec
AGC graphics: PS4 3D and multisampled textures are not implemented
Previous findings
- Blocking 1, conflicts with
main: Resolved. The script merged the head intoa4eca2a056with no conflict. - Blocking 2, Linux build fails on the
PipelineJournal.cppsize guards: Resolved. The PR no longer changesStateorShaderStages. The merged tree builds with GCC 14/libstdc++ on x86-64, where the guards atcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp:44-45are active. - Blocking 3, the early return skips
ensureHdrScaler, frame dumps and screenshots: Resolved. I checked this by reading the code. The decoded pixels are produced atcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:3650and passed to the commonpresent(...). That call comes after the dump and screenshot handling and afterensureHdrScaleratVulkanDevice.cpp:3642. The overlayplaneis now passed too. The runtime check inagc_driver_gcn_display_present(SDR and HDR10) skipped here, so that run is author-reported. - Blocking 4,
DecodeDisplayBufferuses the PS5 formula for GCN buffers: Resolved. The 4-byte loop now usestexelOffset(buffer, x, y, 4u)(core/libs/prx/libSceAgcDriver/Execution/src/DisplayBuffer.cpp:196), like the half-float loop. - Non-blocking 1, "MIN_LOD" in the test message: Resolved. It now says MTYPE_L2.
- Non-blocking 2,
IsNullTextureResourcereads 40 bits: Resolved. It usesdescriptorBase(words), and a test pins the zero-base MTYPE_L2 case. - Non-blocking 3, the debt entry contradicts itself: Resolved. It now opens with "thick modes (GB_TILE_MODE 15 and 19 to 26) throw".
- Non-blocking 4, no GPU test of a PS4 volume: Resolved.
detileVolumeintests/execution/GcnDetile.cppdetiles the 6/3/1 slices in four thin modes, with and without POW2_PAD, then creates the 3DTexture. It fails with volumes refused again (negative control 2).
New findings
Blocking
None.
Non-blocking
- Two identical base helpers. After
ca0255b639,descriptorBaseAddress(core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp:71-75) anddescriptorBase(GuestTextureResource.cpp:139-141) apply the same GCN/PS5 mask. The only difference is the<< 8.DecodeTextureResourcecallsdescriptorBase(words) << 8u(GuestTextureResource.cpp:175), which is exactlydescriptorBaseAddress(words). Keeping one helper would stop the decode and the allocation lookup from drifting apart again, which is the bug the last commit fixed. Suggested fix: dropdescriptorBase, usedescriptorBaseAddressat line 175, and usedescriptorBaseAddress(words) == 0inIsNullTextureResource.
Not verified
agc_driver_gcn_display_presentskipped here (SDLoffscreen, no Vulkan surface). It also skipped in the NVIDIA bot's runs and in the other local run reported on this PR. The SDR/HDR10 presentation, frame-dump and screenshot checks have only run on the author's RX 9070 XT.- The script did not compare validation output with
main: itsmainbaseline (0278ca9831) has no validation run yet. I ranagc_driver_graphicsandagc_driver_gcn_detilewith the layer and saw 0VUID-lines, so there is nothing new to compare. I did not run the layer onmainmyself. agc_driver_graphicstook about 34 s here, with and without the layer. That is over the 30 s rule. The NVIDIA bot reported it at 31-32 s on earlier heads. This PR adds only a few CPU checks to it, so I don't count the time against the PR, but I did not time it onmainon this machine.- No title was run; the titles also need #9432.
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 512 tests)Skipped (46)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
On RX 9060 XT / RADV, the focused GCN detile fixture passed on both trees, including the candidate's 3D volume cases; a supplemental offset assertion found a limitation in that fixture's sensitivity to a deliberate layout mutation.
Reproductioncmake --build build-main --target agc_driver_gcn_detile_tests -j 4
export ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer
export VK_LAYER_PATH="$HOME/.local/share/anyps5-tester/vk-layers/usr/share/vulkan/explicit_layer.d"
ctest --test-dir build-main -R '^agc_driver_gcn_detile$' --timeout 120 -VRun three times on each tree. For the control, on the merged stack make AI-assisted independent hardware test run (gpt-6.1-terra, medium). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The volume fixture wrote and read through the computed geometry, so a wrong slice count per level still passed. Check that level 1 starts after the six level 0 slices, level 2 after three level 1 slices (four with POW2_PAD), and that the surface ends after the one level 2 slice. Suggested by RNK123. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@RNK123 thanks, you're right: the volume fixture placed slices with the same geometry it was checking, so the per-level slice count went untested. I added your assertion in
Each check fails on its own mutation of
AI-assisted: yes (Claude Code) |
XairRrR
left a comment
There was a problem hiding this comment.
Re-checked — approved
Since my last review, main 1e658521a0 was merged in (9b9288abc8) and a test-only commit (cebb30f132) was pushed. The merged tree builds, the focused tests pass and the negative control still fails. The one new VUID- the script flagged comes from main, not from this PR.
What changed since my last review
My last review was of ca0255b639. Since then:
-
9b9288abc8mergesmain1e658521a0. The PR's eleven own commits are unchanged (delta.patch shows them all as=). The only conflict was indocs/dev/debt/libSceAgcDriver.md. The resolution keeps both sides: this branch's thick-and-layered, array-layer-bank and non-resident-flip entries, andmain's render-target entry with its PS4 depth-target sentence. -
cebb30f132(test only, after RNK123's comment) adds three asserts todetileVolumeintests/execution/GcnDetile.cpp:- level 1 starts after the 6 level 0 slices;
- level 2 starts after 3 level 1 slices, or 4 with
POW2_PAD; guestBytesends after the one level 2 slice.
The script built and tested
9b9288abc8, so this commit is not in the tree I ran (see Not verified). I read its diff. The asserts are host-side and check what the commit message says.GcnDetile.cppis a test file, so no debt doc change is needed.
What I ran
PR head 9b9288abc84fafb1530018d7c6a26ae8895dc0f2, main 086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree 0afca9fbedbfef7aa5655089829115b4ec2b32e5. Debian 13 VM, 32 vCPU (Xeon Gold 6136), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6), no GPU.
git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...9b9288abc84fafb1530018d7c6a26ae8895dc0f2
python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511
# where the new VUID in agc_driver_image_gather_volume comes from
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 \
ctest --test-dir build -V -R '^agc_driver_image_gather_volume$'
# restore the PR's 10 production files from main (DisplayBuffer.cpp, VulkanDevice.cpp, ColorTargetLayout.hpp/.cpp,
# TextureTiling.hpp/.cpp, ColorTargetTransfer.cpp, Draw.cpp, GuestTextureResource.cpp, State.cpp)
git show 086c0686c8:<path> > <path>
ninja -C build -j32 -l32 agc_driver_image_gather_volume_tests agc_driver_gcn_detile_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ... ctest --test-dir build -V -R '^agc_driver_image_gather_volume$'
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R '^agc_driver_gcn_detile$'
# restore the merged tree
git show 0afca9fbed:<path> > <path>
git status --porcelain # empty
ninja -C build -j32 -l32 agc_driver_gcn_detile_tests agc_driver_image_gather_volume_tests agc_driver_graphics_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
ctest --test-dir build -j4 -V -R '^(agc_driver_gcn_detile|agc_driver_graphics|agc_driver_gcn_display_present)$'| Check | Result |
|---|---|
Merge into main |
clean (script) |
git diff --check |
clean |
check_conventions.py |
All conventions checks passed. |
| Build (script) | passes |
| Script's selected tests | 2239 ran, 0 new failures, 0 timeouts. 7 known failures also fail on main. |
| Script's validation comparison | 783 tests, layer loaded in 782, none missing. One test with new VUID- lines: agc_driver_image_gather_volume, marked "test not run on main". |
agc_driver_image_gather_volume with the PR's production files restored from main |
the same 4 VkSamplerCreateInfo VUIDs, so they come from main |
agc_driver_gcn_detile, agc_driver_graphics with the layer (merged tree) |
pass, 0 Validation Error, layer inserted for the instance and the device |
agc_driver_gcn_display_present |
skipped (SDL offscreen, no Vulkan surface) |
The gather-volume VUIDs come from main
agc_driver_image_gather_volume arrived on main with #9183 (0bf0563442), after the script's validation baseline 1e658521a0. That is why the script marks it "test not run on main". With the PR's production files restored from main:
1/1 Test #1237: agc_driver_image_gather_volume ... Passed 9.60 sec
Validation Error: [ VUID-VkSamplerCreateInfo-addressModeU-01079 ]
Validation Error: [ VUID-VkSamplerCreateInfo-addressModeU-parameter ]
Validation Error: [ VUID-VkSamplerCreateInfo-addressModeV-parameter ]
Validation Error: [ VUID-VkSamplerCreateInfo-addressModeW-parameter ]
These are the same four IDs as on the merged tree, so they are not counted against this PR.
Negative control (PR production files from main)
1/1 Test #1194: agc_driver_gcn_detile ............***Failed 4.05 sec
AGC graphics: PS4 3D and multisampled textures are not implemented
Previous findings
- Non-blocking 1, two identical base helpers: Still open.
descriptorBaseAddress(core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp:71) anddescriptorBase(GuestTextureResource.cpp:139) still apply the same mask.DecodeTextureResourcestill usesdescriptorBase(words) << 8uat line 183. This does not block the merge, but a single helper would keep the decode and the allocation lookup from drifting apart.
All earlier blocking findings stay resolved: the merge is clean, the build passes, the common present tail is used, and the GCN decode goes through texelOffset.
New findings
Blocking
None.
Non-blocking
None.
Not verified
cebb30f132was not built or run here. The script's tree is the merge of9b9288abc8. That commit only adds three host-side asserts toGcnDetile.cpp, and I read them. The author reports thatagc_driver_gcn_detilepasses 3/3 with them on an RX 9070 XT, and that each of fourTextureTiling.cppmutations fails one of them. That evidence is author-reported.agc_driver_gcn_display_presentskipped again (no Vulkan surface under SDLoffscreen). The SDR/HDR10 presentation, frame-dump and screenshot checks have only been run by the author.agc_driver_graphicstook 35.5 s here with the layer, over the 30 s rule, as in my previous review. The PR adds only a few CPU checks to it, and I did not time it onmain.- No title was run; the titles also need #9432.
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 517 tests)Skipped (49)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
XairRrR
left a comment
There was a problem hiding this comment.
Re-checked — approved
The only change since my last review is the test-only commit cebb30f132, which adds level-offset asserts to the PS4 volume case of agc_driver_gcn_detile. It is now in the merged tree. It builds, passes with the validation layer and fails under a slice-count mutation. There is one non-blocking issue: when the second volume of a mode fails, the test crashes while unwinding instead of printing its message.
What changed since my last review
I last reviewed 9b9288abc8. The script built and tested that commit, without cebb30f132, so last time I only read this commit's diff. delta.patch shows the PR's 11 earlier commits unchanged (=). The only new commit is cebb30f132, which adds three host-side asserts to detileVolume (core/libs/prx/libSceAgcDriver/tests/execution/GcnDetile.cpp:98-100). The description gained a "Level offsets, 3 Nov." paragraph. There are no new author replies to my review.
What I ran
PR head cebb30f1323bc3a57657d9147aa8e6d03c86014e, main 086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree dbde32d139517db378e52d9fdb7e44e1319e1c84. Debian 13 VM, 32 vCPU (Xeon Gold 6136), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6), no GPU.
git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...cebb30f1323bc3a57657d9147aa8e6d03c86014e
python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511
ninja -C build -j32 -l32 agc_driver_gcn_detile_tests agc_driver_graphics_tests
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
ctest --test-dir build -V -R '^agc_driver_gcn_detile$'
# mutation A, in TextureTiling.cpp GcnLevelSlices: "if (!volume || level == 0) return slices;" -> "return slices;"
ninja -C build -j32 -l32 agc_driver_gcn_detile_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R '^agc_driver_gcn_detile$'
git show dbde32d139:core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
# mutation B: "return pow2Pad ? std::bit_ceil(levelSlices) : levelSlices;" -> "return levelSlices;"
ninja -C build -j32 -l32 agc_driver_gcn_detile_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R '^agc_driver_gcn_detile$'
ANYPS5_REQUIRE_VULKAN=1 build/tests/agc_driver_gcn_detile_tests
git show dbde32d139:core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
git status --porcelain # empty
ninja -C build -j32 -l32 agc_driver_gcn_detile_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -R '^agc_driver_gcn_detile$'| Check | Result |
|---|---|
Merge into main |
clean (script) |
git diff --check |
clean |
check_conventions.py |
All conventions checks passed. |
| Build (script, and the two test targets here) | passes |
| Script's selected tests | 2239 ran: 0 new failures, 0 timeouts, 7 known failures that also fail on main |
| Script's validation comparison | 783 tests, layer loaded in 782, missing in none. The only new VUID- lines are in agc_driver_image_gather_volume, marked "test not run on main". Last time I showed they come from main (#9183): the same four VkSamplerCreateInfo IDs appear with this PR's production files restored from main. Nothing in this push touches that path. |
agc_driver_gcn_detile with the layer |
passes in 5.8 s. 0 VUID-/Validation Error lines. The layer was inserted for both the instance and the device. |
| Mutation A (all slices kept at levels 1 and 2) | fails: PS4 volume in tile mode 15: level 2 does not start after 3 level 1 slices |
Mutation B (no POW2_PAD rounding) |
fails, but with exit 139 (SEGFAULT) and no message, see the non-blocking finding |
| Restored tree | git status --porcelain is empty, and agc_driver_gcn_detile passes again |
Negative control
The commit adds test asserts only. Restoring the PR's production files from main still fails the volume case with "PS4 3D and multisampled textures are not implemented", as in my last review. The new asserts target the slice count per level, so I also mutated GcnLevelSlices in two ways (table above). Both mutations make the test fail. The author's report that the fixture without this commit passes these mutations matches RNK123's control. I did not repeat that run.
Previous findings
- Non-blocking: two identical base helpers. Still open.
descriptorBaseAddress(core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp:71) anddescriptorBase(GuestTextureResource.cpp:139) still apply the same mask.DecodeTextureResourceusesdescriptorBase(words) << 8uat line 183. This does not block the merge. - Not verified last time:
cebb30f132was not built or run. Resolved. It is now built and run here (see Results).
New findings
Blocking
None.
Non-blocking
- A failure on the second volume of a mode crashes the test instead of reporting it (
core/libs/prx/libSceAgcDriver/tests/execution/GcnDetile.cpp:171-173).- What happens: with mutation B, the
POW2_PAD=falsevolume completes. ThePOW2_PAD=truevolume then throws at line 99. Unwinding ends in a segfault (exit 139) beforemain'scatchprints the message, so ctest shows only(SEGFAULT). The author sawVUID-vkEndCommandBuffer-commandBuffer-00059on the same path on Windows. - Why it happens: the
device->WaitIdle()the PR added at line 173 runs only on the success path. The previous volume'sTextureuploads can still be in flight when the exception unwindsdetilerand the device. - Why it matters: the test still fails, so a regression is not missed, but it is harder to diagnose.
- Suggested fix: call
context/device wait-idle at the end ofdetileVolume, or inmain'scatchbefore the device is reset.
- What happens: with mutation B, the
Not verified
agc_driver_gcn_display_presentwas not re-run. This push changes nothing on its path, and without a Vulkan surface (SDLoffscreen) it skipped here before.- I ran no other hardware vendor. The RX 9070 XT runs of this commit are author-reported, and RNK123 ran the fixture on RADV.
- I ran no title.
✅ AMD GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (9, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 517 tests)Skipped (59)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (1, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 517 tests)Skipped (49)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
What
The AGC half of Get-fix#1, moved upstream as Get-fix asked. #9431, which this was stacked on, is merged, and this branch has
mainmerged in. These are four PS4 surface fixes found while bringing up Risk and Monopoly Plus from CUSA03312 on #6977's branch. The shader half is in its own pull request onmain, #9889.PresentDisplayBufferuploaded a tiled display buffer with no resident image throughGpuColorTransfer, in the PS5 render-target layout. That layout needs 64 KiB alignment and doesn't know GCN tiling. Risk flips its 32 KiB-aligned 1920x1080 buffers before drawing into them, and failed with "null or misaligned address". A GCN-tiled buffer with no resident image now goes throughReadDisplayBuffer, which decodes the GCN layout and checks the buffer's own 4 KiB alignment.DecodeDisplayBuffer's 4-byte loop only knew the linear and PS5 layouts. It now usestexelOffset, the same change as fix(libSceAgcDriver): decode PS4 tiled scanouts in their own layout on the CPU path #9673, carried here because this path reaches it.maincan't register a tiled PS4 buffer yet (feat(libSceGnmDriver): build PS4 command buffers and submit them #9432 does that), so titles reach this path once feat(libSceGnmDriver): build PS4 command buffers and submit them #9432 lands.MTYPE_L2, so the base is 38 bits (shadPS4'sresource.h:base_address : 38; mtype_l2 : 2).DecodeTextureResourceread 40 bits. SoMTYPE_L2 = 1set address bit 46, and a storage texture failed with "storage texture has no committed guest pages".IsNullTextureResourcereads the base the same way now, so a zero base withMTYPE_L2set is null.max(8, 64 / bytes per element)elements, as AddrLib'sSiLib::HwlGetPitchAlignmentLineardoes and as feat(libSceAgcDriver): draw PS4 (GCN) command buffers #9431's PS4 texture layout already does.ColorTileMode::GcnLinearcarries that alignment.mainhas resident linear targets since this was written. They keep taking only PS5Lineartargets, so a GCN linear-aligned target is still copied in and out as before. Making it resident is separate work.mainnow draws a DB depth copy through the normal draw path, andRunDepthCopyPassis gone. So the linear check this PR changed there went with it. A depth copy into a GCN linear-aligned target is drawn like any other draw into a linear target that is not resident.POW2_PAD. That is how ac_surface and AddrLib's PostComputeMipLevel count them. It becomes one 3D image of its depth, and thick modes still throw. The debt entry for thick and layered surfaces says so.Tested
Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004),
ANYPS5_GPU=AMD,ctest -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.Merge of
mainde83e8f270, 31 Oct. Head341659473d. The only conflict was indocs/dev/debt/libSceAgcDriver.md: both sides kept, with main's layer bank text as its own debt entry to stay under the length limit. On the merge before that debt split:agc_driver_graphics,agc_driver_gcn_detileandagc_driver_gcn_display_presentpass, 3 of 3 on the RX 9070 XT, noVUID-line. Not rerun: the other tests, Linux (mainchanged no struct under the size guards in this merge), games.Merge of
maincc26ab4438, 1 Nov. Head825f9b3f7c. Two conflicts.mainmoved the AGC test registrations intotests/cmake, andtools/agc_test_split.py resolvemoved this branch'sdecoder_pnglink toagc_driver_gcn_display_present_tests.cmake. Indocs/dev/debt/libSceAgcDriver.mdthe merge keepsmain's tiling and 2D PRT entries and this branch's thick and array layer bank entries.agc_driver_graphics,agc_driver_gcn_detileandagc_driver_gcn_display_presentpass, 3 of 3 on the RX 9070 XT under the validation layer, noVUID-line. Not rerun: the other tests, Linux, games.Merge of
main1e658521a0, 3 Nov. Head9b9288abc8(onca0255b639). The only conflict was indocs/dev/debt/libSceAgcDriver.md: the merge keeps this branch's thick and layered, array layer bank and resident-image flip entries, andmain's render-target entry with its new PS4 depth-target sentence.FormatVersionstaysmain's 52 (this branch does not change it) and no size guard changes. On the RX 9070 XT (driver 32.0.31041.1004, Windows, Release) withANYPS5_GPU=AMD ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_driver,agc_driver_graphics,agc_driver_flip,agc_shader_memory,agc_driver_gcn_detileandagc_driver_gcn_display_presentpass, 6 of 6, everySelected GPUline names the RX 9070 XT and there is noVUID-line.tools/check_conventions.py --base origin/mainpasses. Not rerun: the rest of the suite, Linux, and the game.Base. #9431 is merged, so this branch is
mainplus this PR's own changes. Tests ran onmain5b913d40c6and on this branch with thatmainmerged in. The final merge ofmainfd41cca5d9touches no AGC, VideoOut or shader file.Results.
VUID-linesmain5b913d40c6video_out_hdr_probe(the monitor reports HDR)agc_driver_gcn_display_present.agc_driver,agc_driver_pm4,agc_driver_graphics,agc_driver_register_key,agc_driver_gcn_detile,agc_driver_gcn_buffer_format_lookupandagc_driver_pattern_buffer_fill;agc_driver_flip, thevideo_out_flip_*modes,video_out_hdr_present,video_out_hdr_probe,linear_display_buffer,agc_display_buffer_dcc,agc_host_hdrandagc_screenshot;agc_gcn_decode,texture_format_lookup,agc_driver_resource_cache_replaced_textureandagc_depth_copy_kept_bytes;agc_driver_pipeline_journalandagc_pipeline_journal*tests, and theagc_driver_depth_*tests.was not found but was requested by env var VK_INSTANCE_LAYERS, and everySelected GPUline names the RX 9070 XT.video_out_flip_*tests ran on a real window here. None of them skipped.Revert checks. One part at a time on this branch, each rebuilt and run with the same environment. The first group is
agc_driver_gcn_display_present; the rest areagc_driver_graphicsoragc_driver_gcn_detile.APS5_FORCE_SDR=1ensureHdrScalerfor a GCN flipDisplayBuffer.cppas onmainIsNullTextureResourceColorTargetLayout.cppas onmainagc_driver_gcn_display_present(new).maincan't register a tiled PS4 buffer yet (feat(libSceGnmDriver): build PS4 command buffers and submit them #9432 does that), sovideo_out_flip_ps4can't reach this path.agc_driver_gcn_detile(new case).POW2_PAD.POW2_PAD), and the end of the surface after the one level 2 slice. The element comparison alone can't catch a wrong slice count, because the fixture places slices with the same geometry.Texture, so the validation layer sees the image and its per-level copies. The test doesn't read that image back (it has no transfer-source usage) and doesn't sample it.Linux. WSL Ubuntu, g++ 15.2.0, cmake 4.2.3, Unix Makefiles, Release,
-j 4, on the Linux filesystem, at this branch before the lastmainmerge and a debt-only edit. The size guards are active there, sosizeof(State) == 920andsizeof(ShaderStages) == 164were evaluated. Built without errors: all oflibSceAgcDriver, includingGraphics/src/PipelineJournal.cppandcore/shader/recompiler/ShaderDiskCache.cpp, andagc_driver_graphics_tests,agc_driver_gcn_detile_testsandagc_driver_gcn_display_present_tests.CMakeLists.txt. No source file changed.agc_driver_graphicsandagc_driver_gcn_detilepassed there on Mesa's llvmpipe (software Vulkan, no validation layer).agc_driver_gcn_display_presentskipped: SDL has no Vulkan video driver in that build.CUSA03312. Each fix removed a stop in Risk or Monopoly Plus on
ps4/limbo-gpuat93eeee0141(#6977's head then), with Get-fix#2 and local stand-ins forsceGnmDrawInitDefaultHardwareState200andsceGnmUpdate*Shader(Get-fix#1 has the details). Not rerun on this base: the titles also need #9432.Other people's runs. On head
375f5630ba, @ycbuzi ran the tests on an RTX 4070 SUPER, a GTX 1650 SUPER and an AMD RDNA2 iGPU, and @DealPotato ran them on an RTX 4070 with the flip tests on a real display. @DealPotato also took inFAMOUS Second Son (CUSA00004) past its "storage texture has no committed guest pages" stop through the T# base change.Conventions.
tools/check_conventions.py --base origin/mainpasses.Overlap.
tools/pr_overlap.py --branch fix/ps4-cusa03312-surfaces, againstmainfd41cca5d9, lists three pull requests:TextureTiling.cppand the thick-surface debt entry, and compose: a 3D T# in a thick mode takes feat(libSceAgcDriver): lay out PS4 textures in tile mode 19 (Thick_1dThick) #9674's path, and one in a thin mode takes this one.It could not compare 109 others that conflict with
mainthemselves.#9673 is not listed. Its
DisplayBuffer.cpphunk is byte-identical to the one here, and a simulated merge in either order shows no conflict in that file. Both histories carry #9431's old head, so the simulated merge does report one line ofState.cpp:case 8u, which takes this PR'sGcnLinear.Allocation lookup, 2 Nov. Head
ca0255b639, ona100474e12.main'sTextureResourceAllocationAddressread 40 bits of the T# base, so a PS4 T# with MTYPE_L2 (word 1 bits 6-7) set looked up the allocation of an address above bit 46;descriptorBaseAddressnow applies the same 38-bit mask asdescriptorBaseunder GCN guest shaders.agc_driver_graphicschecks that the lookup address of the MTYPE_L2 T# equals its decoded base, and fails with the fix removed ("a PS4 T# with MTYPE_L2 set looked up its allocation at an address other than its 38-bit base"). Run on Windows 11 Pro 26300 withANYPS5_GPU=AMD,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_driver_graphicsandagc_shader_memorypass, noVUID-line (neither opens a Vulkan device). Not rerun: the display-present tests, Linux, CUSA03312.check_conventions.pypasses.Level offsets, 3 Nov. Head
cebb30f132, on9b9288abc8. As @RNK123 suggested, the volume case now checks the level offsets above. On the RX 9070 XT (AMD driver 26.8.1, Windows, Release) withANYPS5_GPU=AMD ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,agc_driver_gcn_detilepasses 3 of 3, with noVUID-line. Each of fourTextureTiling.cppmutations fails it 3 of 3 at its own check, and the fixture without this commit passes all four: six slices kept at levels 1 and 2, noPOW2_PADrounding, level 0 rounded too, andguestBytescounting six last-level slices.check_conventions.pypasses. Not rerun: the other tests, Linux, CUSA03312.Checklist
main; no other open PR implements the same functions (mainmerged in; the one-line decode fix is shared with fix(libSceAgcDriver): decode PS4 tiled scanouts in their own layout on the CPU path #9673, as asked on this pull request)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code