fix(videoout): report GPU driver shutdown failure from the present thread at Shutdown #1225
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1225"
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-07T18:23:00Z.
What
Part of #1040.
VideoOutDriver::presentLoopcalledAgcDriverShutdown_nid_postfix()outside its try block. When the driver had a stored worker failure,Driver::Shutdownrethrew it on the present thread and the process terminated. The failure is now stored inflipQueue->failure, soVideoOutDriver::Shutdownrethrows it after the join, as the lifetime test expects.video_out_flip_testsis now built withBUILD_TESTINGand thelifetime,decodeandcontrolsmodes are registered in ctest withSDL_VIDEODRIVER=offscreen.Not included: the
reopenmode. ThereFailsets the queue-wide failure while the present loop runs and the loop terminates the process (0d29a0a3). Should a flip on a closed port still kill the process, or stay a per-port failure as the test expects? The other six modes need aparam.jsonfixture.Tested
Linux, SDL offscreen, lavapipe:
video_out_flip_lifetime,video_out_flip_decodeandvideo_out_flip_controlspass. Without theVideoOutDriver.cppchangevideo_out_flip_lifetimeaborts.tools/check_conventions.py --base upstream/mainpasses. Not tested on Windows (availability of the offscreen SDL driver there is unverified).Checklist
main; no other open PR implemented the same functions when this was opened (#1575 was opened later and overlaps).mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T05:12:44Z.
Two things before this can go in:
video_out_flip_*tests exit with 0xc0000135 (DLL not found). The other tests incore/libs/prx/libSceVideoOut/CMakeLists.txtaddENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"underif(WIN32); these need the same.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-08T10:04:33Z.
Corrected. The first version of this comment was wrong. It said
lifetimestill terminates on Windows with this PR, and blamed the unwind between the two prx modules. My build had stopped beforelibSceVideoOut.prxwas relinked: I had pipedcmake --buildinto a command that stops reading early, so those runs and the gdb sessions usedmain's driver. Clean results:Tested on Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 3060 Laptop (driver 616.92), merged onto
main73ac9ef7:ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"underif(WIN32), as the other tests in thisCMakeLists.txtdo. With that, all three pass in each of 3 rounds.SDL_VIDEODRIVER=offscreen:lifetimepasses 6 of 6 with this change.main'sVideoOutDriver.cpp,lifetimeterminates 3 of 3 withVideoOut: port is closed.decodeandcontrolspass 3 of 3, so the offscreen driver works on Windows.Driver::runalso catches theport is closedthrow fromFlipRequest::GpuReadyon the queue worker; I traced the unwinder's search phase. What terminated onmainis the shutdown rethrow this PR catches, as #1040 describes for Linux.Tested with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-08T13:49:58Z.
Thanks for the review, and to @popcoder565 for testing on Windows.
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"underif(WIN32)for the threevideo_out_flip_*tests (2f6c0998). On Linux the three tests still pass.presentLoopchange and test registration, so the overlap bot flags both. I leave it to the maintainers which one to keep; I will adjust this one if they prefer the other.reopenmode)? Not included here.Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-08T14:10:28Z.
Windows data for the closed-port question, from a real title. ps5-doom (lowbit/ps5-doom v1.1.0, PPSA99666, GPL homebrew) ends a
-timedemorun throughI_Error→sceSystemServiceLoadExec("exit", NULL), and the process then terminates on the present thread:Exit code 0xc0000409, on
main3c0756eeand with this PR merged into63c57d22(2/2 runs each), so as the description says this path isn't covered here. The same title leaving through the sameLoadExec("exit")with code 0, when ps5-doom's frame limit ends a run, did not hit it in 6 runs.Repro: relink ps5-doom's
eboot.bin, then rundoom.exe -timedemo demo2from the app layout. Windows 11, Radeon 860M, MinGW-w64 GCC 15.2.0, Release.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-08T15:33:34Z.
Thanks @LeandroLP23 for the ps5-doom data. That exit path is a closed port with a flip still queued, not the shutdown rethrow this PR fixes, and handling it widens the scope here, so it is in a separate PR: #1648. It cancels flips on a port the title closed instead of terminating, and builds on this one. It is untested with ps5-doom itself; if you can run
-timedemowith #1648 merged on top of this, that would confirm it.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T20:39:48Z.
I checked the failed run for head
2f6c0998(run 37787482615). Both Linux and Windows stop atCheck that every test executable is registered with ctest; the C++ build and tests are skipped. The failure is that this PR registersvideo_out_flip_testsbut leaves it intools/check_test_registration.py'sKNOWN_UNRUNset (error: video_out_flip_tests is run by ctest now; remove it from KNOWN_UNRUN). PR #1575 already includes that removal, so please coordinate the overlap and ensure the selected PR carries it, then rerun CI.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T01:06:37Z.
Thanks @MarcZX100 for tracing the CI failure. Fixed in 3a641844:
video_out_flip_testsis removed fromKNOWN_UNRUNintools/check_test_registration.py, and the branch is merged with currentmain.tools/check_conventions.py --base upstream/mainpasses locally; CI is re-running.On the overlap with #1575: this PR was opened first (2026-10-07) and now carries the same registration fix, so I leave the choice to the maintainers. I will adjust this one if they prefer #1575.
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T08:34:46Z.
Update to my Windows results:
mainnow includes #1367, which breaks the offscreen ctest entries on Windows.#1367 creates the VideoOut window with
SDL_WINDOW_VULKANon the first VideoOut call. SDL's offscreen driver can't create a Vulkan window on Windows, so the tests that open a port now stop at:Setup: Windows 10 (19045), RTX 3060 Laptop (616.92), GCC 15.2.0 (WinLibs r7), Release. I tested #1648, which carries this PR's commits, merged onto
main6cc0503d. I also merged #2093, becausemaindoesn't build without it at the moment.lifetimereopendecodecontrolsSDL_VIDEODRIVER=offscreen)So the driver changes in this PR and #1648 work on Windows; only the offscreen registration fails since #1367. My earlier offscreen passes were on
73ac9ef7, before #1367 merged. #1575 registers the same tests withSDL_VIDEODRIVER=offscreen, so it's affected the same way.How to handle it is your call. The AGC device tests return 77 (skipped) when they can't get a device. Dropping the offscreen driver on Windows works on a desktop, but the Windows CI runner has no Vulkan device.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:21:55Z.
Please rebase onto main and force-push instead of merging main in (eb899d052). Since #1367 the tests this registers with
SDL_VIDEODRIVER=offscreenfail on Windows (popcoder565's results above); they need to pass there, or skip when no Vulkan window can be made, the way the AGC device tests skip without a device.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T11:51:02Z.
For the Windows offscreen failure, current
mainalready has a matching pattern inGuestVideoOutWqhdDetection.cpp/libSceVideoOut/CMakeLists.txt: catch the Vulkan/display initialization failure, print a skip reason, return 77, and setSKIP_RETURN_CODE 77on the CTest. That preserves the Linux offscreen coverage and marks the Windows no-Vulkan case as skipped instead of failed. The new flip modes that do not open a Vulkan window can remain runnable on Windows.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T11:58:11Z.
Rebased onto main and force-pushed, no merge commit (
2663699d). The tests that open a port now exit 77 (skipped) when no Vulkan window can be created, as the AGC device tests do, andFlip.cppwritesapp0/sce_sys/param.json, whichAppMetadatanow requires. Thanks @popcoder565 and @MarcZX100 for the Windows data and the pattern.Imported from boykopovar/AnyPS5. Originally posted by Pedroj-64 on 2026-10-09T14:58:45Z.
Lowered the
video_out_flip_*CTest timeout from 60 to 30 s to followCONTRIBUTING.md(59c98bde). On Linux without a Vulkan windowdecodetakes 0.01 s and the other modes skip with 77; real-window durations are pending, see the discussion on #1648.Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-09T15:56:05Z.
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:30Z.
Thanks @krishalivaibhav for the Apple M2 validation: it confirms that
lifetimeaborts without the change and passes with it, and thatcontrolsand presentation still work. Thanks also to @popcoder565, @rmz-24 and @MarcZX100 for the Windows data and the reviews; I have no pending changes on this PR.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:10:15Z.
Checked: build + full ctest on current main merged (551/551).
video_out_flip_decodepasses;lifetimeandcontrolsskip with 77 here (no Vulkan window with SDL offscreen since #1367), and the fix is confirmed by @krishalivaibhav on Apple M2 (lifetime aborts without it, passes with it). Thecatch (...)stores intoflipQueue->failureandShutdownrethrows it, so nothing is swallowed. Note that CI will skiplifetime/controlstoo for the same reason, so only a real window covers the fix. Merging once CI is green.