video_out_flip_tests is not in ctest and its lifetime and reopen modes terminate on main #1040

Closed
opened 2026-10-07 03:05:51 +00:00 by NahuelGenchi · 3 comments
NahuelGenchi commented 2026-10-07 03:05:51 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-07T03:05:51Z.


video_out_flip_tests is built with EXCLUDE_FROM_ALL and never registered in ctest, and on main (ab9437e3) most of its modes fail. I ran every mode on Linux with SDL_VIDEODRIVER=offscreen and lavapipe:

(default)    terminate called after throwing an instance of 'std::runtime_error'  what(): VideoOut: port is closed
reopen       [videoout] presentation failed: VideoOut: port is closed, then terminate
decode       VideoOut flip tests passed
controls     VideoOut flip tests passed
present, backtoback, dcc, pacing, aftergpu, unavailable    param.json not found

The default lifetime mode gets through all of its checks up to the last one, which expects LibcRunShutdown_nid_postfix() to throw the asynchronous "closed" error back to the caller. What happens instead is that VideoOutDriver::Shutdown stops the present thread, presentLoop then calls AgcDriverShutdown_nid_postfix() outside its try block, Driver::Shutdown rethrows the stored worker failure on the present thread, and the process terminates:

#9  AgcDriver::DriverDetail::Driver::rethrowFailure() const
#10 AgcDriver::DriverDetail::Driver::Shutdown()
#11 VideoOutDriver::presentLoop(std::stop_token)

Catching that call in presentLoop and storing the error in flipQueue->failure, so VideoOutDriver::Shutdown rethrows it after the join, makes the default mode pass.

The reopen mode is different. There the output's Fail sets the queue-wide flipQueue->failure while the present loop is still running, and the loop's own catch calls std::terminate. That terminate came in with 0d29a0a3 ("terminate process on gpu and presentation thread failures"), which is newer than this test, so the test's expectation that a flip on a closed port only fails that port's waiters and is reported again at shutdown no longer matches the policy. It only shows up outside gdb; under gdb the timing changes and it passes.

The other six modes need a param.json in the working directory, so they'd need a fixture before they could run in ctest.

I didn't want to guess which side is intended. Should a flip that fails because its port was closed still kill the process, or should it stay a per-port failure as the test expects? Once that's settled I'm happy to send a PR that fixes the shutdown path, updates the test and registers the modes that can run headless (decode and controls already pass).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5738706942 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1040). Originally posted by [NahuelGenchi](https://github.com/NahuelGenchi) on 2026-10-07T03:05:51Z. --- `video_out_flip_tests` is built with `EXCLUDE_FROM_ALL` and never registered in ctest, and on main (`ab9437e3`) most of its modes fail. I ran every mode on Linux with `SDL_VIDEODRIVER=offscreen` and lavapipe: ``` (default) terminate called after throwing an instance of 'std::runtime_error' what(): VideoOut: port is closed reopen [videoout] presentation failed: VideoOut: port is closed, then terminate decode VideoOut flip tests passed controls VideoOut flip tests passed present, backtoback, dcc, pacing, aftergpu, unavailable param.json not found ``` The default lifetime mode gets through all of its checks up to the last one, which expects `LibcRunShutdown_nid_postfix()` to throw the asynchronous "closed" error back to the caller. What happens instead is that `VideoOutDriver::Shutdown` stops the present thread, `presentLoop` then calls `AgcDriverShutdown_nid_postfix()` outside its try block, `Driver::Shutdown` rethrows the stored worker failure on the present thread, and the process terminates: ``` #9 AgcDriver::DriverDetail::Driver::rethrowFailure() const #10 AgcDriver::DriverDetail::Driver::Shutdown() #11 VideoOutDriver::presentLoop(std::stop_token) ``` Catching that call in `presentLoop` and storing the error in `flipQueue->failure`, so `VideoOutDriver::Shutdown` rethrows it after the join, makes the default mode pass. The reopen mode is different. There the output's `Fail` sets the queue-wide `flipQueue->failure` while the present loop is still running, and the loop's own catch calls `std::terminate`. That terminate came in with 0d29a0a3 ("terminate process on gpu and presentation thread failures"), which is newer than this test, so the test's expectation that a flip on a closed port only fails that port's waiters and is reported again at shutdown no longer matches the policy. It only shows up outside gdb; under gdb the timing changes and it passes. The other six modes need a `param.json` in the working directory, so they'd need a fixture before they could run in ctest. I didn't want to guess which side is intended. Should a flip that fails because its port was closed still kill the process, or should it stay a per-port failure as the test expects? Once that's settled I'm happy to send a PR that fixes the shutdown path, updates the test and registers the modes that can run headless (decode and controls already pass).
MarcZX10 commented 2026-10-09 18:31:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T18:31:56Z.


