fix(agc): end a native multisample depth surface when another target reuses its partly filled HTILE #28667
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28667"
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 oneandonlydean on 2026-12-02T18:11:39Z.
What
A native multisample depth surface stays active after the title fills part of its HTILE and binds a different depth target at the same HTILE base. The partial fill latches "native multisample depth metadata fill transition is not implemented" on the older surface, and the next use of it stops the run (#28612: PPSA25009, 1 of 8 to 1 of 15 runs; in the logged hit a fill of
0x10000at the base of a 1920x1080 4 sample surface with a0x30000HTILE is followed directly by the bind of a new 1024x1024 1 sample target whose whole HTILE is that0x10000).The fill is the clear of the new target's HTILE, not a transition of the older surface, so at the bind the older surface is now ended:
NoteDepthMetadataFillmarks a surface whose HTILE a fill overlaps without covering (htilePartlyFilled), at the place where the refusal is latched.DepthSurfaceViewWithStencilWriteIntentends every marked active surface whose HTILE range overlaps the new target's HTILE and that does not hold the new target (endSurfacesUnderReusedHtile): inactive, its guest guards removed, retired, asRetireReplacedDepth_nid_no_patchdoes. One[gpu]line per ended surface (first 8).Nothing else changes: a surface with a partial fill that is used again with no other target bound over its HTILE still refuses, a bind over an HTILE that was not partly filled behaves as before (an unwritten owner is released, a written one is published or refuses), and the same target bound again keeps its surface.
The ended surface's host-only depth is dropped and a later bind of the older target starts from guest memory; that is recorded in the debt fragment.
#28566 edits
clearedHtiles,takeClearedHtileand one line ofRetireReplacedDepth_nid_no_patchin the same file. The two do not overlap in text or behaviour: this PR acts aftertakeClearedHtileand only on a surface with a partly filled HTILE.Tested
Linux (CachyOS, GCC, Release, RTX 4090), head built with tests:
tests/execution/NativeMultisampleDepth.cpp(CheckEligibility): partial fill then a target with its HTILE elsewhere keeps the refusal; partial fill then a 1 sample target over the same HTILE ends the older surface, the bind succeeds, and the older target bound again is sampled.ctest -R '^agc_driver_(native_multisample_depth|graphics)$'on the GPU: "100% tests passed out of 2".endSurfacesUnderReusedHtileremoved,agc_driver_native_multisample_depthfails with "a native depth surface outlived a different target bound over its partly filled HTILE".Not tested: PPSA25009 on this head, Windows, and a PPSA21564 paired run.
Checklist
main; no other open PR implements the same functionsNotImplemented_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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T18:14:23Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at head
95301669090f21c6a41510b66abc109906518f0ehave no verified blocking defects, and the inspected evidence supports merging.What I ran
Inspected the prepared diff and relevant source ranges with
repo_read.py; no tests or builds were run.Files reviewed:
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp,core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp(changed test hunk and surrounding context), anddocs/dev/debt/changes/agc-retire-depth-on-htile-reuse.md.files.jsonlists no excluded files.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The author reports Linux GPU tests and a negative control in the PR description; they were not run in this review. Console behavior, Windows, and the paired PPSA21564 run were not verified. Unrelated portions of the changed source and test files were not read.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T18:59:38Z.
Review: COMMENTED
Actionable comments
core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp, lines3300· 📐 Maintainability & Code Quality · ⚖️ Poor tradeoffClearDepthSurfacesthroughclear(). That call erases the device&`#39`;s surface, owner, guard, and HTILE-mask entries (DepthSurface.cpp:5252-5276). The rebind check at lines 3301-3302 therefore cannot detect stale ownership or refusal left in those tables by retirement. The test would still pass in that case. The retirement check at line 3299 runs before the reset and still covers owner removal.reusedstill uses the same HTILE at that point. Choose a reset scope that preserves the retirement state until the check completes.4e581ed3-258e-4487-878a-649341fca961Reviewing files that changed from the base of the PR and between
fc294cbbb5and9530166909.core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cppdocs/dev/debt/changes/agc-retire-depth-on-htile-reuse.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T21:20:30Z.
Review: COMMENTED
Actionable comments
cc370353-e74f-45b7-a617-29b7d36b820aReviewing files that changed from the base of the PR and between
9530166909and241a9ce8e1.core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/changes/agc-retire-depth-on-htile-reuse.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T21:25:41Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at head
241a9ce8e15de92ef821f65679c1c5880ba1e294consistently retire an active depth surface when a different target reuses its partly filled HTILE; no verified blocking defects were found. Nothing blocks this; the points below are optional.What I ran
Read the prepared diff and pinned source with
repo_read.py(search,ls, and targetedcat); no tests or builds were run. The test file’s full text was excluded from the review folder for size, so I read its changed hunk and relevant surrounding code through the reader.Files read:
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp,core/libs/prx/libSceAgcDriver/tests/execution/NativeMultisampleDepth.cpp, anddocs/dev/debt/changes/agc-retire-depth-on-htile-reuse.md.files.jsonlists no excluded files.Results
Negative control
Not run by this reviewer. The PR description reports that removing the new retirement call makes
agc_driver_native_multisample_depthfail; I did not independently verify that result.Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
PPSA25009 on this head, Windows behavior, and the paired PPSA21564 run were not verified. The reported Linux GPU test runs and negative control are author-reported, not run by this reviewer.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T06:34:36Z.
Review: COMMENTED
Ran
agc_driver_native_multisample_depthandagc_driver_graphicson main35e34b1a7fand this PR with Mesa lavapipe 25.0.7 on Linux. Both passed in both runs. The added cases kept the refusal for disjoint HTILE and exercised retirement and rebinding when the new target reused HTILE. Both logs show Khronos validation 1.4.369 being inserted, with no missing-layer lines orVUID-errors.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T07:12:02Z.
Review: APPROVED
I read the diff at
241a9ce8e1. Windows 11, GCC 15.2, merged intomainatcde48b5800etogether with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_native_multisample_depth_tests(one skips on both): pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.main's):agc_driver_native_multisample_depthfails on both GPUs: "a GPU buffer write over the depth or HTILE released the unwritten surface", for every format and sample count. The others pass.Not checked: a title.
AI-assisted: yes (Claude Code)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.