Skip to content

fix(libSceVideoOut): answer the flip-master calls as measured on a PS5 - #11853

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
ionut27001:fix/wf-videoout-flipmaster-measured-codes
Oct 29, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
ionut27001:fix/wf-videoout-flipmaster-measured-codes

Conversation

@ionut27001

@ionut27001 ionut27001 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What

sceVideoOutSetFlipMaster and sceVideoOutClearFlipMaster were NotImplemented_nid_no_patch stubs in Unimplemented.cpp, so every call aborted the guest, including the calls whose console answers are already recorded in the debt entry.

The evidence is the existing debt entry and the description of #8927 (#8927): measured in a payload process on a PS5 (firmware 12.70) on a handle from sceVideoOutOpen(0xff, 0, 0, NULL) with no buffer registered, SetFlipMaster with (handle), (handle, 0) and (handle, 1) returned 0x8029000B, ClearFlipMaster(handle) returned 0x8029001C, and both returned 0x8029000B for handle -1. I have no raw log of that run beyond those two texts. #8927 measured these values but left both stubs in Unimplemented.cpp; its description noted that flip-master assertions could go in tests/Flip.cpp.

This change moves both into src/Output.cpp:

  • SetFlipMaster returns 0x8029000B for a handle that is not open, and for an open handle that has never had buffers registered with master handle 0 or 1. Any other master handle still throws, since a real master handle was not measured.
  • ClearFlipMaster returns 0x8029000B for a handle that is not open and 0x8029001C for an open handle that has never had buffers registered. The name of 0x8029001C is not known; the constant is named by its value.
  • Both still throw on a handle that has had buffers registered, including one whose buffers were unregistered again, since only the fresh state was measured. VideoOutConfig gets a buffersEverRegistered flag, set when a buffer group is registered and never cleared.

Still open, recorded in the debt entry: what flip-master ownership means, the signatures sceVideoOutSetFlipMaster(handle, masterHandle) and sceVideoOutClearFlipMaster(handle) (taken from the declarations, unverified), a handle that has had buffers registered, a closed handle (answered like -1), and a real master handle. PPSA29866 imports both functions; I have not confirmed that it calls them.

Overlaps: an open-PR search for SetFlipMaster, ClearFlipMaster, flip master and flip-master finds only #11709 (docs-only, mine), a rewrite of the same debt line to state the signatures. This PR supersedes #11709: it keeps the same signature wording and also implements the measured codes, and #11709 will be closed if this one is opened. #6447, which made both stubs return success, is closed. No open PR changes the behaviour of either function.

Tested

Windows 11, WinLibs GCC 15.2.0, on main at 62b3ba2 (rebased; the 17 video_out_flip_* tests rerun there):

  • With this change: all 17 video_out_flip_* tests pass, twice. video_out_flip_fresh now checks (handle, 0) and (handle, 1) and (-1, 0) for SetFlipMaster and handle and -1 for ClearFlipMaster on a fresh handle, and that both throw after a buffer is registered on that handle and again after it is unregistered. The one-argument (handle) shape cannot be written against the two-argument declaration and is not tested.
  • Revert check: with Output.cpp and Unimplemented.cpp from main, video_out_flip_fresh fails, because SetFlipMaster throws. With Output.cpp from the previous revision of this PR (measured codes for every open handle), video_out_flip_fresh fails, because the handle with a registered buffer is answered instead of throwing.
  • Validation (previous revision; the follow-up commit touches no GPU state): the 17 video_out_flip_* tests on main and on this change, with ctest -V, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1 (layer from Vulkan SDK 1.4.363.0 via VK_ADD_LAYER_PATH). All pass on both. 16 of the 17 tests create a Vulkan device; in each, the loader log (VK_LOADER_DEBUG=layer) shows the validation layer inserted. Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS or any VUID- message. The two calls this PR changes touch no GPU state.

Not tested on Linux, nor with a title.

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 4080 SUPER, driver 621.01, Windows 11
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9880 docs/dev/debt/libSceVideoOut.md L12
PR 12721 docs/dev/debt/libSceVideoOut.md L11-12

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4040 core/libs/prx/libSceVideoOut/src/Output.cpp
docs/dev/debt/libSceVideoOut.md
PR 5021 core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 6977 core/libs/prx/libSceVideoOut/Unimplemented.cpp
core/libs/prx/libSceVideoOut/include/VideoOutDriver.hpp
core/libs/prx/libSceVideoOut/src/Buffer.cpp
core/libs/prx/libSceVideoOut/tests/Flip.cpp
docs/dev/debt/libSceVideoOut.md
PR 9432 core/libs/prx/libSceVideoOut/Unimplemented.cpp
core/libs/prx/libSceVideoOut/include/VideoOutDriver.hpp
core/libs/prx/libSceVideoOut/src/Buffer.cpp
core/libs/prx/libSceVideoOut/tests/Flip.cpp
docs/dev/debt/libSceVideoOut.md
PR 9891 core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 9892 core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 9893 core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 9895 core/libs/prx/libSceVideoOut/tests/Flip.cpp

@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.

The measured results and the paired Vulkan validation runs are useful, and I verified the implementation follows the measured fresh-handle cases. One blocking scope issue remains: the only console measurements are for a newly opened handle with no buffers registered, but sceVideoOutClearFlipMaster returns 0x8029001C for every open handle, and sceVideoOutSetFlipMaster returns the measured invalid-handle code for every open handle with master 0 or 1. The debt entry explicitly says behavior with registered buffers is unmeasured. The project rule says unknown general behavior must not be guessed. Please either add console evidence for the registered-buffer state or make that unmeasured state throw and record it as such, with a regression test for the boundary. Current main is the tested base and the touched paths have not changed since; I did not independently run the Windows/Vulkan suite.