Progress on the headless test coverage

I pushed two commits to the fork branch test/videoout-headless-ctest-1040:

  • 75f410a3 registers video_out_decode with CTest and includes video_out_flip_tests in the default build when BUILD_TESTING=ON.
  • 96a198c4 removes video_out_flip_tests from KNOWN_UNRUN now that CTest runs it.

Validation on current main (f8c2f072):

  • video_out_decode passes (1/1) with lavapipe and SDL offscreen.
  • tools/check_test_registration.py passes on a Ninja configuration: 448 test executables, with only the already documented agc_driver_recorder_tests exemption.
  • git diff --check and tools/check_conventions.py --base upstream/main pass.

I did not register controls: on this current tree it fails with SDL offscreen because that driver cannot create the Vulkan surface, and the Linux Build workflow does not install Xvfb. The lifetime and reopen modes also remain unresolved. These commits do not change shutdown or presentation failure semantics, so the question in this issue about whether a closed-port flip should terminate the process still needs a maintainer decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6086924425 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1040#issuecomment-6086924425). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T18:31:56Z. --- ### Progress on the headless test coverage I pushed two commits to the fork branch [`test/videoout-headless-ctest-1040`](https://github.com/MarcZX100/AnyPS5/tree/test/videoout-headless-ctest-1040): - `75f410a3` registers `video_out_decode` with CTest and includes `video_out_flip_tests` in the default build when `BUILD_TESTING=ON`. - `96a198c4` removes `video_out_flip_tests` from `KNOWN_UNRUN` now that CTest runs it. Validation on current `main` (`f8c2f072`): - `video_out_decode` passes (1/1) with lavapipe and SDL offscreen. - `tools/check_test_registration.py` passes on a Ninja configuration: 448 test executables, with only the already documented `agc_driver_recorder_tests` exemption. - `git diff --check` and `tools/check_conventions.py --base upstream/main` pass. I did not register `controls`: on this current tree it fails with SDL offscreen because that driver cannot create the Vulkan surface, and the Linux Build workflow does not install Xvfb. The lifetime and reopen modes also remain unresolved. These commits do not change shutdown or presentation failure semantics, so the question in this issue about whether a closed-port flip should terminate the process still needs a maintainer decision.
MarcZX10 commented 2026-10-09 18:33:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T18:33:16Z.


Correction after checking the open PRs

I missed the existing overlap with #1225 before pushing my test-only branch. #1225 already contains the shutdown fix and a more complete version of this test registration, including the KNOWN_UNRUN cleanup, param.json fixture, and skip handling when an SDL Vulkan window is unavailable. Its author also recorded Windows results after the later SDL change.

My two commits added no unique change beyond #1225. I deleted the redundant fork branch; the local commits remain in my workspace for reference. Please treat #1225 as the existing contribution for this issue. I did not open another PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6086944803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1040#issuecomment-6086944803). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T18:33:16Z. --- ### Correction after checking the open PRs I missed the existing overlap with #1225 before pushing my test-only branch. #1225 already contains the shutdown fix and a more complete version of this test registration, including the `KNOWN_UNRUN` cleanup, `param.json` fixture, and skip handling when an SDL Vulkan window is unavailable. Its author also recorded Windows results after the later SDL change. My two commits added no unique change beyond #1225. I deleted the redundant fork branch; the local commits remain in my workspace for reference. Please treat #1225 as the existing contribution for this issue. I did not open another PR.
oneandonlydean commented 2026-10-10 06:24:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T06:24:54Z.


Closing: #1225 and #1648 fixed the lifetime and reopen modes, and all four modes now run in ctest (core/libs/prx/libSceVideoOut/CMakeLists.txt:36).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094628779 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1040#issuecomment-6094628779). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T06:24:54Z. --- Closing: #1225 and #1648 fixed the lifetime and reopen modes, and all four modes now run in ctest (`core/libs/prx/libSceVideoOut/CMakeLists.txt:36`).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#1040
No description provided.