feat(libSceVideoOut): register the set-mode event as the output-mode event #17980

Merged
zaryabzip merged 3 commits from upstream-pr/17980 into main 2026-11-13 10:25:05 +00:00
zaryabzip commented 2026-11-10 02:19:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-11-10T02:19:54Z.


What

sceVideoOutAddSetModeEvent and sceVideoOutDeleteSetModeEvent now add and remove the output-mode registration, the same as sceVideoOutAddOutputModeEvent and sceVideoOutDeleteOutputModeEvent. Before this they threw NotImplemented.

Source. @BunnyFl's reading of firmware 13.42's libSceVideoOut.sprx on #15134 (comment):

  • Both calls take (queue, handle, udata) and (queue, handle). An unknown handle gives 0x8029000b. Neither checks the queue or udata before the kernel call.
  • AddSetModeEvent is sceVideoOutAddFlipEvent with one record offset changed (+0x30 for +0x20). It registers with filter 0xfff3, EV_ADD, fflags 0 and data 0. DeleteSetModeEvent is sceVideoOutDeleteFlipEvent with the same one change.
  • On a bus-type-0 port the open path stores the same ident at +0x30 (set mode, at 0x10f6e) and +0x38 (output mode, at 0x10f7f), and both calls use the same filter. So in that module the set-mode event and the output-mode event are one kernel registration.
  • sceVideoOutGetEventId reports 8 for that ident, the id main already uses for the output-mode event.

Change (Event.cpp, Event.hpp). The two exports call registerVideoOutEvent and deleteVideoOutEvent with VIDEO_OUT_EVENT_SET_MODE. A title that adds both events on one queue gets one registration and one event, with the udata of the later call. The placeholders leave InventoryExports.cpp, its header and the debt table.

Debt (libSceVideoOut.md, Unknown function info). One entry records what is not modelled: on another bus only the set-mode ident is stored and sceVideoOutAddOutputModeEvent returns 0x8029001b. The module doesn't say when the kernel posts the event or what its data holds. Here it is armed at once with the current output mode, as the output-mode event already is. The "169 entries" count of the inventory table is left as it is, as in #17914, so this PR doesn't collide with the other open PRs that edit that line.

Test (GuestVideoOutSetModeEvent.cpp, ctest guest_video_out_set_mode_event). It opens the port first and skips with 77 when that fails without a display, like guest_video_out_hdr.

  • On a port that isn't open (the opened handle + 1), and on the port after it closes, both calls return 0x8029000b.
  • AddSetModeEvent then AddOutputModeEvent on one queue: one event arrives, id 8, with the second call's udata and the default output mode in its data.
  • After DeleteSetModeEvent, a new AddOutputModeEvent arms a fresh event, so the delete removed the shared registration. The same holds the other way round, with DeleteOutputModeEvent removing a set-mode registration.

Not in this PR (from the same reading): the display-position event pair, whose kernel side is not in the module, and the checks of sceVideoOutGetDeviceInfoEx_ and sceVideoOutConfigureOutputMode_.

Tested

  • Windows, by my test session at 07e59d601f on main a00ad036c4. Since then the debt entry moved (now between the two sceVideoOutSubmitFlip entries, clear of #18033), the table count was kept, and 83c99065b1 opens the port before the not-open rows (CI's Windows job has no display and aborted at those rows instead of skipping).
    • Windows 11 Home 25H2 (26200.9711), RTX 3060 Laptop, WinLibs GCC 15.2.0 r7 UCRT, CMake 4.3.1, Ninja 1.13.2, Release, BUILD_TESTING=ON.
    • guest_video_out_set_mode_event passes 3 of 3 with ANYPS5_REQUIRE_DISPLAY=1, so it ran rather than skipped.
    • guest_video_out_event_id and guest_video_out_hdr pass. The video_out_flip tests are EXCLUDE_FROM_ALL and were not built.
    • Control: with main's Event.cpp, InventoryExports.cpp and InventoryExports.hpp (this PR's Event.hpp and test kept), the test aborts 2 of 2 at its first row (GuestVideoOutSetModeEvent.cpp:38): sceVideoOutAddSetModeEvent not implemented. The libSceVideoOut.prx copy beside the test differed between the two builds (sha256 71882C2C… and 6C3088DD…), so the control ran main's code.
    • No warnings in the changed files.
  • Rerun at the head 83c99065b1 (tree 8f9cab0af6), same machine and toolchain, on main a00ad036c4. The 9 later main commits up to 11673672d9 touch nothing in libSceVideoOut or the test. guest_video_out_set_mode_event passes 3 of 3 with ANYPS5_REQUIRE_DISPLAY=1, not skipped. The libSceVideoOut sources are byte-identical to 07e59d601f, so the control above still applies. No warnings in the changed files.
  • Windows, by JJenkx, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), at 3c999644e5 merged onto main 81eb4e1935, a clean merge (comment). Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, ANYPS5_REQUIRE_VULKAN=1: guest_video_out_set_mode_event passes 3 of 3, none skipped. Their CPU-only run with Vulkan hidden (comment) found the abort that 83c99065b1 fixes.
  • CI: the hosted windows check, which has no display, passes at 83c99065b1.

