Repository navigation
fix(libSceVideoOut): wait for flip room instead of failing at capacity - #18303
Conversation
Submit 180 flips while presenting at 20 fps and require all of them to complete. On main the queue backs up and flip 24 returns VIDEO_OUT_ERROR_FLIP_QUEUE_FULL (0x80290012). With the two-pending limit candidate the same run completes. Reproduces boykopovar#16478 without the showcase. (cherry picked from commit 3decc1d)
A title that submits one flip per vblank without pacing on flipPendingNum can outrun a presenter that is slower than the vblank. The backlog then reaches VIDEO_OUT_FLIP_QUEUE_CAPACITY and sceVideoOutSubmitFlip returns VIDEO_OUT_ERROR_FLIP_QUEUE_FULL, which titles treat as fatal (boykopovar#16478). Wait in SubmitFlip for the same room the AGC path already waits for: the existing 60 s FLIP_ROOM_WAIT_MICROS, with a presenter failure rethrown, shutdown throwing ProcessShutdown, and a timeout returning FLIP_QUEUE_FULL. Co-authored-by: Ethan Hainline <hainline.ethan@gmail.com>
|
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.
|
68f3e38 to
1ab0007
Compare
|
Windows check of head Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release build.
AI-assisted: yes. |
|
An on-screen run on Linux with NVIDIA, since under plain On head 1ab0007 all 29 flip tests pass, including the new AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the flip-room wait — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
- Head
1ab00074f414fddc427a46ef2be93477dfe7dea9, basemain. - Read
description.md,commits.md,manifest.json,files.jsonanddiff.patch. - Files read: all 3 changed files (
src/VideoOutDriver.cpp,tests/Flip.cpp,CMakeLists.txt), changed hunks in full, plus the head source around the changed code through the reader. Excluded by rule: none. - Head source read through
repo_read.py:src/VideoOutDriver.cpplines 190–280, 360–500, 712–730 and 840–862, and searches for the names the change touches. - No build and no test run in this pass.
repo_read.py search "flipQueue" core/libs/prx/libSceVideoOut/src
repo_read.py search "reservations" core/libs/prx/libSceVideoOut
repo_read.py search "WaitForFlipRoom" core
repo_read.py search "FLIP_QUEUE_FULL" core/libs/prx/libSceVideoOut
repo_read.py cat core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp 190 280Results
| Check | Result | Note |
|---|---|---|
| Diff read, all changed files | passed | Changed hunks |
| Wait matches the AGC path | passed | Same predicate and 60 s deadline |
| Test wiring (CMake, dispatch) | passed | By reading |
| Build | not run | No build in this pass |
| Test runs | not run | Author-reported only |
Commands
repo_read.py search "flipQueue" core/libs/prx/libSceVideoOut/src
repo_read.py search "reservations" core/libs/prx/libSceVideoOut
repo_read.py search "WaitForFlipRoom" core
repo_read.py search "FLIP_QUEUE_FULL" core/libs/prx/libSceVideoOut
repo_read.py search "flipStatus.count" core/libs/prx/libSceVideoOut
repo_read.py cat core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp 190 280
repo_read.py cat core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp 360 500
repo_read.py cat core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp 712 730
repo_read.py cat core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp 840 862Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp:524— The new wait repeatsVideoOutput::WaitForFlipRoom(core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp:196, not in this diff) almost line for line. A shared helper that returns whether room appeared would keep the two paths from drifting apart. This is not a defect today.
Not verified
- The build and the Windows test runs. The author reports 3 of 3 passes for
video_out_flip_backlogand a failure onmainat flip 24. I did not reproduce either run, so the negative control is author-reported only. - Hosted CI for this head was not checked in this pass.
- Possible missed wakeup: the presenter's
changed.NotifyAll()(core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp:857, not changed) runs withoutflipQueue->mutex, so a completion could land between the predicate check atVideoOutDriver.cpp:525and the sleep.WaitForFlipRoomhas the same pattern. As far as I read, the next completion wakes the waiter, so this would cost latency, not a deadlock. Not confirmed at runtime. - Merge-order note (#12863,
PresentHold::Overlapped):PresentHolddoes not appear anywhere incore/at this head, so I could not check that note. CMakeLists.txtandtests/Flip.cpp: only the changed hunks were read, not the whole file. The helpers the new test uses (alignedBuffer, the buffer attribute call) match existing tests in the same file, but I did not read their full definitions.- "Fixes #16478" and the cherry-pick from
3decc1dd66: not checkable from the repository.
Sources
- New wait in
SubmitFlip:AnyPS5/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
Lines 520 to 531 in 1ab0007
- Existing AGC wait it mirrors:
AnyPS5/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
Lines 196 to 204 in 1ab0007
To get this to a good state
Nothing is required. The non-blocking point above is optional.
What
sceVideoOutSubmitFlipreturned0x80290012as soon asVIDEO_OUT_FLIP_QUEUE_CAPACITY(16) flips were pending, so a title that submits one flip per vblank without pacing onflipPendingNumfailed once the presenter fell behind the vblank (#16478).SubmitFlipnow waits for room the same way the AGC path already does throughVideoOutput::WaitForFlipRoom(): up to the existing 60 sFLIP_ROOM_WAIT_MICROS, rethrowing a presenter failure, throwingProcessShutdownon shutdown, and returningFLIP_QUEUE_FULLonly when the queue stays full.The regression test
video_out_flip_backlogsubmits 180 flips withANYPS5_FPS_LIMIT=20and requires all 180 presentations. It comes from Ethan Hainline'scandidate/flip-backlog-test(3decc1dd66), cherry-picked with-x.Note for merge order: #12863 (host pause) holds presentation while the flip queue fills. If it merges first, this wait needs the same
PresentHold::Overlappedescape thatWaitForFlipRoomhas, otherwisevideo_out_flip_host_pauseblocks on the 17th flip and times out at 30 s. Merged naively on top of #12863, that test times out andvideo_out_flip_backlogstill passes.Tested
Windows 11 IoT Enterprise LTSC 26100, Ryzen 5 5600, RX 6800 XT (RDNA2, subgroup 64), AMD 26.10.1, Vulkan 1.4.315, WinLibs GCC 15.2.
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.maind66e6aac01with the test only: fails atflip 24 returned -2144796654.video_out_flip_backlogpasses 3 of 3 runs (9.34, 9.48, 9.50 s).video_out_flip*andvideo_out_port0_presence: 30 of 30 pass (-j1).was not found but was requested by env var VK_INSTANCE_LAYERS, and both have zeroVUID-lines.Checklist
main; no other open PR implements the same functions (the overlap check reports feat(libSceVideoOut): opt-in host pause with a key or on focus loss #12863, feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021 and fix: define decoded AGC state and bound size arithmetic #10249 on these files; none touchesSubmitFlip)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)