fix(agc): prevent duplicate and unsolicited flip end-of-pipe interrupt deliveries #7008
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7008"
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 fogydes on 2026-10-17T04:16:00Z.
What
This PR resets the flip end-of-pipe interrupt delivery state (
eopInterruptDelivered = false) after each flip packet in AGC packet execution. When multiple AGC flips (FlipPacketHeader) are submitted in a single packet stream or across consecutive submissions without an intervening release packet interrupt, each flip now properly delivers its corresponding queue end-of-pipe event (sceAgcDriverAddEqEvent) rather than suppressing all flips after the first one. Also updates debt documentation.Tested
SubmitTests:testEndOfPipeInterrupts: verified multi-flip sequence delivers distinct end-of-pipe events for each flip.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T04:21:28Z.
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.
docs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppcore/libs/prx/libSceAgcDriver/tests/Submit.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/DispatchAhead.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/DispatchAhead.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppcore/libs/prx/libSceAgcDriver/tests/Submit.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/DispatchAhead.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/DispatchAhead.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketMemory.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Synchronization/DeferredLabels.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/DispatchAhead.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Packets/PacketExecution.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T04:24:29Z.
Review: COMMENTED
One correctness concern in the current diff:
eopInterruptDeliveredis initialized once before the packet loop and set totrueafter everyFlipPacketHeader, but it is never cleared.Submission.cpprecords each flip packet insubmission.flips, andexecuteprocesses each one in order, so a second ordinary flip in the same DCB will skip its syntheticAgcDriverDeliverEopInterrupteven if noRELEASE_MEMEOP was associated with that second flip. The pre-change path delivered one graphics EOP for each flip.Could the suppression state be consumed/reset for the matching flip, with a regression that submits two bare flips in one DCB and checks for two EOP notifications? I have not run this PR; this is based on the packet loop and submission parser.
Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-17T05:15:12Z.
Thanks for catching this @MarcZX100.
I've updated the PR (commit 9c9d801af):
eopInterruptDeliveredis now reset tofalsewhen flip presentation handling completes inPacketExecution.cpp, consuming the EOP suppression state for each flip boundary so subsequent flips in the same command buffer retain their interrupt delivery.core/libs/prx/libSceAgcDriver/tests/Submit.cpp: submits two bareFlipPacketHeaderpackets within a single DCB and asserts that both EOP interrupts are delivered (owner->GetTriggeredEvents(events.data(), 2) == 1 && events[0].data == 2).ctest --test-dir build-full -R "^agc_driver$" --repeat until-fail:10(all 10/10 passed) and passedtools/check_conventions.pywith 0 warnings.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T08:29:53Z.
I ran Death Stranding 2 (PPSA02015), which the description names for #6462, with and without both commits of this PR, on the local stack I used in #6462 (
mainstops earlier in that game). Both runs end the same way: SIGSEGV at 28.5 s without the PR and 29.5 s with it, the same null call fromeboot+0x1bd01b1, and an end-of-pipe event still reaches the game's event queue just before it.Logging the flip callers shows why: the game submits its flips with its own
sceAgcDcbSetFlip(video out handle 1, buffers 0 and 1), not throughsceVideoOutSubmitFlip. Those packets keepFlipPacketHeader, so the event this PR removes for VideoOut flips is not the one Death Stranding 2 receives, and #6462 is not fixed by it.The PR's tests pass on
mainplus the PR on an RTX 5080, a Radeon 610M (RADV) and lavapipe (agc_driver,agc_driver_flip*,agc_driver_pm4*), andagc_driverfails withmain's driver sources.Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-17T09:59:43Z.
Thank you for the thorough testing and trace details @fma-rc!
I've updated the PR description to remove Death Stranding 2 (#6462) from \Unblocks\ and kept only Gran Turismo 7 (#6350). Since Death Stranding 2 submits flips via its own \sceAgcDcbSetFlip\ rather than \sceVideoOutSubmitFlip, resolving #6462 is a separate investigation regarding how the console distinguishes per-flip vs release interrupts for AGC DCB flips.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:10:15Z.
Review: COMMENTED
Thanks for the update. I checked head
9c9d801af8d4eb42b66aad566b62b474e35c8072: the suppression state is now reset after the flip handling, andtestEndOfPipeInterruptsincludes two bare flips in one DCB and expects two interrupts. That resolves the concern in my earlier comment.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T12:20:49Z.
Thanks for correcting the
Unblocksclaim and separating the AGC DCB flip behavior from the VideoOut path. That matches the trace report: this PR's change does not resolve #6462, while the GT7 coverage remains relevant. I checked the current head and live checks; I’m treating any named title behavior outside those tested paths as unverified.Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-17T20:13:09Z.
Real-window VideoOut flip results, plus an overlap with #6616 worth noting.
Windows 11 10.0.26200.9711, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. Head 9c9d801af merged onto main
f3263dfbf(clean merge, no new build errors). All 20video_out_flip_testscases run directly with a real window (CI skips them: offscreen SDL has no Vulkan surface), one run each:eop,eop_maineop_aftergpuunavailableaftergputiming is unchanged (GPU work landed 171.6 ms, flip completed 171.7 ms), so flips still wait for the work ahead of them.The EOP cases pass because this PR's line 176 change in
PacketExecution.cppadds!submission.flips.contains(cursor)to the pipelined label shortcut, which is the same guard as #6616 (the fix for EOP flips being dropped when draws are pipelined). The PR body doesn't mention that, and the overlap bot only lists it as a line-176 conflict. So whichever of #6616 / #7008 merges first carries that fix, and the other only needs its remaining changes rebased.Not checked: GT7 or any title, and the per-flip
eopInterruptDeliveredchange on its own.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T15:08:23Z.
Review: APPROVED
Reviewed the current head and my earlier multi-flip concern. The suppression state is reset after each flip, and the added regression submits two bare flips in one DCB and expects two notifications. The VideoOut-specific packet header is also handled in the parser, validation, reservation, and execution paths I inspected. Hosted eligibility, conventions, and report checks pass; platform matrix jobs were skipped by path filters. I reviewed the diff and reported test evidence but did not run the GPU/title tests locally.
Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-19T08:35:40Z.
Rebased onto latest origin/main (
415cd49fd3):Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T12:48:15Z.
Closing as superseded by merged work; you're welcome to reopen with the points below addressed.
mainby #7137, which latches per queue and was measured on Gran Turismo 7 (231 deliveries, none from the flip site, no fault). This PR has no run on that title, and the only title run in the thread (Death Stranding 2, by @fma-rc) shows it does not fix #6462.!submission.flips.contains(cursor)guard that makes theeop*cases pass in @cadenasynyster's run landed with #6616.VideoOutFlipPacketHeaderthat never raises the flip event, plus a per-submission flag stacked on top of #7137's latch. Nothing measured shows the console behaves this way, and the new debt text states it as fact.Pm4.cppnow accepts custom packet 0x1b ("VIDEO_OUT_FLIP") from guest command buffers, where it previously threw. An internal encoding should not be reachable from a guest stream.If you still want the VideoOut split, please open it as its own PR on current
mainwith a test that fails without it, a title or hardware measurement showing the flip event must not be raised forsceVideoOutSubmitFlip, and the internal header kept out of guest validation.Pull request closed