Checked on macOS (arm64, where no full build is possible): the test passes clang++ -fsyntax-only -Wall -Wextra; tools/check_conventions.py --base main passes; git merge-tree finds no conflict with main or with any open PR that merges with main. #17914, which also registers set-mode events through sceVideoOutSysAddSetModeEvent2, merges cleanly with this one.

The overlap bot couldn't compare three PRs that already conflict with main. I checked them with git merge-tree:

  • #4040 (libSceVideoOut.md) and #5021 (libSceVideoOut/CMakeLists.txt): no conflict beyond the ones they already have with main.
  • #14212 (libSceVideoOut.md): one more conflict hunk. That PR puts a blank line between every entry in 274 debt files, so any new debt entry meets it. Resolving it means keeping both, with a blank line around the new entry.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none (two of the seven exports in #15134)
  • Unblocks: none
  • GPUs tested: NVIDIA RTX 3060 Laptop, Windows 11 25H2 (my run); AMD Radeon RX 6700 XT, driver 32.0.21045.16010, Windows 11 22621 (JJenkx). Only the new test and its two neighbours ran, not the GPU suite
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5234651874 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17980). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-11-10T02:19:54Z. --- ### What `sceVideoOutAddSetModeEvent` and `sceVideoOutDeleteSetModeEvent` now add and remove the output-mode registration, the same as `sceVideoOutAddOutputModeEvent` and `sceVideoOutDeleteOutputModeEvent`. Before this they threw `NotImplemented`. **Source.** @BunnyFl's reading of firmware 13.42's `libSceVideoOut.sprx` on #15134 ([comment](https://github.com/boykopovar/AnyPS5/issues/15134#issuecomment-6755215803)): - Both calls take `(queue, handle, udata)` and `(queue, handle)`. An unknown handle gives `0x8029000b`. Neither checks the queue or `udata` before the kernel call. - `AddSetModeEvent` is `sceVideoOutAddFlipEvent` with one record offset changed (`+0x30` for `+0x20`). It registers with filter `0xfff3`, `EV_ADD`, fflags 0 and data 0. `DeleteSetModeEvent` is `sceVideoOutDeleteFlipEvent` with the same one change. - On a bus-type-0 port the open path stores the same ident at `+0x30` (set mode, at `0x10f6e`) and `+0x38` (output mode, at `0x10f7f`), and both calls use the same filter. So in that module the set-mode event and the output-mode event are one kernel registration. - `sceVideoOutGetEventId` reports 8 for that ident, the id `main` already uses for the output-mode event. **Change** (`Event.cpp`, `Event.hpp`). The two exports call `registerVideoOutEvent` and `deleteVideoOutEvent` with `VIDEO_OUT_EVENT_SET_MODE`. A title that adds both events on one queue gets one registration and one event, with the `udata` of the later call. The placeholders leave `InventoryExports.cpp`, its header and the debt table. **Debt** (`libSceVideoOut.md`, Unknown function info). One entry records what is not modelled: on another bus only the set-mode ident is stored and `sceVideoOutAddOutputModeEvent` returns `0x8029001b`. The module doesn't say when the kernel posts the event or what its data holds. Here it is armed at once with the current output mode, as the output-mode event already is. The "169 entries" count of the inventory table is left as it is, as in #17914, so this PR doesn't collide with the other open PRs that edit that line. **Test** (`GuestVideoOutSetModeEvent.cpp`, ctest `guest_video_out_set_mode_event`). It opens the port first and skips with 77 when that fails without a display, like `guest_video_out_hdr`. - On a port that isn't open (the opened handle + 1), and on the port after it closes, both calls return `0x8029000b`. - `AddSetModeEvent` then `AddOutputModeEvent` on one queue: one event arrives, id 8, with the second call's `udata` and the default output mode in its data. - After `DeleteSetModeEvent`, a new `AddOutputModeEvent` arms a fresh event, so the delete removed the shared registration. The same holds the other way round, with `DeleteOutputModeEvent` removing a set-mode registration. Not in this PR (from the same reading): the display-position event pair, whose kernel side is not in the module, and the checks of `sceVideoOutGetDeviceInfoEx_` and `sceVideoOutConfigureOutputMode_`. ### Tested - **Windows, by my test session** at `07e59d601f` on `main` `a00ad036c4`. Since then the debt entry moved (now between the two `sceVideoOutSubmitFlip` entries, clear of #18033), the table count was kept, and `83c99065b1` opens the port before the not-open rows (CI's Windows job has no display and aborted at those rows instead of skipping). - Windows 11 Home 25H2 (26200.9711), RTX 3060 Laptop, WinLibs GCC 15.2.0 r7 UCRT, CMake 4.3.1, Ninja 1.13.2, Release, `BUILD_TESTING=ON`. - `guest_video_out_set_mode_event` passes 3 of 3 with `ANYPS5_REQUIRE_DISPLAY=1`, so it ran rather than skipped. - `guest_video_out_event_id` and `guest_video_out_hdr` pass. The `video_out_flip` tests are `EXCLUDE_FROM_ALL` and were not built. - Control: with `main`'s `Event.cpp`, `InventoryExports.cpp` and `InventoryExports.hpp` (this PR's `Event.hpp` and test kept), the test aborts 2 of 2 at its first row (`GuestVideoOutSetModeEvent.cpp:38`): `sceVideoOutAddSetModeEvent not implemented`. The `libSceVideoOut.prx` copy beside the test differed between the two builds (sha256 `71882C2C…` and `6C3088DD…`), so the control ran `main`'s code. - No warnings in the changed files. - **Rerun at the head `83c99065b1`** (tree `8f9cab0af6`), same machine and toolchain, on `main` `a00ad036c4`. The 9 later `main` commits up to `11673672d9` touch nothing in `libSceVideoOut` or the test. `guest_video_out_set_mode_event` passes 3 of 3 with `ANYPS5_REQUIRE_DISPLAY=1`, not skipped. The `libSceVideoOut` sources are byte-identical to `07e59d601f`, so the control above still applies. No warnings in the changed files. - **Windows, by JJenkx**, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), at `3c999644e5` merged onto `main` `81eb4e1935`, a clean merge ([comment](https://github.com/boykopovar/AnyPS5/pull/17980#issuecomment-6757655186)). Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, `ANYPS5_REQUIRE_VULKAN=1`: `guest_video_out_set_mode_event` passes 3 of 3, none skipped. Their CPU-only run with Vulkan hidden ([comment](https://github.com/boykopovar/AnyPS5/pull/17980#issuecomment-6757240199)) found the abort that `83c99065b1` fixes. - **CI**: the hosted `windows` check, which has no display, passes at `83c99065b1`. Checked on macOS (arm64, where no full build is possible): the test passes `clang++ -fsyntax-only -Wall -Wextra`; `tools/check_conventions.py --base main` passes; `git merge-tree` finds no conflict with `main` or with any open PR that merges with `main`. #17914, which also registers set-mode events through `sceVideoOutSysAddSetModeEvent2`, merges cleanly with this one. The overlap bot couldn't compare three PRs that already conflict with `main`. I checked them with `git merge-tree`: - #4040 (`libSceVideoOut.md`) and #5021 (`libSceVideoOut/CMakeLists.txt`): no conflict beyond the ones they already have with `main`. - #14212 (`libSceVideoOut.md`): one more conflict hunk. That PR puts a blank line between every entry in 274 debt files, so any new debt entry meets it. Resolving it means keeping both, with a blank line around the new entry. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none (two of the seven exports in #15134) - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> NVIDIA RTX 3060 Laptop, Windows 11 25H2 (my run); AMD Radeon RX 6700 XT, driver 32.0.21045.16010, Windows 11 22621 (JJenkx). Only the new test and its two neighbours ran, not the GPU suite - [x] AI-assisted: <!-- yes / no --> yes (Claude Code)
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!17980
No description provided.