fix(libSceVideoOut): accept buffer option 8 from PS4 callers #18033

Merged
adam25136 merged 1 commit from upstream-pr/18033 into main 2026-11-13 10:20:25 +00:00
adam25136 commented 2026-11-10 06:42:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adam25136 on 2026-11-10T06:42:26Z.


What

The PS4 sceVideoOutRegisterBuffers and sceVideoOutSubmitChangeBufferAttribute threw VIDEO_OUT_ERROR_INVALID_OPTION for any nonzero option. Both now accept option 8 (VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_STRICT_COLORIMETRY) and store it in the buffer group, where DescribeVideoOutBuffer builds the same display buffer as for option 0. That is what #647 did for the PS5 calls, sceVideoOutRegisterBuffers2 and sceVideoOutSubmitChangeBufferAttribute2. Any other option still throws VIDEO_OUT_ERROR_INVALID_OPTION.

A PS4 title passes it: the first sceVideoOutRegisterBuffers call of CUSA00223 01.07 registers two tiled 3840x2160 A8R8G8B8_SRGB buffers with option 8 (see Tested). What a console does with option 8 is not known, for PS4 or PS5 callers, and whether a PS4 title's 8 means the same as a PS5 title's was not measured.

docs/dev/debt/libSceVideoOut.md:

  • The PS4 callers entry said the PS4 function accepts "only linear" A8R8G8B8_SRGB and A8B8G8R8_SRGB buffers "without options". The same entry says tiled buffers register, and Ps5PixelFormat also accepts 0x88000000, so it now reads: A8R8G8B8_SRGB, A8B8G8R8_SRGB and 0x88000000 buffers, linear or tiled, with option 0 or 8.
  • A new entry next to it starts with what is unknown, then records the title's call and how option 8 is handled.

Tested

