feat(videoout): present reserved flips from tagged GPU completion #5539
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5539"
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-10-13T23:10:16Z.
What
Reserve an EOP flip and return an opaque DWORD token; a matching live reservation in a graphics-queue RELEASE_MEM packet drives presentation. Preserve label writes and normal queue events. Closing cancels unsubmitted reservations; tokens are unique across port generations.
The packet matcher now requires type 3, exactly eight words and a complete body before reading INT_SEL or INT_CTXID. Ordinary context IDs, including consumed/cancelled token values, remain ordinary label writes. A pre-scan avoids taking the driver mutex when no flip candidate is present. EOP label preparation/execution holds the device-replacement shared lock, then releases it before presentation as required by the existing flip path. Repeated live tokens within one submission are still rejected.
Also handle the trace-user-data WRITE_DATA emitted before this flip by updating UCONFIG state. Thread-trace capture and async-queue EOP flips remain unsupported.
The five-argument ABI and DWORD token use are inferred from Astro Bot PPSA21564's bundled AGC driver and the earlier isolated original-routine ABI probe. No title stop on current main, standalone application startup or measured console token encoding/copy width/capacity/error policy is established. These limits remain documented in technical debt.
Tested
Standalone head
09f73c4af643a32834d340adbba2759657d6b0abincludes upstream maina5f493f90dca348a65561aed4bb325a629d1b668. The bundled Linux Release library/test build passes. Direct X11eop,eop_mainandeop_aftergpupass on both AMD Radeon RX 6650 XT/RADV Mesa 26.2.4 and lavapipe Mesa 26.2.4, without skips. Coverage includes a type-2 filler carrying RELEASE_MEM opcode bits, malformed lengths, live-token duplicates, ordinary label writes with consumed/cancelled context IDs, close/reopen generations, capacity/concurrent callers and GPU work before presentation.Restoring only the former numeric token-range refusal makes the updated regression fail with
EOP flip token is no longer reserved. Restoring the source byte for byte, rebuilding and rerunning passes. The default offscreen CTest invocation skips all three display cases; those skips are not validation.Current conventions and whitespace checks pass. Fresh full Linux/Windows CI passes for this published head; expected skips remain unvalidated. Earlier CI and original-routine probe results refer to their prior revisions; no current Windows, full-suite, game-performance or console validation is claimed.
Checklist
Verified current full CI: run 38505683103 passes topic
09f73c4af643a32834d340adbba2759657d6b0abmerged into basea5f493f90dca348a65561aed4bb325a629d1b668. Linux 1059 passed/49 expected skips; Windows 730 passed/400 expected skips. Skipped cases remain unvalidated. The tested source tree matches this published topic head.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T23:10:58Z.
Progress report (
9a3e2ac→8c0c449)📈 System libraries: 88.34% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceVideoOutSubmitEopFlipImported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-13T23:44:37Z.
Resolved the reported overlaps in published head
e31b3f182308caaa5038d15b856679db91ddedce, which includes current maind1670009fbf. Fresh local merge-tree checks merge this branch without conflicts with #4863, #5239 and #5466. The PR body describes the edits; these are independent features, soDepends on: noneremains correct.Conventions and whitespace checks pass. The EOP validation/test registration was kept independent of the flip-master edits. The three native Radeon EOP cases pass on the matching combined integration. Fresh full Linux/Windows CI passes on Linux and Windows for this published head; expected skips remain unvalidated.
The overlap workflow runs on main pushes and hourly, rather than PR pushes, so its earlier comment may remain until the next sweep.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-14T00:56:06Z.
Review: COMMENTED
Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement;
Unblocks: noneis allowed. The technical points below are unaffected.Thorough tests. A few problems in the packet matching, which runs on every queue-0 submission of every title, not only on titles that call
sceVideoOutSubmitEopFlip:1. The match doesn't check the packet type or size before reading
words[2]andwords[7]. InholdFlipBehindWorkerandreserveOutputs, the test is((words[0] >> 8) & 0xff) == 0x49 && ((words[2] >> 24) & 7) == 2. A type-2 filler (header >> 30 == 2, one dword perPacketWords), or any non-type-3 header whose bits 15:8 happen to be0x49, matches the opcode test. The code then reads up to 7 dwords past it, which can run past the end of the command buffer. Please require(words[0] >> 30) == 3andcursor + 8 <= commands.size()(orPacketWords(words[0]) == 8) before looking at the body.2.
int_ctxidbelongs to the guest, so the token range can collide with ordinaryRELEASE_MEMs. AnyRELEASE_MEMwithINT_SEL == 2whose context id falls in[EopFlipTokenBase, nextEopToken)and isn't a live reservation throws "EOP flip token is no longer reserved". Titles put their own values inint_ctxid, and nothing stops one from using0x04xxxxxx. A title that never callssceVideoOutSubmitEopFlipwould only be affected after another caller had advancednextEopToken, but the range check makes a guest value fatal. Tracking the token only where the guest stored it, or keying the match on tokens actually returned and not on the numeric range, would avoid failing on guest data the host never handed out.3. The driver mutex is now held across the whole command scan.
holdFlipBehindWorkerused to scan without the lock and lock only when a flip was found. It now takesmutexbefore scanning, on every queue-0 submission from a guest thread, to readeopFlips.mutexis the driver's main lock, so this adds contention for every title. A cheap pre-scan without the lock (any type-3RELEASE_MEMwithINT_SEL == 2at all), taking the lock only when one is found, keepsmain's cost for everyone else.4. Device lock. EOP-flip
RELEASE_MEMs now skipdeviceUse.lock()like the flip packet. Unlike the flip packet, they still go throughpreparePacketMemory, which can record the label write on the GPU (wroteOnGpu) through the device. Is that safe against device replacement without the shareddeviceReplacementlock? If the flip part needs the lock released, the label part probably still needs it held.Also, as far as I can tell,
Unblocks: noneand "this standalone change did not establish application startup" mean no title reaches this export onmainyet. Per the recent export reviews, the maintainers may ask for that log line first.Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T03:20:22Z.
Addressed all four packet concerns in
09f73c4af6: type/length/body checks precede reads, only live tokens select flips (consumed/cancelled IDs remain ordinary label writes), a cheap pre-scan keeps the driver mutex off submissions without flip candidates, and label preparation/execution holds the shared device-replacement lock before releasing it for presentation. Updated main/overlay/GPU-work tests pass on RX 6650 XT/RADV and lavapipe without skips. Restoring the former numeric-range refusal makes the new ordinary-context regression fail; exact restoration passes. Full Linux/Windows CI is pending.The description still says Unblocks: none: the bundled-driver ABI probe is not evidence of a title stop on current main. No new title claim has been added.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T11:56:39Z.
Checked the type/length/body checks before
words[2]/words[7], live-token-only matching, the pre-scan before taking the driver mutex, and the label/device lock. The WRITE_DATA thread-trace register path is bounded to 0xc340..0xc347 and covered inPm4.cpp. Build and the Pm4/Flip ctests pass here;video_out_flip_eop,eop_mainandeop_aftergpuskip under the offscreen driver, so I ran them directly on a Wayland display and all three pass. Merging once the full Build is green.Non-blocking: removing the type-3/size check in
EopReleasedoes not fail any test, because the type-2 filler case has no live token atwords[7]; a case with a live token at the misaligned position would pin it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T12:33:31Z.
Rebased onto current main (conflicts in the debt notes, the include list of
Presentation.cppand the anonymous-namespace helpers ofSubmission.cpp), kept as one commit with your authorship; the logic is unchanged. Build and ctest pass here exceptagc_driver_tessellation, which this PR does not touch. Merging once the full Build is green.Non-blocking: removing the type-3/size check in
EopReleasedoes not fail any test, because the type-2 filler case has no live token atwords[7]; a case with a live token at the misaligned position would pin it.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T12:37:50Z.
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.
main)core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cppL97