feat(libSceVideoOut): opt-in host pause with a key or on focus loss #12863
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12863"
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 MarcZX10 on 2026-10-29T13:05:49Z.
What
Opt-in host-side pause of the display:
ANYPS5_PAUSE_KEY=<SDL key name>toggles it with a key in the display window,ANYPS5_PAUSE_ON_FOCUS_LOSS=1pauses while the display window has lost focus or is minimized. Both unset (the default) creates nothing and changes nothing. An empty or invalid value stops the title at its first video-out use with an error naming the variable.What a pause does: the presenter stops taking flips off the queue (it keeps polling window events every 10 ms), so the queue fills as it does for a slow display (
sceVideoOutSubmitFlipanswers the queue-full error, the GPU waits for room), and libSceAudioOut queues silence for every non-vibrationsceAudioOutOutputport and zeroes the AudioOut2 main mix in its device callback. Nothing blocks a guest synchronization primitive and no guest thread is suspended.WaitForFlipRoomthrows after 60 s of a full queue, which would abort a title paused for a minute, so a timeout that a hold overlapped (active, or begun and ended inside the wait) starts a new wait; a queue that stays full without a hold still throws.What it does not do, recorded as technical debt in the commits
docs(debt): ...: the title's clocks are not held (a title's ownrdtsc, and on LinuxsceKernelClockGettime, cannot be offset, as forAPS5_TIME_SCALE), the title's other threads and vblank events keep running, flips queued during the pause present back to back on resume, the controller speaker and haptics and the microphone are not silenced, no system suspend/resume event is sent (no measured console behaviour exists in the tree, so none is invented), and the focus rule follows SDL window events that were only injected, not observed on a real window system.Phase 1: upstream/main had nothing for this.
sceSystemServiceReceiveEventreturns the no-event error, window focus is used only to release the mouse capture (MouseInput, KeyboardInput, KeyboardMouse), the minimized state only zeroes the drawable size, and theAPS5_SYNC_FLIP,APS5_STALL_WATCHDOG_SECSand WAIT_REG_MEM timeout paths were read for interactions (the watchdog and the GPU-wait timeout log can fire during a long pause; documented).Commits (27): settings parser and test; HostPause state (key), test; focus rule, test; PresentHold and test; libSceAudioOut flag and test; silence on the main port and its test; silence in the AudioOut2 device callback; flip-room wait excused during a hold; presenter honours the hold; wiring in the presenter; integration test through the real driver; docs (ENVIRONMENT.md, USAGE.md, six debt entries).
Overlaps with open PRs (nothing stacked, no code reused): #12569 (host volume and mute: same two audio hook sites in
AudioOut.cppandAudioOut2Context.cpp,libSceVideoOut/CMakeLists.txtlink line,libSceAudioOut/CMakeLists.txt,ENVIRONMENT.md,USAGE.md; whichever lands second needs a trivial rebase and the two gates compose, silence wins), #12536 (FPS limit:VideoOutDriver.cpp,libSceVideoOut/CMakeLists.txt), #12379 (overlay dialogs:VideoOutDriver.cpp, an overlay flip is held too), #12702 (controller status overlay: VideoOut and docs), #12285 (SystemService debt doc; the suspend dialog flag there is unrelated to this pause).Tested
Linux x86_64, GCC 12, Xvfb (llvmpipe). Head
e37f4ade1b, rebased ontoupstream/main(6ed10ccd1f). Earlier results were onmain5454cd2e45and on the pre-rebase headf2b9fc35e7.core/libs/prx/libSceAudioOut/CMakeLists.txt(main addedinvalid_sample_rateto the buffer-size mode list; both kept).core/libs/prx/libSceVideoOut/CMakeLists.txtandtests/Flip.cppapplied without conflict. The rebase had dropped main's three trailing lines oftestFrameLimit(sceVideoOutUnregisterBuffers,sceVideoOutClose,LibcRunShutdown_nid_postfix); restored in commite37f4ade1b.git diff upstream/main...HEAD --stat: 22 files, 694 insertions, 14 deletions.ctestafter targetsvideo_out_flip_tests video_out_host_pause_tests audio_out_host_pause_tests audio_out_buffer_size_tests): BUILD-EXIT 0, 6 tests:audio_out_host_pause: Passedaudio_out_buffer_size_invalid_sample_rate: Passedaudio_out_buffer_size_paused: Passedvideo_out_host_pause: Passedvideo_out_flip_fps_limit: SKIPPED (exit 77). The test returns 77 when its display setup fails with a Vulkan/display error andANYPS5_REQUIRE_DISPLAYis unset. The ctest run had noDISPLAY. Run by hand underxvfb-run -ait exits 0 and printsVideoOut flip tests passed, but that is a manual run, not a ctest result.video_out_flip_host_pause: SKIPPED (same cause; underxvfb-run -ait exits 0, manual run only).VERIFY-FAILED(SDL headers missing in the verification archive). Not a compile failure of the build itself; the build exit is 0.check_conventions.py --base upstream/mainandgit diff --checkclean.Not run on this head: Windows, macOS, Wayland, a real window system or audio device, a console, a title, the 60 s flip-room case, the
video_out_flip_*tests with a display (only manual Xvfb runs above). Earlier head results (main85 tests / branch 89 tests, 0 failed, under Xvfb, before the rebase) are not repeated for this head.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 CnRJay on 2026-11-01T19:51:05Z.
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.The main-versus-change test comparison is in order. What is missing is the behaviour on a real title.
APS5_STALL_WATCHDOG_SECSduring a pause.Unblocks: none. The callback change and the 60 s path are the risky parts, and they are the untested ones.sceVideoOutSubmitFlipreturns that error to the guest. Titles treat it differently (spin, sleep, retry per frame, abort). One that spins burns a core for the whole pause; one that aborts dies. Please show one named title surviving a pause of a minute or more, or block inside the submit as a full console queue would.WaitForFlipRoom. It throws after 60 s of a full queue and the patch restarts the wait when a hold overlapped it. The one test for this is, in the author's words, "reasoned, not run" because it exceeds the 30 s test limit, and the mutation that removes the excuse was not caught. Please inject a shorter timeout so the path can be exercised, and ask what happens with a 59 s pause followed by a real 2 s stall.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:58:13Z.
Review: COMMENTED
Reviewed — merge request and four review points open; Windows CI failed
The branch conflicts with current main in two files, and the Windows check at this head failed on five pad tests this PR does not touch.
What I ran
Live head: 36105a4d6c636797abf74ec6c00da92b44536a6b (OPEN, same as the batch file). Read comments and reviews with
gh api. Read files withgit -C /marc/AnyPS5 show 36105a4d…:<path>. Rangit merge-tree --write-treeagainst the localupstream/main(926f7dd). Read the Windows job log viagh api(job 124718496739). Nothing was built or run.Results
Findings
SubmitFlipreturns VIDEO_OUT_ERROR_FLIP_QUEUE_FULL when reservations are full (VideoOutDriver.cpp L484). The debt entry (libSceVideoOut.md L53) says a loop waiting on flips stops once the queue is full. How real titles react was not checked.WaitForFlipRoom(L162-L175) restarts while a hold overlapped the wait (L172-L173). The PR body says it was not run.AudioOutSilenceFloatsWhilePaused(AudioOut2Context.cpp L273) makes one out-of-line call per buffer, which does an acquire load (HostPause.cpp L14-L18), not a relaxed one.Sources
github.com/boykopovar/AnyPS5@36105a4d6c/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp (L162-L175)github.com/boykopovar/AnyPS5@36105a4d6c/core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp (L273-L273)github.com/boykopovar/AnyPS5@36105a4d6c/core/libs/prx/libSceAudioOut/src/HostPause.cpp (L14-L18)Not verified
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T14:33:21Z.
Review: DISMISSED
Reviewed — changes requested
This pull request does not merge cleanly into
main(4f41f4c375): head 36105a4d6c636797abf74ec6c00da92b44536a6b conflicts incore/libs/prx/libSceVideoOut/CMakeLists.txtcore/libs/prx/libSceVideoOut/tests/Flip.cppPlease rebase it onto current
main. I will review the change once it merges cleanly.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T20:36:33Z.
Review: COMMENTED
Actionable comments posted: 3
60ebda5b-c0f7-4d81-8292-4046c7421779Reviewing files that changed from the base of the PR and between
75981fd49band29b9fbcd20.core/libs/prx/libSceAudioOut/CMakeLists.txtcore/libs/prx/libSceAudioOut/include/HostPause.hppcore/libs/prx/libSceAudioOut/src/AudioOut.cppcore/libs/prx/libSceAudioOut/src/AudioOut2Context.cppcore/libs/prx/libSceAudioOut/src/HostPause.cppcore/libs/prx/libSceAudioOut/tests/AudioOutBufferSize.cppcore/libs/prx/libSceAudioOut/tests/HostPause.cppcore/libs/prx/libSceVideoOut/CMakeLists.txtcore/libs/prx/libSceVideoOut/include/HostPause.hppcore/libs/prx/libSceVideoOut/include/HostPauseSettings.hppcore/libs/prx/libSceVideoOut/include/PresentHold.hppcore/libs/prx/libSceVideoOut/include/VideoOutDriver.hppcore/libs/prx/libSceVideoOut/src/HostPause.cppcore/libs/prx/libSceVideoOut/src/HostPauseSettings.cppcore/libs/prx/libSceVideoOut/src/VideoOutDriver.cppcore/libs/prx/libSceVideoOut/tests/Flip.cppcore/libs/prx/libSceVideoOut/tests/HostPause.cppdocs/dev/ENVIRONMENT.mddocs/dev/debt/changes/feat-host-pause.mddocs/user/USAGE.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 ligmaSec on 2026-12-03T22:54:36Z.
Review: COMMENTED
The trial merge with
mainis clean. The added tests cover independent focus and key pause sources, repeated toggles, held presentation and audio silence. The remaining platform boundary is native focus/minimize event ordering and shutdown while presentation is still held. Please verify that sequence on the native backends named in the test report, since the current unit tests drive the state directly. I have no paired interactive result for this head.AI-assisted: yes.
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.