Skip to content

fix(libSceVideoOut): validate open parameters and resolution status outputs - #14106

Open
slopgobblercobbler wants to merge 1 commit into
boykopovar:mainfrom
slopgobblercobbler:fix/videoout-parameter-validation
Open

slopgobblercobbler wants to merge 1 commit into
boykopovar:mainfrom
slopgobblercobbler:fix/videoout-parameter-validation

Conversation

@slopgobblercobbler

@slopgobblercobbler slopgobblercobbler commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What

  • In core/libs/prx/libSceVideoOut/src/Output.cpp, return VIDEO_OUT_ERROR_INVALID_HANDLE from sceVideoOutGetResolutionStatus for unopened or closed handles matching console measurements, while retaining an exception for null status output pointers as unmeasured.
  • In core/libs/tests/GuestVideoOutResolutionStatus.cpp, assert VIDEO_OUT_ERROR_INVALID_HANDLE for unopened and closed handles, and verify null status output pointers reject with an exception.

Tested

  • Unit tests in core/libs/tests/GuestVideoOutResolutionStatus.cpp verify VIDEO_OUT_ERROR_INVALID_HANDLE on unopened and closed handles and exception rejection on null status pointers.
  • Verified python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings.

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: n/a
  • AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

The parameter-validation paths look consistent with the stated measurements, but the new null-attribute behavior is unmeasured and contradicts the repository rule for unknown behavior.

What I ran

Reviewed head f26371a44f658eea16d5e2382e39d05d98b863e4 against base e30f38577c79f16747eee745a145ff6b37a2dede; both PR-specific merge previews were clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0 (c++). No build or C++ tests were run.

git diff --check e30f38577c79f16747eee745a145ff6b37a2dede...f26371a44f658eea16d5e2382e39d05d98b863e4
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14106

Results

Check Result
Diff check Passed; no whitespace errors.
Conventions and PR template Passed.
Dependency and mergeability preview Passed; #14106 and its declared dependencies preview cleanly against current main.
ABI audit and test-quality helper Could not execute in the isolated PR worktree: these local-only helper scripts are not part of the PR checkout. This is not a product failure.
C++ tests/build Not run; initial review is no-build.
Hosted CI Pending at the final snapshot; no job result is claimed.
Unedited precheck output
All conventions checks passed.

Findings

Blocking

  • sceVideoOutSetBufferAttribute and sceVideoOutSetBufferAttribute2 now return successfully for null pointers (Buffer.cpp at the reviewed head, second helper). The debt entry calls this behavior unmeasured, while the repository instructs that unknown general behavior must throw and be recorded (AGENTS.md at the reviewed base). The test only invokes these void functions with null and does not establish what the console does. Please keep the throw until console behavior is measured, or add pinned measurement evidence and a regression assertion for the measured behavior.

Non-blocking

None found in the inspected diff.

Not verified

The C++ tests, build, console behavior, and pending hosted CI were not verified locally.

To get this to a good state

