fix(videoout): cancel flips on a port the title closed instead of failing the driver #1648
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1648"
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 Pedroj-64 on 2026-10-08T15:33:26Z.
What
Follow-up to #1225 (split out because it widens that PR's scope). Part of #1040.
Closing a port while a flip is queued or being presented made
checkConfigthrowVideoOut: port is closedon the present thread, which terminated the process. That is the ps5-doom-timedemoexit reported on #1225 (I_Error→sceSystemServiceLoadExec("exit")).A flip on a port the title closed is now cancelled: its pending counters and buffer reuse ticket are released and no failure is stored, so the driver and
Shutdownstay clean. Real failures and process shutdown still propagate.RenderingWaitno longer throws on a closed port for the same reason.Closed()andCheckAlive()split the oldCheck(), which is unchanged for title-facing calls.testLifetimenow expects cancellation (no failure, no pending flip, no stale counters on the reopened port, clean shutdown), and thereopenmode is registered in ctest.Tested
Linux, SDL offscreen, lavapipe:
video_out_flip_lifetime,_reopen,_decode,_controlspass. Without thesrc/includechangelifetimefails andreopenaborts.tools/check_conventions.py --base upstream/mainpasses. Not tested on Windows or with ps5-doom itself.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T15:39:21Z.
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/libSceVideoOut/src/VideoOutDriver.cppL215-225Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T11:49:14Z.
Review: COMMENTED
I reviewed the full diff and built the exact PR head
bed72585locally in Release. The four registered Linux tests (video_out_flip_lifetime,reopen,decode,controls) pass 4/4; conventions pass as well. One required follow-up before merge: this head is 225 commits behind currentmain(merge base4b005b22), and its declared prerequisite #1225 is still open. Please rebase the stack onto currentmainand rerun the exact-head checks, including Windows where these tests are registered. I will recheck the updated head then.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T11:50:12Z.
One additional Windows issue before the rebase: since #1367, SDL
offscreencannot create the Vulkan window used when these modes open a VideoOut port. The Windows report on #1225 tested a tree carrying this PR and sawlifetime,reopen, andcontrolsfail at window creation (0/10);decodepassed. Please adapt the Windows test registration/setup to skip cleanly when no Vulkan-capable window is available, while retaining the Linux offscreen coverage. The current all-platformSDL_VIDEODRIVER=offscreenentries will fail on the Windows CI runner.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T11:58:09Z.
Thanks @MarcZX100. The modes that open a port now exit 77 (skipped,
SKIP_RETURN_CODE 77) when no Vulkan window can be created, the same wayGuestVideoOutWqhdDetectiondoes, so Linux keeps the offscreen coverage. Rebased onto the updated #1225 (c8a06220).Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T12:02:01Z.
Windows results with a real Vulkan window, since under ctest the port-opening modes skip on Windows (
SDL_VIDEODRIVER=offscreen): Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. c8a06220 cherry-picked onto currentmaind70b8998(applies cleanly), full build pluslibs.VideoOutDriver.*frommainlifetimeVideoOut: port is closedreopenVideoOut: port is closeddecodecontrolsSo on an actual Windows desktop the fix does what it says, and the two modes it targets fail without it. Without a desktop session, the skip on Windows means CI only covers
decodethere.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:45:11Z.
One contribution-rule issue remains in the test registration inherited from #1225: all four
video_out_flip_*CTests useTIMEOUT 60, while currentCONTRIBUTING.mdrequires each test to finish within 30 seconds and says to split or shrink slow tests rather than raise the timeout. The reported Linux passes do not include durations. Please set a 30-second limit if each mode stays within it, or split/shrink whichever mode does not; then include exact-head durations in the test report.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T14:58:43Z.
Thanks @MarcZX100. The four
video_out_flip_*tests now useTIMEOUT 30(59c98bdeon #1225), and this PR is rebased onto it (a1efdab6, no merge commit).Durations on Linux with this head:
decode0.01 s; the three modes that open a port skip (exit 77) here because there is no Vulkan window, so I have no real-window durations. @rmz-24, if you can, could you addctest -R video_out_flip --output-on-failuretimings from your Windows desktop with the SDL default driver? I will shrink or split any mode that goes over 30 s.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:51:50Z.
Real-window timings from a Windows desktop, since they were still pending. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. This PR's head
a1efdab6(which includes #1225's59c98bde), merged ontomaind70b8998.Each mode was run directly from the test's working directory with SDL's default video driver, 3 times:
lifetimereopendecodecontrolsAll of them are far below the 30 s limit. Under ctest (
SDL_VIDEODRIVER=offscreen),decodepasses and the other three skip with 77, as described.🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-09T15:56:07Z.
Native Apple M2 validation confirms the shutdown behavior addressed by #1225 and the closed-port cancellation follow-up #1648.
Environment: Apple M2 / 16 GB, macOS 27.2 beta 3, Apple Clang 21 / SDK 27, bundled SDL compiled from source, MoltenVK 1.4.2. The local integration already included ARM64/macOS branch
11db79ae, placeholder-image #2015 (17713d1c), SPIR-V 1.3 #2191 (5463ea47), and visual-demo #2244 (1c71428f) on maind70b8998. These are combined-branch results, not either PR alone.VideoOut: port is closed(SIGABRT). Controls and presentation passed.59c98bde): lifetime passed its expected shutdown-error propagation contract; controls and presentation still passed. The integration conflict was resolved by retaining macOS main-thread input/window cleanup after the author's catch-and-store block.a1efdab6): lifetime passed clean cancellation assertions, and reopen, controls, presentation, back-to-back flips, and decode all passed. Cancellation checks include zero pending count, no stored failure, no successful count for a cancelled flip, and unchanged replacement-port counters.The existing
video_out_flip_testsmodes ran separately with 30-second timeouts, forced Apple M2 selection, required Vulkan/display initialization, and shader disk cache disabled. We used native Cocoa rather than SDL offscreen. The isolated working directory used the syntheticparam.jsonstructure from the existing WQHD fixture; an initial missing-metadata setup failure was corrected without changing production code.An independent subagent reran pending-close, reopen, controls and presentation successfully, and reviewed error preservation and the macOS conflict resolution. No new production fix was authored. No games, full suite, or visible-output checks were performed; presentation results establish flip state and pacing, not pixel correctness. AI-assisted validation using Codex.
Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T15:58:29Z.
Thanks @popcoder565 for the real-window timings on Windows (all under 1 s, far from the 30 s limit), @rmz-24 for the results on a real desktop, and @krishalivaibhav for the Apple M2 validation, which confirms the clean flip cancellation on a closed port.
@MarcZX100 thanks for the review. The current head is
a1efdab6, rebased onto #1225 (59c98bde) with no merge commit and withTIMEOUT 30. This PR still depends on #1225; if another rebase ontomainis needed when it updates, I will do it.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T15:59:25Z.
Check: head
a1efdab6already includes the currentmain(0 commits behind), so the rebase @MarcZX100 asked for is done. The remaining prerequisite is that #1225 gets merged.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:03:43Z.
Checked: build + scoped ctest on current main merged;
video_out_flip_decodepasses and the three port-opening modes skip under SDL offscreen (77) as designed. Run directly with a real window,lifetime,reopen,controlsanddecodepass; withsrc//include/from main,lifetimefails andreopenaborts. Also confirmed on Windows (@rmz-24, @popcoder565) and Apple M2 (@krishalivaibhav). Merging.Nit, not blocking:
FlipRequest::Cancel()is declared and defined but unused; worth dropping in a follow-up. Note #1655 touches the samequeue->changedlines, so whichever lands second needs a rebase.