feat(libSceVideoOut): implement sceVideoOutSetFlipMaster and sceVideoOutClearFlipMaster #4081

Closed
screamm wants to merge 1 commit from upstream-pr/4081 into main
screamm commented 2026-10-11 22:53:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T22:53:15Z.


Summary

Implements sceVideoOutSetFlipMaster(int slave, int master) (NID WkYtyOg30do) and sceVideoOutClearFlipMaster(int slave) (NID T0ynQY3mH-0), both absent until now. Offered first in #3762.

  • Signatures and Set semantics from KytyPS5 src/graphics/presentation/videoOut.cpp:785-808 (16a7fe68), the UNSUPPORTED_OPERATION code 0x8029001C from KytyPS5 errno.h (fpPS4 agrees), the Clear signature from SharpProspero VideoOut.cs (fact only, GPL-3.0).
  • The model holds several ports at once (main, overlay, sub), so a tie between two real ports is recorded on both: unknown or closed handle INVALID_HANDLE; the same handle twice, a slave that already has a master or slaves, or a master with its own master UNSUPPORTED_OPERATION (new constant); a pending flip on either port RESOURCE_BUSY; otherwise Set records the tie (a master may have several slaves) and returns 0; Clear removes it; closing a slave drops its tie as Kyty does.
  • Throws, with the reason named: any flip on a tied port (the grouped master/slave flip, Kyty's flip modes 8 and 9, is not modelled), Clear on a port without a master (no source has a body for Clear), closing a master that still has slaves (fatal in Kyty). Recorded in TechnicalDebt.

Title evidence

Tomba! 2 (PPSA29866, #3646): "Eleven imports that no library exports: eight sceHmd2Reprojection*, sceVrTracker2Finalize, sceVideoOutSetFlipMaster, sceVideoOutClearFlipMaster." Neither call ran in the 60 s run, so what the title needs back is unobserved; this makes the module load and records the tie exactly as the only public implementation does.

Unverified on console (recorded in TechnicalDebt)

  • The whole Set behaviour comes from one emulator (Kyty), not a console; 0x8029001C is shared by Kyty and fpPS4.
  • Flips on a tied port throw rather than returning Kyty's INVALID_FLIP_MODE for modes 1 to 6.
  • Lock order in Set/Clear/close: the driver mutex, then both port mutexes with std::scoped_lock.

Tests

New video_out_flip_flipmaster mode in tests/Flip.cpp, registered in the existing foreach: invalid handles for all three arguments, Set(h, h), Clear without a master, RESOURCE_BUSY while a flip is pending, tying overlay to main, double and reverse ties, flips on a tied port and closing a tied master throwing, Clear followed by a completed flip, re-tie then closing the slave followed by a completed flip.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: under ctest the video_out_flip_* tests skip on this host as they always do (the SDL offscreen driver has no Vulkan), so video_out_flip_flipmaster was run against the real display (NVIDIA RTX 4070, ANYPS5_REQUIRE_DISPLAY=1, SDL_VIDEODRIVER=windows): passed 3/3, with overlay and lifetime passing once each; ctest -j8 -E "^agc_driver_|^video_out_flip" 533/536 on a11c8f7f, the failures being the known windows_exceptions (#3411), guest_kernel_sys (#3510) and guest_filesystem (#3518), all since fixed on main; tools/check_conventions.py --base main and git diff --check pass; merges onto current main without conflicts. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated by me on Windows).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823003724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4081). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T22:53:15Z. --- ## Summary Implements `sceVideoOutSetFlipMaster(int slave, int master)` (NID `WkYtyOg30do`) and `sceVideoOutClearFlipMaster(int slave)` (NID `T0ynQY3mH-0`), both absent until now. Offered first in #3762. - Signatures and Set semantics from KytyPS5 `src/graphics/presentation/videoOut.cpp:785-808` (`16a7fe68`), the `UNSUPPORTED_OPERATION` code `0x8029001C` from KytyPS5 `errno.h` (fpPS4 agrees), the Clear signature from SharpProspero `VideoOut.cs` (fact only, GPL-3.0). - The model holds several ports at once (main, overlay, sub), so a tie between two real ports is recorded on both: unknown or closed handle `INVALID_HANDLE`; the same handle twice, a slave that already has a master or slaves, or a master with its own master `UNSUPPORTED_OPERATION` (new constant); a pending flip on either port `RESOURCE_BUSY`; otherwise Set records the tie (a master may have several slaves) and returns 0; Clear removes it; closing a slave drops its tie as Kyty does. - Throws, with the reason named: any flip on a tied port (the grouped master/slave flip, Kyty's flip modes 8 and 9, is not modelled), Clear on a port without a master (no source has a body for Clear), closing a master that still has slaves (fatal in Kyty). Recorded in TechnicalDebt. ## Title evidence Tomba! 2 (PPSA29866, #3646): "Eleven imports that no library exports: eight `sceHmd2Reprojection*`, `sceVrTracker2Finalize`, `sceVideoOutSetFlipMaster`, `sceVideoOutClearFlipMaster`." Neither call ran in the 60 s run, so what the title needs back is unobserved; this makes the module load and records the tie exactly as the only public implementation does. ## Unverified on console (recorded in TechnicalDebt) - The whole Set behaviour comes from one emulator (Kyty), not a console; `0x8029001C` is shared by Kyty and fpPS4. - Flips on a tied port throw rather than returning Kyty's `INVALID_FLIP_MODE` for modes 1 to 6. - Lock order in Set/Clear/close: the driver mutex, then both port mutexes with `std::scoped_lock`. ## Tests New `video_out_flip_flipmaster` mode in `tests/Flip.cpp`, registered in the existing `foreach`: invalid handles for all three arguments, Set(h, h), Clear without a master, `RESOURCE_BUSY` while a flip is pending, tying overlay to main, double and reverse ties, flips on a tied port and closing a tied master throwing, Clear followed by a completed flip, re-tie then closing the slave followed by a completed flip. Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: under ctest the `video_out_flip_*` tests skip on this host as they always do (the SDL offscreen driver has no Vulkan), so `video_out_flip_flipmaster` was run against the real display (NVIDIA RTX 4070, `ANYPS5_REQUIRE_DISPLAY=1`, `SDL_VIDEODRIVER=windows`): passed 3/3, with `overlay` and `lifetime` passing once each; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 533/536 on `a11c8f7f`, the failures being the known `windows_exceptions` (#3411), `guest_kernel_sys` (#3510) and `guest_filesystem` (#3518), all since fixed on `main`; `tools/check_conventions.py --base main` and `git diff --check` pass; merges onto current `main` without conflicts. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated by me on Windows). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 23:02:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T23:02:09Z.


Progress report (325e0a8 → d33e2a4)

📈 System libraries: 86.48% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceVideoOut sceVideoOutClearFlipMaster
libSceVideoOut sceVideoOutSetFlipMaster
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114878569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4081#issuecomment-6114878569). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T23:02:09Z. --- <!-- progress-report --> ### Progress report (325e0a8 → d33e2a4) 📈 **System libraries**: 86.48% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceVideoOut | `sceVideoOutClearFlipMaster` | | libSceVideoOut | `sceVideoOutSetFlipMaster` | </details>
MarcZX10 commented 2026-10-12 20:53:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:53:34Z.


Review heads-up: I replayed the change locally to inspect its current-main conflicts (no push). At c952c2b0e, the conflict resolution needed to keep both unopened and flipmaster test modes, preserve the newer high-frame-rate methods alongside the flip-master declarations, and move the debt entry into docs/dev/debt/libSceVideoOut.md after the debt-file split. Conventions passed on that snapshot. main has advanced since to 529f7bfd4, so please rebase against the current head; I did not run a real-display test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132427207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4081#issuecomment-6132427207). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:53:34Z. --- Review heads-up: I replayed the change locally to inspect its current-main conflicts (no push). At `c952c2b0e`, the conflict resolution needed to keep both `unopened` and `flipmaster` test modes, preserve the newer high-frame-rate methods alongside the flip-master declarations, and move the debt entry into `docs/dev/debt/libSceVideoOut.md` after the debt-file split. Conventions passed on that snapshot. `main` has advanced since to `529f7bfd4`, so please rebase against the current head; I did not run a real-display test.
oneandonlydean commented 2026-10-13 00:58:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:58:19Z.


Closing: #3819 exported sceVideoOutSetFlipMaster and sceVideoOutClearFlipMaster on main as throwing stubs, so PPSA29866 loads past them, and no title is seen calling either (#3762); the tie rules here are KytyPS5's alone. Reopen with the log line when a title reaches the throw.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135727932 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4081#issuecomment-6135727932). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:58:19Z. --- Closing: #3819 exported `sceVideoOutSetFlipMaster` and `sceVideoOutClearFlipMaster` on main as throwing stubs, so PPSA29866 loads past them, and no title is seen calling either (#3762); the tie rules here are KytyPS5's alone. Reopen with the log line when a title reaches the throw.

Pull request closed

Sign in to join this conversation.
No reviewers
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!4081
No description provided.