feat(libSceVideoOut): limit the guest display to the host resolution #11948
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11948"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by 00xDisaster on 2026-10-27T13:43:22Z.
What
Let the host ask the guest video out to fall back to the host resolution instead of presenting a 4K buffer in a smaller window. When
ANYPS5_VIDEO_OUT_MAX_WIDTHis set below 3840, orANYPS5_VIDEO_OUT_MAX_HEIGHTis set below 2160, an unknown output mode is reported as unsupported (0), sosceVideoOutConfigureOutputanswersVIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE(0x80290019), and a title can choose a mode the host supports. A value of 3840x2160 or above does not enable the fallback, a value of 0 or a malformed value makes output-mode queries throw, and either axis alone can enable it.The buffer attributes and registered buffer sizes are left untouched. A title that keeps a 3840x2160 buffer still has that full buffer presented; the setting only affects output-mode selection, and it is off by default.
Tested
Linux 7.3.0-4-cachyos, GCC 16.2.1. Built
guest_video_out_host_resolution_limit_testswith the host display and Vulkan device, not skipped:sceVideoOutIsOutputSupportedandsceVideoOutConfigureOutput; a below-4K configured size leavesConfigureOutputreturningUNAVAILABLE_OUTPUT_MODE(0x80290019).VideoOutOutputSupport_nid_no_patchkeeps its real meaning: mode 1 is 1, mode 15 is 0 below 120 Hz and 1 at 120 Hz, mode 4 isUNSUPPORTED_OUTPUT_MODE, an unknown mode isUNKNOWN_OUTPUT_MODE, and an unknown mode returnsUNKNOWN_OUTPUT_MODEboth before and after setting 3840x2160.1920pxthrows and names the variable.sceVideoOutSubmitChangeBufferAttribute2keep the requested 3840x2160 attributes, including width-only and height-only cases.video_out_output_mode_policyandguest_video_out_output_modepass before and after this change.staticinOutput.cpp;VideoOutDriver.hppis unchanged.VUID-from 00xDisaster runs: on the change treevideo_out_output_mode_policyandguest_video_out_output_modepassed, and on the same machine againstmainthe same two tests passed. I also reran the six host-resolution tests and all passed.I captured four screenshots in a PPSA12544 run (Hollow Knight: Silksong, dumped by me and relinked from
0486c9a181) with both limits set. The overlay reportsRES: 1920x1080 / 1920x1080and the title presents gameplay at 120 FPS / 8.4 ms. The four screenshots from that run are in the PR thread (limit-001.pngthroughlimit-004.png); I intentionally did not upload them because image uploads are user-side.Windows 11 26300, WinLibs GCC 15.2.0, Release (maskym, independent run): the test linked after
#undef main;guest_video_out_host_resolution_limit,_height_onlyand_disabledpassed 2 runs each under the Khronos validation layer, with no new VUID. The host display was 2560x1440 at 165 Hz. Not run on a PS5.XairRrR separately verified a clean trial merge on an RTX 4070 Ti SUPER with no
VUID-on either tree and a passing negative control.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)VUID-on both.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T11:30:46Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The merge is clean, it builds, and the focused tests pass under the Khronos validation layer with no
VUID-. The negative control fails as it should. I am requesting changes because the two new "max" variables never use their values, the debt entry names the wrong error code, and theGPUs testedline does not name a GPU.What I ran
9c758516fd0b50c20f9d446d7f643a7d091ff589main:ba5b5330b37724bca4b99f30faab504653635a04main(no conflicts):86aabf3caf1a846d627d9ce4d2cb1e55c3d22ed0Results
maingit diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.libs, new test, output-mode tests)guest_video_out_host_resolution_limitguest_video_out_host_resolution_height_onlyguest_video_out_host_resolution_disabledvideo_out_output_mode_policy,guest_video_out_output_modemainInsert instance layer "VK_LAYER_KHRONOS_validation"in each Vulkan test on both treeswas not found but was requested by env var VK_INSTANCE_LAYERSVUID-linesmainMerged tree, ctest summary
main, ctest summaryNegative control
I restored
core/libs/prx/libSceVideoOut/src/Output.cppandcore/libs/prx/libSceVideoOut/include/VideoOutDriver.hppfrommain, kept the new test, and rebuilt it:The two enabled cases fail without the change. The disabled case passes on
main, as expected for a control. I then restored the merged files.Findings
Blocking
The "max width/height" values are parsed but never used.
VideoOutDriver.hpp:62-85parsesANYPS5_VIDEO_OUT_MAX_WIDTHandANYPS5_VIDEO_OUT_MAX_HEIGHTas integers. ThenVideoOutHostResolutionLimited()only checks whether either one is non-zero, andOutput.cpp:305never compares the numbers with anything.ANYPS5_VIDEO_OUT_MAX_WIDTH=3840gets the same rewrite of0x8029001Eto 0 as someone who sets1920. PPSA12544 then drops to its non-4K path, which is the opposite of what a "max 3840" setting suggests.ENVIRONMENT.md:572-573lists both asinteger, but the behaviour is a single on/off switch.APS5_OUTPUT_RESOLUTIONalready carries a host output size, so you could reuse it rather than add a second size knob.The debt entry names the wrong error code.
docs/dev/debt/libSceVideoOut.md:34says thatsceVideoOutConfigureOutputanswersVIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE. The code returnsVIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE(0x80290019) for a support result of 0 (Output.cpp:317), and the new test assertsUNAVAILABLE_OUTPUT_MODE(GuestVideoOutHostResolutionLimit.cpp:96). The first paragraph of the PR description has the same mistake.0xd000000aand that the console answers 0x8029001E.GPUs testeddoes not name a GPU. It reads "AMD Ryzen 7 5700 host", which is a CPU without integrated graphics. For VideoOut changes, CONTRIBUTING.md:72 requires the vendor, model, driver and OS of each GPU the tests ran on, plus amain-versus-change comparison under the validation layer.35a1b236a1and my NVIDIA run above cover part of this.Non-blocking
<charconv>,<cstdlib>,<string_view>,<system_error>) sit inVideoOutDriver.hpp, which seven other files incoreinclude. OnlyOutput.cppuses them. Moving them there asstaticfunctions keeps the header unchanged.1920pxor1920turns the fallback off without any message. The neighbouring variablesAPS5_OUTPUT_RESOLUTIONandANYPS5_LANGUAGEthrow on a malformed value and name the variable. Doing the same here would avoid a silently ignored setting. This becomes moot if finding 1 turns the setting into a presence variable.Not verified
35a1b236a1, not on the current head.0xd000000awith a display below 4K: the description also says this is not measured.To get this to a good state
APS5_OUTPUT_RESOLUTION, decide whether the fallback applies. UpdateENVIRONMENT.mdand the test to match.UNAVAILABLE_OUTPUT_MODE(0x80290019), and merge the text into the existingsceVideoOutIsOutputSupportedentry.GPUs testedwith the GPU model, driver and OS, and add amain-versus-change validation-layer comparison.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T11:51:29Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The new head
e9521cd7c2changes only the debt entry, which now namesUNAVAILABLE_OUTPUT_MODE. The code, the test and the PR description are unchanged, so two of my three blocking findings are still open.What changed since my last review
e9521cd7c2. Against the previously reviewed head9c758516fd, the only change is line 34 ofdocs/dev/debt/libSceVideoOut.md:VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODEbecomesVIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE (0x80290019);VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE (0x80290016).What I ran
e9521cd7c2f550fc6536299a0343d2bc4e42a44amain:ba5b5330b37724bca4b99f30faab504653635a04(the samemainas my previous review)a5bb83b95e0b569ae5ab8e500a2f21b88aea74efI did not rebuild or rerun the tests. The diff between this trial merge and the previous one is only
docs/dev/debt/libSceVideoOut.md(1 line), so the build, the focused validation-layer runs (0VUID-on both trees) and the negative control from my previous review still apply to the same code.maingit diff --checktools/check_conventions.py --base origin/maincheck_conventions.pyoutputPrevious findings
VideoOutHostResolutionLimited()still only checks for non-zero, andOutput.cpp:305never compares the values with anything.ANYPS5_VIDEO_OUT_MAX_WIDTH=3840still behaves like1920.UNAVAILABLE_OUTPUT_MODE (0x80290019), which matchesOutput.cpp:317.sceVideoOutConfigureOutputanswersVIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE.sceVideoOutIsOutputSupportedand is not folded into the line-20 entry.GPUs testeddoes not name a GPU. Still open. It still reads "AMD Ryzen 7 5700 host". CONTRIBUTING.md:72 asks for amain-versus-change validation-layer comparison for VideoOut changes. The description still has none from the author's own GPU.Of the previous non-blocking points, the helpers in the widely included header, the silently ignored malformed values, the missing width-only test and the reworded checklist line are all unchanged.
New findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceVideoOut.md:34says "A known-but-unsupported mode still answers VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE (0x80290016)". That is true for modes 4, 7, 8, 0xC-0xE, 0x10, 0x11 and 0x13 (Output.cpp:37-39). Mode 15 on a display below 120 Hz is also a known mode the host does not support. For it,VideoOutOutputSupport_nid_no_patchreturns 0 (Output.cpp:56), andConfigureOutputanswersUNAVAILABLE_OUTPUT_MODE.check_conventions.pynow warns[debt-length]on line 34. The previous head passed without a warning.Not verified
35a1b236a1.To get this to a good state
ENVIRONMENT.mdsay. Either use one presence variable for the unknown-mode rewrite, or make the configured size (orAPS5_OUTPUT_RESOLUTION) decide whether the fallback applies. Update the test to match.UNAVAILABLE_OUTPUT_MODE. Fold the debt text into the existingsceVideoOutIsOutputSupportedentry at line 20 and drop the mode-15-incorrect sentence. That also clears thedebt-lengthwarning.GPUs testedwith your GPU model, driver and OS, and add themain-versus-change validation-layer comparison from that GPU.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T20:19:33Z.
Review: COMMENTED
Re-checked — comments
Head
65e1a512a8fixes all three blocking findings from my last review. The fallback now turns on only for a size below 3840x2160, malformed or zero values throw, the helpers are file-local inOutput.cpp, the separate debt entry is gone, andGPUs testednames a GPU. I found nothing blocking. I'm not approving because the six new tests skip on this machine (there is no display), so I could not run them or the negative control myself.What changed since my last review
65e1a512a8, which replacese9521cd7c2. Compared with that head:VideoOutDriver.hppinto an anonymous namespace inOutput.cpp. That header is now untouched.ParseVideoOutHostDimensionthrowsstd::runtime_errornaming the variable when a value is empty, malformed or zero.VideoOutHostResolutionLimited()is true only forwidth < 3840orheight < 2160.width_only,four_kandmalformed.extern "C"declarations are replaced by includingBuffer.hpp. This fixes thepublic_headersfailure that TechLevelZero's NVIDIA CI reported one9521cd.docs/dev/debt/libSceVideoOut.mdentry is removed.ENVIRONMENT.mdrows now describe the below-4K rule and the throwing values.UNAVAILABLE_OUTPUT_MODE(0x80290019).GPUs testednames a GTX 1660 SUPER (driver 615.78.08, Linux 7.3.0-4-cachyos) and claims a validation-layer comparison betweenmainand the change.65e1a51merged onto93dbd0f. Its skip list does not include the new tests, so they ran there.What I ran
65e1a512a84131803d38b617429f90d80e2254f0main:096c45570f516de76a43bbe1b97781381c84f55f8669e02e1f02c21b916ae3da22d3ed02c4416034maingit diff --checkcheck_conventions.pymainfailuresguest_interfaces,guest_socket_options_multicast,unwrap_self,vector_constant_factor_tininessare not the PR'sVUID-video_out_output_mode_policyguest_video_out_host_resolution_*(6 tests),guest_video_out_output_modeWhy the tests skip here
There is no Xvfb or other virtual display in the sandbox.
Negative control
I did not run it. With
Output.cpprestored frommain, the tests would still exit 77 atsceVideoOutOpenbefore any assertion runs, so the result would show nothing.Reading the test against
main'sOutput.cpp, I expect:limit,height_onlyandwidth_onlyto fail:mainreturns0x8029001Ewhere the test expects 0.malformedto fail: nothing onmainthrows.four_kanddisabledto pass, since they checkmain's behaviour.This is reasoning only, not a run.
Previous findings
core/libs/prx/libSceVideoOut/src/Output.cpp:51-54compares each value with 3840 and 2160.four_kcase checks that 3840x2160 keeps answeringUNKNOWN_OUTPUT_MODE(core/libs/tests/GuestVideoOutHostResolutionLimit.cpp:89-92).VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE(0x80290019). That matchesOutput.cpp:388.ENVIRONMENT.md, and no code comment needs a debt entry.GPUs testeddid not name a GPU. Resolved, author-reported. It names an NVIDIA GeForce GTX 1660 SUPER (0x10de, driver 615.78.08, Linux 7.3.0-4-cachyos) and states the comparison betweenmainand the change with the layer loaded and 0VUID-. TechLevelZero's NVIDIA CI on this head also reports no new validation IDs.Output.cpp:23-56.debt-lengthwarning: no longer apply, because the debt entry was removed.New findings
Blocking
None.
Non-blocking
65e1a512a8still says the variables "clamp every buffer attribute the guest registers". It also sayssceVideoOutConfigureOutputanswersVIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE, and that "an unset, empty, malformed or zero value disables that axis".UNAVAILABLE_OUTPUT_MODE, and empty, malformed or zero values throw.main's history.ENVIRONMENT.mdsays every query throws.Output.cpp:376,result == VIDEO_OUT_ERROR_UNKNOWN_OUTPUT_MODE && VideoOutHostResolutionLimited()short-circuits. A malformed value is only read, and only throws, when a title asks for an unknown mode.ENVIRONMENT.md:609-610says "a malformed or zero value makes output-mode queries throw".sceVideoOutIsOutputSupported(or when the video out starts), asANYPS5_PAD_PORT0_STATEdoes, or change the rows to say "makes a query for an unknown output mode throw".9c758516fd/e9521cd7c2, before the threshold and throw logic existed.four-K, disabled and controls cases, but there is nocontrolstest.Not verified
guest_video_out_host_resolution_*tests orguest_video_out_output_modehere: they skip without a display. Their passing results come from the author, from maskym (Windows, 6/6 over three runs) and from TechLevelZero's NVIDIA CI on this head.RES: 1920x1080): it comes from screenshots, and I did not launch a title.To get this to a good state
ENVIRONMENT.mdwording (non-blocking finding 2).A run of the six tests on a machine with a display, together with the negative control, would let this be approved.