Windows 10 Pro 22H2 (19045), i9-12900KF, NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release, BUILD_TESTING=ON, on main 53bb992782, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.

  • New checks in video_out_flip_ps4:
    • a tiled set registered with option 8, at the end of the test, must store it and describe as the same buffer with option 0;
    • sceVideoOutSubmitChangeBufferAttribute with option 8 must succeed and store it, and changing back to option 0 must leave the group as before.
  • Does video_out_flip_ps4 fail without the change? Each time with this PR's test kept:
    • with the sceVideoOutRegisterBuffers check back to option != 0: fails, sceVideoOutRegisterBuffers: VIDEO_OUT_ERROR_INVALID_OPTION;
    • with the sceVideoOutSubmitChangeBufferAttribute check back to option != 0: fails, sceVideoOutSubmitChangeBufferAttribute: VIDEO_OUT_ERROR_INVALID_OPTION;
    • without storing the option on registration: fails, "the PS4 buffer option 8 was not stored";
    • without storing it in the change call: fails, "the legacy change did not store option 8";
    • with a check accepting every option instead: fails with "a PS4 buffer option was accepted" (the existing option 1 check).
  • The 28 video_out_flip_ tests with VK_LAYER_KHRONOS_validation, implicit layers disabled, on main and with this change: 28 of 28 pass on each side, with no VUID- line and no "was not found but was requested by env var VK_INSTANCE_LAYERS" line. A VK_LOADER_DEBUG=layer rerun of video_out_flip_ps4 shows the loader inserting the layer.
  • The tests tools/select_tests.py select picks for the three changed files: 1,116 of 4,890. With this change, 1,112 pass, guest_kernel_sys_paths_symlinkat_patched times out, and agc_driver_resource_cache_pending_fail_count, agc_driver_resource_cache_pending_fail_count_index and guest_video_out_wqhd_detection_no_vulkan skip (exit code 77). On main the same test times out and the same three skip here.
  • The title:
    • On main: CUSA00223 does not get as far as this call. It stops at load on the 47 imports of #17581, as measured on main 22ae9a397d.
    • This PR with two local changes that are not part of it: loading libSceGnmDriverForNeoMode.prx for it (#17581), and leaving 0 instead of 1 in a destroyed rwlock handle, which goes against the PS5 measurement in docs/dev/debt/libkernel.md. The title's own file library destroys its rwlocks and then uses them again. I started it 8 times. 4 starts stopped earlier, in that file library. The other 4 each called sceVideoOutSetBufferAttribute, both sceVideoOutRegisterBuffers calls, sceVideoOutModeSetAny_ and then sceVideoOutConfigureOutputMode_, which is not implemented.
    • Without this PR: with the same local changes and a local message that printed the attribute, on main 1a13265e8b, 3 of 8 starts reached the first sceVideoOutRegisterBuffers call and ended there with VIDEO_OUT_ERROR_INVALID_OPTION for pixel format 0x80000000, tiling mode 0, 3840x2160, pitch 3840 and option 8.
  • Rebased onto main 56619b998c before opening (head fd04d1db8e): none of the 17 commits since 53bb992782 touches libSceVideoOut, the GNM libraries, the relinker, the libkernel thread code or this PR's three files. Built there, the 28 video_out_flip_ tests pass again with VK_LAYER_KHRONOS_validation and no VUID- line.
  • Debt entry reworded and the PR's two option 7 checks removed (head 65cc907322, tested with the same files before they were folded into one commit): the debt entry no longer takes the option names from other emulators, and the existing option 1 checks already test a refused option in both PS4 calls. Merged locally into main 1b485ff745: the 28 video_out_flip_ tests pass, and 28 of 28 again with VK_LAYER_KHRONOS_validation and no VUID- line. video_out_flip_ps4 fails with a check accepting every option ("a PS4 buffer option was accepted") and with one refusing option 8 (sceVideoOutSubmitChangeBufferAttribute: VIDEO_OUT_ERROR_INVALID_OPTION), and passes unchanged.
  • python tools/check_conventions.py --base origin/main with this title and description: all checks pass.
  • tools/pr_overlap.py --branch (in a full clone, 1,989 open pull requests): 28 share a file with this branch.
    • It reports one conflict: #17980 adds an entry to docs/dev/debt/libSceVideoOut.md directly before the PS4 callers entry that this PR rewords. Keeping both resolves it.
    • It could not compare three, which I checked by hand. #4040 adds one entry after the sceVideoOutGetResolutionStatus entry (line 28 on main). #5021 changes Flip.cpp only around lines 17, 884 and 919, away from the checks this PR adds. #14212, already conflicting with main, adds a blank line between all the entries of that file, this one included.

Not covered: what a PS4 or PS5 console does with option 8; options other than 0, 1 and 8; Linux and macOS (the change is platform-independent, but the tests ran only on Windows).

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
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 621.14, Windows 10 Pro 22H2 (19045)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5237041021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18033). Originally posted by [adam25136](https://github.com/adam25136) on 2026-11-10T06:42:26Z. --- ### What The PS4 `sceVideoOutRegisterBuffers` and `sceVideoOutSubmitChangeBufferAttribute` threw `VIDEO_OUT_ERROR_INVALID_OPTION` for any nonzero `option`. Both now accept option 8 (`VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_STRICT_COLORIMETRY`) and store it in the buffer group, where `DescribeVideoOutBuffer` builds the same display buffer as for option 0. That is what #647 did for the PS5 calls, `sceVideoOutRegisterBuffers2` and `sceVideoOutSubmitChangeBufferAttribute2`. Any other option still throws `VIDEO_OUT_ERROR_INVALID_OPTION`. A PS4 title passes it: the first `sceVideoOutRegisterBuffers` call of CUSA00223 01.07 registers two tiled 3840x2160 `A8R8G8B8_SRGB` buffers with option 8 (see Tested). What a console does with option 8 is not known, for PS4 or PS5 callers, and whether a PS4 title's 8 means the same as a PS5 title's was not measured. `docs/dev/debt/libSceVideoOut.md`: - The PS4 callers entry said the PS4 function accepts "only linear" `A8R8G8B8_SRGB` and `A8B8G8R8_SRGB` buffers "without options". The same entry says tiled buffers register, and `Ps5PixelFormat` also accepts `0x88000000`, so it now reads: `A8R8G8B8_SRGB`, `A8B8G8R8_SRGB` and `0x88000000` buffers, linear or tiled, with option 0 or 8. - A new entry next to it starts with what is unknown, then records the title's call and how option 8 is handled. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 10 Pro 22H2 (19045), i9-12900KF, NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release, `BUILD_TESTING=ON`, on `main` `53bb992782`, with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`. - **New checks in `video_out_flip_ps4`:** - a tiled set registered with option 8, at the end of the test, must store it and describe as the same buffer with option 0; - `sceVideoOutSubmitChangeBufferAttribute` with option 8 must succeed and store it, and changing back to option 0 must leave the group as before. - **Does `video_out_flip_ps4` fail without the change?** Each time with this PR's test kept: - with the `sceVideoOutRegisterBuffers` check back to `option != 0`: fails, `sceVideoOutRegisterBuffers: VIDEO_OUT_ERROR_INVALID_OPTION`; - with the `sceVideoOutSubmitChangeBufferAttribute` check back to `option != 0`: fails, `sceVideoOutSubmitChangeBufferAttribute: VIDEO_OUT_ERROR_INVALID_OPTION`; - without storing the option on registration: fails, "the PS4 buffer option 8 was not stored"; - without storing it in the change call: fails, "the legacy change did not store option 8"; - with a check accepting every option instead: fails with "a PS4 buffer option was accepted" (the existing option 1 check). - **The 28 `video_out_flip_` tests with `VK_LAYER_KHRONOS_validation`**, implicit layers disabled, on `main` and with this change: 28 of 28 pass on each side, with no `VUID-` line and no "was not found but was requested by env var VK_INSTANCE_LAYERS" line. A `VK_LOADER_DEBUG=layer` rerun of `video_out_flip_ps4` shows the loader inserting the layer. - **The tests `tools/select_tests.py select` picks for the three changed files:** 1,116 of 4,890. With this change, 1,112 pass, `guest_kernel_sys_paths_symlinkat_patched` times out, and `agc_driver_resource_cache_pending_fail_count`, `agc_driver_resource_cache_pending_fail_count_index` and `guest_video_out_wqhd_detection_no_vulkan` skip (exit code 77). On `main` the same test times out and the same three skip here. - **The title:** - **On `main`:** CUSA00223 does not get as far as this call. It stops at load on the 47 imports of #17581, as measured on `main` `22ae9a397d`. - **This PR with two local changes** that are not part of it: loading `libSceGnmDriverForNeoMode.prx` for it (#17581), and leaving 0 instead of 1 in a destroyed rwlock handle, which goes against the PS5 measurement in `docs/dev/debt/libkernel.md`. The title's own file library destroys its rwlocks and then uses them again. I started it 8 times. 4 starts stopped earlier, in that file library. The other 4 each called `sceVideoOutSetBufferAttribute`, both `sceVideoOutRegisterBuffers` calls, `sceVideoOutModeSetAny_` and then `sceVideoOutConfigureOutputMode_`, which is not implemented. - **Without this PR:** with the same local changes and a local message that printed the attribute, on `main` `1a13265e8b`, 3 of 8 starts reached the first `sceVideoOutRegisterBuffers` call and ended there with `VIDEO_OUT_ERROR_INVALID_OPTION` for pixel format `0x80000000`, tiling mode 0, 3840x2160, pitch 3840 and option 8. - **Rebased onto `main` `56619b998c` before opening** (head `fd04d1db8e`): none of the 17 commits since `53bb992782` touches `libSceVideoOut`, the GNM libraries, the relinker, the libkernel thread code or this PR's three files. Built there, the 28 `video_out_flip_` tests pass again with `VK_LAYER_KHRONOS_validation` and no `VUID-` line. - **Debt entry reworded and the PR's two option 7 checks removed** (head `65cc907322`, tested with the same files before they were folded into one commit): the debt entry no longer takes the option names from other emulators, and the existing option 1 checks already test a refused option in both PS4 calls. Merged locally into `main` `1b485ff745`: the 28 `video_out_flip_` tests pass, and 28 of 28 again with `VK_LAYER_KHRONOS_validation` and no `VUID-` line. `video_out_flip_ps4` fails with a check accepting every option ("a PS4 buffer option was accepted") and with one refusing option 8 (`sceVideoOutSubmitChangeBufferAttribute: VIDEO_OUT_ERROR_INVALID_OPTION`), and passes unchanged. - `python tools/check_conventions.py --base origin/main` with this title and description: all checks pass. - `tools/pr_overlap.py --branch` (in a full clone, 1,989 open pull requests): 28 share a file with this branch. - It reports one conflict: #17980 adds an entry to `docs/dev/debt/libSceVideoOut.md` directly before the PS4 callers entry that this PR rewords. Keeping both resolves it. - It could not compare three, which I checked by hand. #4040 adds one entry after the `sceVideoOutGetResolutionStatus` entry (line 28 on `main`). #5021 changes `Flip.cpp` only around lines 17, 884 and 919, away from the checks this PR adds. #14212, already conflicting with `main`, adds a blank line between all the entries of that file, this one included. Not covered: what a PS4 or PS5 console does with option 8; options other than 0, 1 and 8; Linux and macOS (the change is platform-independent, but the tests ran only on Windows). ### 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: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: NVIDIA GeForce RTX 5080, driver 621.14, Windows 10 Pro 22H2 (19045) <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> 🤖 Generated with [Claude Code](https://claude.com/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!18033
No description provided.