Either restore the throw for these unmeasured null cases or provide reproducible console evidence and test the measured result; I will rerun the same checks on the updated head.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@slopgobblercobbler thanks, turning the sceVideoOutOpen throws into VIDEO_OUT_ERROR_INVALID_VALUE returns reads right at f26371a44f, and guest_video_out_output_mode / guest_video_out_resolution_status pass here. Two things to fix:

  1. The open-parameter tests do not cover the priority and affinity rules. The description says the tests reject invalid priority/affinity masks, but the only open-parameter case added in GuestVideoOutOutputMode.cpp is invalidOpenParam[0] = 15, which hits the first-word check. The setPriority > 1 || setAffinity > 1, priority-range and affinity == 0 / unknown-bit returns in validateOpenParam are not reached by any test. Please add one case for each, on a param that has the valid first word 16 so the later rule is the one that fires.

  2. The sceVideoOutOpen debt entry dropped measured evidence. The rewrite removed the list of nine call sites with addresses (PPSA01494, PPSA03984, PPSA21564, PPSA30839, PPSA31162, PPSA34502 and the three bus-type-from-field calls) and the "Whether a non-null param continues past offset 24 is also unknown" gap, leaving "or with a bus type read from a field". That list is what shows which argument shapes real titles pass, so please keep it, and cut length elsewhere in the entry (the new text about invalid parameters can lead, as the length rule asks). The same applies to the sceVideoOutGetResolutionStatus entry, which lost the source of the 48-byte layout (the two third-party declarations cited there, Four open-source homebrew titles stop at start-up on unresolved imports (sysctl, pthread_set_name_np, isatty, mkstemp, signal sets, Opus decoders) #1578).

@slopgobblercobbler
slopgobblercobbler force-pushed the fix/videoout-parameter-validation branch from f26371a to cff4acf Compare October 31, 2026 20:01
@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Thank you @MarcZX10 and @oneandonlydean for the review and guidance!

I have addressed the feedback and rebased on \upstream/main\ in commit \cff4acf301:

  1. Restored throws on null buffer attribute:

    • Reverted the unmeasured null-attribute returns in \sceVideoOutSetBufferAttribute\ and \sceVideoOutSetBufferAttribute2\ back to throwing \std::runtime_error, preserving repository convention for unmeasured behavior until console measurements are made.
    • Removed the corresponding null-attribute functional debt entry from \docs/dev/debt/libSceVideoOut.md.
  2. Expanded open-parameter test coverage:

    • Extended \GuestVideoOutOutputMode.cpp\ with tests reaching each specific branch in \�alidateOpenParam\ with valid first word (16):
      • \setPriority > 1\ (2)
      • \setAffinity > 1\ (2)
      • \priority < HIGHEST\ (255)
      • \priority > LOWEST\ (768)
      • \�ffinity == 0\
      • Unknown affinity mask bits (\

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head cff4acf merged onto main 0836dfd · tested 2026-11-01 00:24 UTC · 13 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 859 passed · 2 failed (0 new, 2 also fail on main) · 0 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 861 of 3,087 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (420 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_lookup_log_fits_build 68.0 s, ⚠️ agc_driver_pipeline_journal 53.7 s, ⚠️ agc_driver_interpolation_modes 30.7 s
Failing on main too (2, not counted against this PR)
agc_driver_idle_store_yields
agc_driver_image_table
Validation IDs already present on main (5 IDs in 360 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (360 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 352 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Reproduce
git fetch origin cff4acf301ba1f7a352eec62a4852499d017b3af 0836dfdf4fecb1e0326100c490476e15d3a74da5
git checkout 0836dfdf4fecb1e0326100c490476e15d3a74da5 && git merge --no-ff cff4acf301ba1f7a352eec62a4852499d017b3af
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

The null-attribute throws are restored as requested, but sceVideoOutOpen and sceVideoOutGetResolutionStatus now return error codes for cases the debt file does not record as measured, which AGENTS.md says must throw and be recorded.

What I ran

  • Head cff4acf301ba1f7a352eec62a4852499d017b3af (the single rebased commit). Base for the precheck: 59bd3b677d67cb5cfdb4a0092ffe644d27cf1a56. The live stack check reports the PR as mergeable, and GitHub reports the merge state as clean.
  • No build, configure or compile.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14106 --output-dir /dev/shm/reviewer-run-20261101-14106
python3 tools/pr_abi_audit.py --repo . --base 59bd3b677d67cb5cfdb4a0092ffe644d27cf1a56 --head cff4acf301ba1f7a352eec62a4852499d017b3af --json
git archive cff4acf301ba1f7a352eec62a4852499d017b3af core/libs | tar -x -C <scratch dir>
python3 -I tools/pr_test_quality.py --root <scratch dir> --json core/libs/tests/GuestVideoOutOutputMode.cpp core/libs/tests/GuestVideoOutResolutionStatus.cpp
git show 59bd3b677d67cb5cfdb4a0092ffe644d27cf1a56:core/libs/prx/libSceVideoOut/src/Output.cpp
git show cff4acf301ba1f7a352eec62a4852499d017b3af:docs/dev/debt/libSceVideoOut.md

The precheck's ABI and test-quality helpers failed because the head tree has no tools/ directory, so both were run by hand as listed above.

Results

Check Result
Diff check Passed (precheck)
Conventions and PR template Passed (precheck)
Live dependency and mergeability Passed (precheck)
ABI audit (manual) Passed. The PR changes no exports; the audit covered 10 symbols with 0 findings
Test-quality heuristic (manual) Two possible-unregistered-cpp-test findings, both false positives: guest_video_out_output_mode_tests and guest_video_out_resolution_status_tests are registered in core/libs/prx/libSceVideoOut/CMakeLists.txt lines 253 and 240
Hosted CI at cff4acf301 Success: conventions, eligibility, library-portability, labels, report, windows. Skipped: linux, relinker, relinker-asan, write-watch, register-context
Build and C++ tests Not run (no-build rule)
Test-quality heuristic, unedited output (manual)
{
  "findings": [
    {
      "path": "core/libs/tests/GuestVideoOutOutputMode.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    },
    {
      "path": "core/libs/tests/GuestVideoOutResolutionStatus.cpp",
      "line": 1,
      "kind": "possible-unregistered-cpp-test",
      "message": "Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage."
    }
  ],
  "negative_control_candidates": [],
  "limits": [
    "Heuristics can miss weak assertions and can flag valid tests; inspect every finding.",
    "A test that passes against base is not by itself proof that the PR test is inadequate.",
    "Negative controls are only candidates until the test actually runs against base and fails by assertion rather than import/setup error."
  ]
}

Findings

Blocking

  1. sceVideoOutOpen now returns instead of throwing for unmeasured inputs. At head, an unknown userId, busType or index (Output.cpp lines 95-103) and every open-param check in validateOpenParam (lines 67-89) return VIDEO_OUT_ERROR_INVALID_VALUE. On main these paths threw std::runtime_error (Output.cpp in 59bd3b677d). The debt entry (docs/dev/debt/libSceVideoOut.md line 25) gives the return codes but cites no measurement, and it says that whether invalid parameters continue past offset 24 is unknown. AGENTS.md says that when general behaviour is unknown the code must throw and the gap goes in the debt file. Please restore the throws for these cases, or cite a measurement for each return code and pin it in a test.
  2. sceVideoOutGetResolutionStatus returns codes for a null output and an invalid handle, with no source. At head, a null output on an open handle returns 0x80290002 (line 223) and an invalid handle returns 0x8029000B (line 225). The debt entry (line 23) says these were confirmed on a PS5 at firmware 13.40, but unlike the other measurement claims in that file it has no link or capture. Please either link the measurement record for these codes, or restore the throws until it is linked.

Non-blocking

  • The null-attribute throws in sceVideoOutSetBufferAttribute and sceVideoOutSetBufferAttribute2 are restored, and their debt entry is removed. This addresses the request in my earlier review of this PR.
  • The new assertions in GuestVideoOutResolutionStatus.cpp pin the new codes. Whichever way item 2 is resolved, those assertions should follow the decision.

Sources

Permalinks, pinned to commits:

  • main before this PR, sceVideoOutOpen and its checks threw:
    throw std::runtime_error(std::string(__func__) + ": unsupported first word");
    }
    if (openParam.setPriority > 1 || openParam.setAffinity > 1) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
    }
    if (openParam.setPriority == 1 && (openParam.priority < VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST || openParam.priority > VIDEO_OUT_SERVICE_THREAD_PRIORITY_LOWEST)) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
    }
    if (openParam.setAffinity == 1) {
    std::memcpy(&openParam.affinity, static_cast<const std::byte*>(param) + offsetof(VideoOutOpenParam, affinity), sizeof(openParam.affinity));
    if (openParam.affinity == 0 || (openParam.affinity & ~VIDEO_OUT_SERVICE_THREAD_AFFINITY_ALL) != 0) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
    }
    }
    }
    extern "C" {
    int APS5_VABI sceVideoOutOpen(int userId, int busType, int index, const void* param) try {
    if (busType == VIDEO_OUT_BUS_TYPE_HMD2_MAIN) return VIDEO_OUT_ERROR_INVALID_VALUE;
    validateOpenParam(param);
    if (userId != 255 && userId != 0) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
    }
    if (busType != VIDEO_OUT_BUS_TYPE_MAIN && busType != VIDEO_OUT_BUS_TYPE_OVERLAY && busType != VIDEO_OUT_BUS_TYPE_SUB) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
    }
    if (index != 0) {
    throw std::runtime_error(std::string(__func__) + ": VIDEO_OUT_ERROR_INVALID_VALUE");
  • Head, the same checks now return:
    static int validateOpenParam(const void* param) {
    if (param == nullptr) return 0;
    VideoOutOpenParam openParam{};
    std::memcpy(&openParam, param, offsetof(VideoOutOpenParam, affinity));
    if (openParam.firstWord != VIDEO_OUT_OPEN_PARAM_FIRST_WORD) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    if (openParam.setPriority > 1 || openParam.setAffinity > 1) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    if (openParam.setPriority == 1 && (openParam.priority < VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST || openParam.priority > VIDEO_OUT_SERVICE_THREAD_PRIORITY_LOWEST)) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    if (openParam.setAffinity == 1) {
    std::memcpy(&openParam.affinity, static_cast<const std::byte*>(param) + offsetof(VideoOutOpenParam, affinity), sizeof(openParam.affinity));
    if (openParam.affinity == 0 || (openParam.affinity & ~VIDEO_OUT_SERVICE_THREAD_AFFINITY_ALL) != 0) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    }
    return 0;
    }
    extern "C" {
    int APS5_VABI sceVideoOutOpen(int userId, int busType, int index, const void* param) try {
    if (busType == VIDEO_OUT_BUS_TYPE_HMD2_MAIN) return VIDEO_OUT_ERROR_INVALID_VALUE;
    const int paramStatus = validateOpenParam(param);
    if (paramStatus != 0) return paramStatus;
    if (userId != 255 && userId != 0) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    if (busType != VIDEO_OUT_BUS_TYPE_MAIN && busType != VIDEO_OUT_BUS_TYPE_OVERLAY && busType != VIDEO_OUT_BUS_TYPE_SUB) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
    if (index != 0) {
    return VIDEO_OUT_ERROR_INVALID_VALUE;
    }
  • Head, sceVideoOutGetResolutionStatus returns for a null output and an invalid handle:
    int APS5_VABI sceVideoOutGetResolutionStatus(int handle, VideoOutResolutionStatus* status) try {
    const bool open = VideoOutDriver::Get().HasConfig(handle) && VideoOutDriver::Get().IsOpen(handle);
    if (status == nullptr) {
    if (!open) {
    throw std::runtime_error(std::string(__func__) + ": a null output with an invalid handle is not measured");
    }
    return VIDEO_OUT_ERROR_INVALID_ADDRESS;
    }
    if (!open) return VIDEO_OUT_ERROR_INVALID_HANDLE;
  • Head, the debt entries for both functions:
    - [sceVideoOutGetResolutionStatus](../../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - a null output with an invalid handle throws as unmeasured; a PS5 (firmware 13.40, measured 2026-10-19 inside a retail title) confirmed 0x8029000B for handles 0 to 8, while a null output on an open handle returns 0x80290002. `screenSizeInInch` is 0 (undefined in EDID) vs console TV's 60.0f. The 48-byte layout, from declarations in ps5-opengl and EVO-PLAYER-PS5 (#1578), is confirmed: full size and pane 3840 x 2160, `refreshRate` 3, `flags` 0 and the rest 0 on the title's handle. `flags` is 0 here too; its bits are unknown. The pane equals the full size because `sceVideoOutSetWindowModeMargins` applies no margins
    - [sceVideoOutGetOutputStatus](../../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - the status after a buffer is registered, a 1440p output and a display below 4K with the console's resolution on Automatic were not measured. A payload process on a PS5 (firmware 12.70) with no buffer registered reported `resolution` 2 right after `sceVideoOutOpen(0xff, 0, 0, NULL)` with the console's resolution on Automatic on a 4K display and 1 with it set to 1080p, and `dynamicRange` 2 with `flags` 0 on an HDR display with HDR on, while this code sets flag bit 0 whenever it reports dynamic range 2. `resolution` is 2 when the current display mode SDL reports for the window's display is at least 3840 pixels wide or 2160 high and 1 otherwise, read with the refresh rate and independent of the registered buffers; on Wayland SDL's mode is the output's logical size (from SDL's source, not run), so a scaled 3840x2160 output reports 1. `APS5_OUTPUT_RESOLUTION` replaces that size
    - [sceVideoOutOpen](../../../core/libs/prx/libSceVideoOut/src/Output.cpp) (libSceVideoOut) - invalid userId, busType, busIndex or open param return VIDEO_OUT_ERROR_INVALID_VALUE (0x80290001); whether invalid parameters continue past offset 24 is unknown. The open param's first word is unknown (PPSA21564 passes 16; not byte size); only 16 is accepted. PPSA26344's call at 0xCCF5EA passes (0xFF, 0, 0, nullptr). Disassembled calls: PPSA18194 01.004.003 (0xABA44D) and PPSA21564 01.007.000 (0x2A0E65) pass stack params with words 16, 0, 0, 1 (affinity 0x3E) or 16, 1, 256, 1 (affinity 0x1FFF). Nine calls pass no param: (0xFF, 0, 0, nullptr) (PPSA01494 0x26C661A, PPSA03984 0x4FAD792, PPSA21564 0x464783, PPSA30839 0x4D60AB, PPSA31162 0x54D3CB, PPSA34502 0x62AECA) or with bus type from a field (PPSA01494 0x2197A25, PPSA30839 0x54C6845, PPSA31162 0x69310F5)
  • Rule that unknown behaviour throws and is recorded in the debt file, AGENTS.md:
    - Implement the function for every input. Never special-case a value, ID or path seen in one title's trace; if the general behaviour is unknown, throw and record it in `docs/dev/debt/<library>.md`.

Not verified

  • No build and no C++ test run at cff4acf301. The new GuestVideoOutOutputMode and GuestVideoOutResolutionStatus assertions were not run.
  • The PS5 measurement described in the debt entry was not checked, because no link or capture is given.
  • The ABI audit is lexical and was not confirmed by a compiler or the build.
  • Linux and relinker jobs are skipped on this head; the Windows job is the only product-side hosted result.

To get this to a good state

Restore the throws for the unmeasured sceVideoOutOpen and null-output cases, or add the measurement links and keep the returns with the debt text updated to match. I will rerun the same checks on the updated head.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@slopgobblercobbler
slopgobblercobbler force-pushed the fix/videoout-parameter-validation branch from cff4acf to 0a14584 Compare November 1, 2026 14:21
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 0a14584 merged onto main f2d874c · tested 2026-11-01 23:24 UTC · 22 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 878 passed · 3 failed (0 new, 2 also fail on main, 1 unstable on main) · 0 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 881 of 3,168 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (429 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ agc_driver_lookup_log_fits_build 101.7 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (2, not counted against this PR)
agc_driver_dcc_keys_first_write
agc_driver_image_table
Validation IDs already present on main (5 IDs in 368 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (368 tests): agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, agc_driver_bindless_images, and 360 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Reproduce
git fetch origin 0a145847d4a3a3c2f2dbd3753a8f5f6e7814b30c f2d874c1fdccf781c0fa5d86619bb5dd8894b958
git checkout f2d874c1fdccf781c0fa5d86619bb5dd8894b958 && git merge --no-ff 0a145847d4a3a3c2f2dbd3753a8f5f6e7814b30c
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates; the test coverage of each validateOpenParam branch and the restored debt evidence look good. Two points from the earlier review are still open (same as @MarcZX10's last review):

  • sceVideoOutOpen (Output.cpp:112-142): on main these cases threw because the console's answer isn't known. The debt entry now states VIDEO_OUT_ERROR_INVALID_VALUE but cites no measurement for the invalid userId, bus type, bus index or open-param cases, and the references we checked (KytyPS5, shadPS4) don't establish them. Either link a console measurement for each case (title/firmware/capture) and keep the returns, or restore the throws and record the gap in docs/dev/debt/libSceVideoOut.md.
  • sceVideoOutGetResolutionStatus (Output.cpp:276-283): the debt entry says a null output on an open handle returning 0x80290002 was confirmed on a PS5 (13.40), but gives no link or capture; only 0x8029000B for handles 0-8 was measured before. Please link the record for the null-output case, or keep the throw for it. The 0x8029000B path is fine as is, and the test assertions should follow whichever way this goes.

@adam25136

Copy link
Copy Markdown
Contributor

video_out_flip_controls fails with this change and passes on main: head 0a145847d4 merged into main 090f57166a (git merge --no-ff, clean merge).

GPU NVIDIA GeForce RTX 5080 (10de:2c02), driver 621.14 (32.0.16.2114), Vulkan 1.4.357
Host Windows 10 Pro 22H2 (19045), i9-12900KF, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS off (the default)
Selection 1,001 tests, chosen by tools/select_tests.py select for the 4 changed files
Run select_tests.py ctest build --parallel 4 --timeout 120 with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; main 090f57166a ran its full suite (4,495 tests) the same way on this machine
Result 999 passed, 1 skipped, 1 failed, 1 new (video_out_flip_controls)
Validation The 109 tests of the selection that ran and match ^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu, again with VK_LAYER_KHRONOS_validation 1.4.367 (the Khronos nightly built from 3baa2b8), ctest -V --parallel 4, implicit layers disabled; main ran its 1,491 the same way. None of these 109 logs a validation message, and they log none on main either (its 61 messages are in 13 tests outside this selection). video_out_flip_controls fails under the layer too

video_out_flip_controls:

  • With the change: it fails with expected an exception within 0.05 s, before it opens a device, in all 6 runs here (the selection run, 3 reruns, the run under the layer and one more by hand). It passes on main 090f57166a here.

  • With only this PR's Output.cpp change reversed (its two test files kept): it passes.

  • The cause, read from the code: testControls first runs testOpenParam, which passes 8 invalid open parameters to sceVideoOutOpen inside expectFailure. expectFailure throws expected an exception when the call returns instead of throwing, and this PR makes those calls return VIDEO_OUT_ERROR_INVALID_VALUE. testOpenParam is the same at this PR's fork point ac26e59d9a.

  • Not in the other runs on this head: the hosted windows job ran only 2 tests, neither of them video_out_flip_controls, and the logs linked from the NVIDIA bot's report have no video_out test.

  • The tests in the files the description names: guest_video_out_output_mode and guest_video_out_resolution_status pass; under the layer each selects the RTX 5080.

  • Failures that are main's: none; the one failure in this run is new.

  • Skips: guest_video_out_wqhd_detection_no_vulkan, which also skips on main here.

Reproduce (ac26e59d9a is where this PR branches from main; the first ctest fails, the second passes):

git fetch origin pull/14106/head && git checkout 090f57166a && git merge --no-ff --no-edit FETCH_HEAD
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON && cmake --build build && cmake --build build --target libs
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^video_out_flip_controls$' --output-on-failure
git diff ac26e59d9a FETCH_HEAD -- core/libs/prx/libSceVideoOut/src/Output.cpp | git apply -R
cmake --build build --target video_out_flip_tests libs
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R '^video_out_flip_controls$' --output-on-failure
git checkout -- core/libs/prx/libSceVideoOut/src/Output.cpp

Not covered here: a title, Linux and macOS.

AI-assisted: yes. Claude Code ran the builds and tests and drafted this comment; a separate review agent checked it. The numbers are from the runs on this machine, except the hosted job's and the bot's, which are from their logs.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@slopgobblercobbler I reviewed 0a14584. The accepted inputs are unchanged and the earlier test and provenance gaps are fixed, but two things still block it.

  1. The new INVALID_VALUE returns for invalid userId, bus type, index and open param have no console measurement behind them. The repo rule is that unmeasured behaviour throws. Either cite a capture for each return, or restore the throws for the unmeasured cases. The 0x8029000B return for never-opened handles is measured, so keep that one. adriadam10 and MarcZX10 have both raised this.
  2. video_out_flip_controls fails on Windows (6/6 runs, reported by adam25136) and passes on main. testOpenParam in libSceVideoOut/tests/Flip.cpp still expects the old throws, and this PR does not touch that file. I did not rerun it myself, but it matches the diff. Restoring the throws for the unmeasured cases would also fix this test.

Also, the debt entry calls the null output on an open handle returning 0x80290002 "confirmed on PS5 13.40", but links no capture. Please link it.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The review covers the four changed files at head 0a145847d4a3a3c2f2dbd3753a8f5f6e7814b30c; no checks were run, and no concrete blocking defect was verified.

What I ran

  • Read the prepared description, commit summary, manifest and diff for the exact head above.
  • Read all changed files listed in the manifest. Read targeted function and test context through repo_read.py; no build, tests or other checks were run.

Results

Check Result Note
Changed-file review passed All four changed files were read
Build and tests not run No commands were run
Console behavior not run Hardware measurements were not confirmed

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

Build and test results reported in the PR description were not independently confirmed. Console measurements and behavior were not independently confirmed. No files were excluded: all four files marked reviewed in manifest.json were read; files.json was not inspected.

To get this to a good state

Nothing is required.

@slopgobblercobbler
slopgobblercobbler force-pushed the fix/videoout-parameter-validation branch from 0a14584 to f478ad1 Compare November 16, 2026 23:07
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 16, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — changes requested

Changes are required before merge: restore the null-attribute behavior described in the PR, or remove that claim from the scope if it was not intended for this change.

What I ran

Reviewed head f478ad158b80fa1fc6a5a76b4a741c03cd364b7f from the prepared diff and pinned repository source using repo_read.py. No commands or tests were run.

Results

Check Result Note
Diff and changed files passed Four files included and read
Tests not run No test commands run
Reader context passed Targeted source ranges read

Findings

Blocking

  • The PR description says sceVideoOutSetBufferAttribute and sceVideoOutSetBufferAttribute2 now return early on null pointers without modifying memory, but the prepared manifest and diff contain no Buffer.cpp change. At this head, both functions still throw on null (Buffer.cpp:127-130, 191-194), so the stated behavior is not implemented. Add the guards and suitable coverage, or revise the scope if these changes were not intended. The changed-line citation for the scope mismatch is docs/dev/debt/libSceVideoOut.md:37, which documents the changed sceVideoOutOpen behavior; no changed line for Buffer.cpp exists in the supplied diff.

Non-blocking

  • None.

Sources

Not verified

  • Tests and builds were not run.
  • files.json was not accessible through the reader; manifest lists four included changed files, all of which were read. The changed-file manifest and diff do not include Buffer.cpp.
  • Console behavior beyond the measurements recorded in the repository was not independently verified.

To get this to a good state

Implement and test the null attribute handling described in the PR, or update the PR description and related claims to match the intended scope. Rerun the relevant tests on the updated head.

@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

Rebased onto latest upstream/main (commit 9e98beb) and addressed all maintainer feedback from @oneandonlydean and @MarcZX10:

  1. Restored unmeasured sceVideoOutOpen / validateOpenParam throws: Reverted unmeasured VIDEO_OUT_ERROR_INVALID_VALUE returns back to std::runtime_error throws, ensuring testOpenParam in Flip.cpp (video_out_flip_controls) passes as on main.
  2. Retained exception on null status output: Kept std::runtime_error rejection when status == nullptr in sceVideoOutGetResolutionStatus as unmeasured.
  3. Preserved measured VIDEO_OUT_ERROR_INVALID_HANDLE: Unopened and closed handles in sceVideoOutGetResolutionStatus return VIDEO_OUT_ERROR_INVALID_HANDLE (0x8029000B), matching hardware measurements recorded in docs/dev/debt/libSceVideoOut.md and verified in GuestVideoOutResolutionStatus.cpp.
  4. Cleaned PR scope: Updated PR description and dropped unrelated Buffer.cpp and open-parameter claims.
  5. Conventions: Verified 0 findings with python tools/check_conventions.py --base upstream/main --head HEAD.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The changed resolution status path now returns the invalid handle code for unopened or closed handles, and its null-pointer behavior remains the documented unmeasured exception.

What I ran

Reviewed head 9e98beb1e424264373e0ccbbb4b9b3a02c7a703a using repo_read.py. No tests or prechecks were run; no merged-preview check was performed.

Results

Check Result Note
Source review passed Both changed files read
Tests and precheck not run Only author-reported in description
Merged preview not run No merge check performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

The unit tests and conventions check reported in the PR description were not run during this review. No hardware or console measurements were performed. The review bundle’s files.json was unavailable; the manifest lists both changed files as included, and both full source files were read.

To get this to a good state

Nothing is required.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head 9e98beb1e4, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#24470, #24601, #17439, #17546, #21117, #21261, #21741, #21995, #22067, #22398, #23111, #23346, #23864, #24377, #24475, #24556, #14109, #19966, #20050, #20161, #20622, #21237, #22215, #22764, #22884, #22938, #23745, #24399, #24460). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_video_out_resolution_status (1 test, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6525 tests) on the RTX 3080 has 5 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Traced to other PRs of the batch, each by reverting it and testing again: #21117 (guest_pad); none is in this PR's area. The 2125 agc_/video tests on the iGPU have 1 failing: agc_driver_stencil_plane_memory (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trial merge onto c1601e56d5 was clean. HasConfig, IsOpen, and GetConfig acquire and release the driver lock separately, and IsOpen itself calls the throwing GetConfig. A close between the checks can therefore still throw the invalid-handle error this change is meant to return. Please use one lookup that returns the live configuration or the guest error, then check closing under its mutex before filling the output. The current fixture checks handles before and after close sequentially. Paired display-backed controls are pending.

AI-assisted: yes.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants