fix(agc): mark a resolve destination after releasing the source's import gate hold #26338
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26338"
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 JJenkx on 2026-11-23T18:24:24Z.
What
ResolveMultisampleTargetmarked the destination dirty while it still held the source'sDccPublicationand the targets lock. When a map-time import is announced, the source publication takes the source's import gate stripes shared. The destination's first pending transition (MarkDirty->markLayersPending) then opens a nestedPublishHoldon the destination's own address.PublishHoldrefuses a nested publication that needs a stripe below one its thread already holds, so with the destination in a lower stripe than the source the resolve threw:Stripes are
address >> 21modulo 256, so whether this fires depends only on where the two surfaces sit and on whether an import is announced at that moment.The source publication and the targets lock now end in a block before
destination.MarkDirty(), so the destination publishes in its own non-nested hold. The rest of the function, including the destruction ofaveragedandframebufferunder the targets lock, is unchanged. The source hold never covered the destination's stripes, so the destination's transition had no protection from it that it loses here;markLayersPendingtakes its own hold as it does for every other caller.agc_driver_msaa_resolve_publication_order(inagc_driver_alpha_to_coverage_tests) allocates a 4-sample DCC source and a resolve destination until the destination has a stripe below the source's highest one and outside the source's stripes. It draws the source, holds aMapImportGate::ImportHoldon a free stripe from another thread so publications go striped, and runs one CB resolve under the GPU lock. It requires the resolve to finish while the import is still held and at least two striped publications to be counted, so it cannot pass without going through the striped path.Why: a Windows run of Snoopy and the Great Mystery Club (PPSA28795, discussion #7382) on
main2ef49858bbaborted at 33 s with the message above ([videoout] presentation failed, thenterminate). It happened in 1 of 7 runs; 2 repeats and 4 runs under gdb (catching C++ throws) did not hit it again, so the game's stack was not captured. This is the nested publication on a different address that I found in the driver; I have not shown that Snoopy took this exact path, and the PR does not claim the title is fixed. The game has native multisample targets (see #18288).Related: #25911 rewrites the body of the same function and keeps
MarkDirtyinside the publication; whichever lands second needs a small rebase. #26273 changes a different lock order (host imports vs the pending mutex).Tested
Windows 11 Enterprise 22621, Ryzen 9 5950X, Radeon RX 6700 XT (AMD driver 26.11.2), WinLibs GCC 15.2 UCRT r7, Release, Ninja. Built on
ec96e53dfbf; the branch was then rebased ontobcc7c4de8c4, which changes nothing undercore/libs/prx/libSceAgcDriver.agc_driver_alpha_to_coverage_tests,agc_driver_graphics_testsandagc_driver_msaa_layout_testsmatched byagc_driver_msaa_|alpha_to_coverage(26 tests), 3 runs: 26/26 each run. The 3agc_driver_msaa_dcc_compared_import_*tests skip on Windows by design (#ifndef _WIN32). The new test printed in every run:multisample resolve: source stripes 1-2, destination from stripe 0, import on stripe 3, 3 striped publications.MultisampleTarget.cpprestored tomain(I checked that the stagedtests/libSceAgcDriver.prxwas rebuilt and matches the unpatched control driver), 3 runs:agc_driver_msaa_resolve_publication_orderfails every run with the message above;agc_driver_msaa_dcc_publish_gatepasses.tools/check_conventions.py --base origin/main: passed.VUID-and 0SYNC-HAZARD.agc_driver_msaa_enable_single_samplewas left out by that build's execution-test selection.mainc55872d43f. 25 of 25 onmainand 26 of 26 with this head, 2 runs each, with the validation layer requested. That comment states neither the layer revision nor skip counts. The new test prints "source stripes 1-2, destination from stripe 0, import on stripe 3, 3 striped publications".^agc_driver_msaa_(resolve_publication_order|dcc_unwatch|dcc_publish_gate)$passes 9 of 9 (3 runs). WithMultisampleTarget.cpprestored tomain,agc_driver_msaa_resolve_publication_orderfails all 3 runs. 0VUID-.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-11-25T10:08:49Z.
Review: APPROVED
Reviewed — looks good
The reviewed change is sound at head
e86e39e2c265ae07f9a676a0c9927303fa0c0de8; the scope change releases source publication and target locks before destination dirtying, and the supplied focused test reports passing on multiple configurations.What I ran
Read the prepared description, commits, manifest, diff, and the three changed files at the pinned head. No tests or repository commands were run; test results below are author- or reviewer-reported.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests, the Windows/Linux/NVIDIA/AMD runs and their controls, and physical-console behavior were not independently verified. No files were excluded by the manifest;
files.jsonwas not available through the reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T17:22:09Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
2f00c78e66c65463e4a4ee781efe4122c7b554e1. I did not run commands or tests; I inspected the prepared diff and relevant source throughrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The prepared
files.jsonwas not available through the reader, so I could not compare the files read with itsreviewedlist. The full text of all three changed files was also not available in the prepared review folder; I read the relevant changed lines through the pinned-head reader. I did not run the reported Windows or Linux test suites, a negative control, or console/game testing. Author-reported test results were not independently verified.To get this to a good state
Nothing is required.