@ionut27001
ionut27001 force-pushed the fix/wf-videoout-flipmaster-measured-codes branch from d3a2a7e to 7af0c1d Compare October 27, 2026 12:48
@ionut27001

Copy link
Copy Markdown
Contributor Author

@MarcZX10 I limited the measured codes to the measured state.

  • SetFlipMaster (master 0 or 1) and ClearFlipMaster return the measured codes only on an open handle that has never had buffers registered. On a handle that has had buffers registered, including one whose buffers were unregistered again, both throw via NotImplemented_nid_no_patch as before.
  • VideoOutConfig has a buffersEverRegistered flag, set when a buffer group is registered and never cleared.
  • video_out_flip_fresh now registers a buffer on the fresh handle and checks that both calls throw, then unregisters it and checks that they still throw. All 17 video_out_flip_* tests pass twice; with the previous Output.cpp the fresh test fails.
  • The debt entry and the PR description now list the registered-buffer state as unmeasured and throwing.
  • Rebased onto current main (62b3ba2), which had changed other libSceVideoOut files; the 17 tests pass twice there too.

@adriadam10 adriadam10 self-assigned this Oct 28, 2026
@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 28, 2026 17:23

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@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.

Re-reviewed — approved

The author now limits the measured return values to fresh handles and keeps unmeasured buffer-registered states on the explicit not-implemented path.

What I checked

  • Reviewed exact head 7af0c1dc60d0b1b1324349870df030323feb0848 against live main 10bec5c322eb581b3e959e6c7e18bcf09e068e96.
  • SetFlipMaster returns the measured invalid-handle code for invalid handles and for a fresh handle with master 0 or 1; other master values throw. ClearFlipMaster returns the measured 0x8029001C only for a fresh handle; invalid handles return the measured invalid-handle code.
  • buffersEverRegistered is set after registration validation under the config mutex and is not cleared when buffers are unregistered. Both functions check that state under the same mutex, so the formerly unmeasured registered-then-unregistered state continues to throw.
  • The debt entry now identifies the signature and behavior gaps as unverified. Current-main merge preview is clean; conventions and diff check pass.

Results

Check Result
Current-main merge preview Clean (d18747d5b6bc83757d0a7b5d24d704e191a2e487)
Diff check Pass; no output
Conventions Pass
Focused Windows tests Author reports 17 video_out_flip_* tests passed twice on Windows 11/GCC 15.2 on the PR's stated base
Negative control Author reports the old main implementation fails the fresh-handle assertion; the previous broad-return revision fails the new post-registration throw assertions
Vulkan validation Author reports the previous functional revision passed on main and the change with no VUIDs; the follow-up is stated not to touch GPU state
Hosted checks Windows, conventions, labels, eligibility, and report pass; Linux and specialized product jobs skipped
Raw local output
merge-base: 62b3ba2522b38543b50cbc4b7093c9ab8fdfb5df
merge-tree: d18747d5b6bc83757d0a7b5d24d704e191a2e487
All conventions checks passed.
git diff --check: no output (pass)

Negative control

The author reports both the baseline failure and the boundary regression against the previous revision. I did not independently run either control.

Findings

Blocking

None found in the measured fresh-handle cases or the explicit unknown-state paths.

Non-blocking

The focused runtime and Vulkan results are author-reported and predate the current live main refresh. I did not run CTest locally. The one-argument call shape and behavior after buffer registration remain explicitly unverified and are recorded as debt; the implementation does not claim those cases are supported.

Sources

Not verified

I did not run CTest, Vulkan validation, Linux, a title, or console behavior locally. The test reports and PS5 measurements come from the author. The test runs were on the stated earlier base, not on live main.

To get this to a good state

No further change is required for the measured fresh-handle behavior. Keep the unmeasured signature and registered-buffer behavior documented until console evidence is available.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@ionut27001 The fresh-handle restriction now keeps unmeasured buffer states on the production refusal path. Please remove the four new expectFailure assertions in Flip.cpp:1081-1082 and :1084-1085 that require registered/previously registered handles to throw not implemented. Those are unsupported valid states, so the tests must not pin the current refusal. Keep the production guard/throw, measured fresh and invalid-handle checks, and remove any setup that becomes unused. Then rerun video_out_flip_fresh and the affected registration/reopen tests.

@adriadam10 Keeping you in the loop as the assigned maintainer; this is a draft review request, with coordination still with your lane.

@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.

Re-reviewed exact head 7af0c1dc60d0b1b1324349870df030323feb0848. The production guard still correctly leaves buffer-registered states unimplemented, but the four new expectFailure assertions in Flip.cpp pin valid registered and previously-registered handle states to throwing. Please remove those assertions and any setup used only by them, retaining the production guard and measured fresh-handle/invalid-handle coverage; rerun the focused video_out_flip* tests on the resulting head. The current-main merge preview is clean; diff check and conventions pass. I did not run the GPU tests locally.

@adriadam10
adriadam10 merged commit b9246db into boykopovar:main Oct 29, 2026
11 of 12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff against the measured values in the debt entry and #8927: both calls answer only the measured fresh-handle state (0x8029000B for an invalid handle or master 0/1, 0x8029001C for ClearFlipMaster) and still throw for a handle that ever had buffers registered and for other master handles. buffersEverRegistered is set under the config mutex, video_out_flip_fresh covers the fresh, registered and unregistered cases and fails on main, the debt entry is updated, and Windows CI is green; merged.

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.

4 participants