Skip to content

fix(libSceVideoOut): accept an output mode left at any in every field - #22517

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
adam25136:fix/videoout-configure-any-mode
Nov 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
adam25136:fix/videoout-configure-any-mode

Conversation

@adam25136

Copy link
Copy Markdown
Contributor

What

On main, sceVideoOutConfigureOutputMode_ checks its arguments in firmware 13.42's order (#19293) and then throws for every mode record that passes them. With this change, on a main-bus port, it returns 0 and changes nothing for a record whose first word is 0x20 and whose bytes 4 to 0x1f are all 0xff (every field "any", which is how sceVideoOutModeSetAny_ fills it), when the fourth argument is null. Any other record whose first word is 0x20, and a non-null fourth argument, still throw.

  • Why 0 for this record: in BunnyFl's run of firmware 13.42's validator (#15134 comment, a PC harness, not a console), this record passes with the flags word clear; no result for it with flags set is reported. The module then checks that no other handle owns the output, which cannot fail here because each bus has one handle (VideoOutDriver::Open gives bus n handle n + 1). It then sends the request to libSceAvSetting and returns that module's reply, mapped to VideoOut codes; what comes back through libSceAvSetting's IPC was not read. So the 0 is inferred, as the new Unknown function info entry says. The run called the validator directly with five imports stubbed to return 0, among them sceKernelGetPs4CompiledSdkVersion; it read firmware 13.42's PS5 module, and PS4 firmware's libSceVideoOut was not read.
  • Why a silent stub is acceptable here: every field of this record is "any", so it asks for no particular mode. The effects of the call that were read are the request to libSceAvSetting (after its one-time setup), the handle recorded as the output's owner, and a 16-byte cached copy on the port that the result keeps or rolls back. main keeps none of them, and returning 0 leaves what it does model (the output mode sceVideoOutConfigureOutput stores, host HDR) as it is and posts no set-mode event. What the console does with such a request is not known, and a record that asks for a value still throws. Other no-op display calls under Silent stubs, such as sceVideoOutVrrPegToFixedRate and sceVideoOutSetWindowModeMargins, are the same kind.
  • Who calls it this way: inFAMOUS Second Son (CUSA00223 01.07). Both of its call sites fill the record with sceVideoOutModeSetAny_(&mode, 0x20) after registering the display buffers. They then write only +6: 0x0c or 0xff (what sceVideoOutModeSetAny_ put there), chosen by a flag that also picks the buffers' pixel format (0x88740000 with 0x0c). The call is (handle, 0, &mode, 0, 0x20, 0x10), and its result is not checked.
  • Earlier work: feat(libs): PS4 imports and a buffer option inFAMOUS Second Son needs #10531 (DealPotato, closed by the open-PR limit) returned 0 for every record. zaryabzip's fix(libSceVideoOut): check the output mode calls' arguments as firmware 13.42 does #19293 added the argument checks main has now and left the function throwing; after BunnyFl's run they kept it throwing because what the validator accepts depends on the flag bits; this covers only the record that passed with them clear. I asked them on #15134 before opening this and have had no answer.
  • Technical debt: a fragment rewrites the sceVideoOutGetDeviceInfoEx_, sceVideoOutConfigureOutputMode_ entry and adds a Silent stubs entry and an Unknown function info entry for this record.

Tested

Windows 10 Pro 22H2 (19045), NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 (r7), CMake 4.3.1, Release, this branch on main 4b83e9d223. main's own agc_driver_upload_cache_read_only_flush_tests does not build with MinGW (setenv; open #19899 fixes it), so the builds went on past it.

  • guest_video_out_output_mode_checks: passes, with its new checks. A record left at any returns 0, and the same record with its first word 0x1f still returns 0x80290016. These calls still throw: the record with any one of bytes 4 to 0x1f set to 0 (28 calls), the record with colorimetry 0x0c, and the record left at any with a non-null fourth argument. Each throw must be sceVideoOutConfigureOutputMode_ not implemented, counted once by NotImplementedCalls_nid_no_patch. Without the InventoryExports.cpp change it fails with sceVideoOutConfigureOutputMode_ not implemented, and each of 7 further deliberate breaks fails it: accepting every record whose first word is 0x20, ignoring the fourth argument, skipping byte 4, skipping the last byte, checking only byte 6, checking only bytes 4, 6 and 0x1f, and moving the new check above the first-word check. It also passes in a build configured with -DANYPS5_ENABLE_SPIRV_TOOLS=ON.
  • The 1,186 tests tools/select_tests.py selects for the 3 changed files (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), on main and on this branch: 1,184 pass on both. performance_runner_PerformanceRunTests fails on both, because a clean performance capture refuses ANYPS5_NO_SHADER_CACHE, and guest_video_out_wqhd_detection_no_vulkan is skipped on both (it points the Vulkan loader at a missing driver file).
  • With VK_LAYER_KHRONOS_validation 1.4.367 (VK_ADD_LAYER_PATH=<the layer's folder> VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer VK_LOADER_LAYERS_DISABLE=~implicit~ ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), the 63 tests matching video_out|videoout, ctest -V, on main and on this branch: each log has 49 Insert instance layer "VK_LAYER_KHRONOS_validation" lines from 48 tests, no "was not found" line and no VUID- message. 62 pass on both, and guest_video_out_wqhd_detection_no_vulkan is skipped on both, as above.
  • inFAMOUS Second Son (CUSA00223 01.07, my own dump), unwrapped by main's tools/unwrap_self.py and converted with --windows --registry --trace-imports. Both starts ran on main be4613dd73 with feat(libSceGnmDriver): export the workload, trace and tessellation si… #18235, feat(libSceGnmDriver): share mode-independent command writers #17711 and fix(libSceSysmodule): accept four PS4-only module ids in a PS4 process #18184 merged locally (feat(libSceGnmDriver): share mode-independent command writers #17711's one conflicting file, libSceGnmDriverForNeoMode/Export.cpp, kept main's version) and a local answer for libSceDiscMap's fJgP+wqifno (asked about on feat(libs): PS4 imports and a buffer option inFAMOUS Second Son needs #10531); the load needs all of them. One traced start each:
    • without this change: stops 8.1 s in with sceVideoOutConfigureOutputMode_ not implemented, before the first frame;
    • with it (an earlier form of the same condition, written with std::all_of): gets past the call, so its record was all 0xff; presents its first frame and stops 26.7 s in on an AGC driver error, a separate gap. The image descriptor of compute shader 0x2f2fa2500 (format 22) matches none of the image modes of its static interface.
  • python tools/check_conventions.py --base origin/main with this title and description: all checks passed.
  • python tools/pr_overlap.py --branch: no overlap with open pull requests; the two that share files or exports with this branch merge cleanly with it.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: CUSA00223 inFAMOUS Second Son (CUSA00223) #8214
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 621.14, Windows 10 22H2
  • AI-assisted: yes

AI-assisted: Claude Code found the title's call sites in its executable, wrote the change and its test, ran the tests and the inFAMOUS starts, and drafted this description; separate review agents checked it.

🤖 Generated with Claude Code

sceVideoOutConfigureOutputMode_ returns 0 on the main bus for a 0x20
record whose fields are all "any" (bytes 4 to 0x1f 0xff, as
sceVideoOutModeSetAny_ fills it) when the fourth argument is null, and
changes nothing. A run of firmware 13.42's validator passed that record
with its flags word clear (boykopovar#15134); the libSceAvSetting reply that
decides the console's result was not read. Any other record and a
non-null fourth argument still throw.

CUSA00223 calls it this way after registering its display buffers and
ignores the result; it stopped there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line docs prx labels Nov 17, 2026
@oneandonlydean
oneandonlydean merged commit 00276e4 into boykopovar:main Nov 17, 2026
14 checks passed
@domx4q

domx4q commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ran the guest VideoOut tests with the Khronos validation layer on NVIDIA's proprietary Linux driver and a real display, since CI skips them for lack of a display and the PR was tested on Windows only.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head db10df2478 merged onto main 89b0eef7ab with --no-ff, clean merge. Main baseline is a Release build of 89b0eef7ab on the same machine, both configured with -DANYPS5_VIDEO_OUT_TEST_DRIVER=wayland. Both sides ran under a Wayland session (Hyprland) with ANYPS5_REQUIRE_DISPLAY=1, so the tests that open a VideoOut port run instead of skipping.

WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 ANYPS5_REQUIRE_DISPLAY=1 \
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^guest_video_out_' -V
main 89b0eef7ab this PR
Result 23 passed (23) 23 passed (23)
Insert instance layer "VK_LAYER_KHRONOS_validation" 21 21
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

guest_video_out_output_mode_checks, with the new checks on the PR side, passes on both sides. Every device selection picked the RTX 4090.

No new VUID- errors; all focused tests pass on Ada with a real display.

AI-assisted: yes (Claude Code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs prx unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants