fix(libSceVideoOut): answer the cursor, flip status and pending-flip calls as measured on a PS5 #8927

Merged
ionut27001 merged 4 commits from upstream-pr/8927 into main 2026-10-27 01:57:02 +00:00
ionut27001 commented 2026-10-21 06:34:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ionut27001 on 2026-10-21T06:34:18Z.


What

Make the VideoOut cursor, flip-status and is-flip-pending calls return the values measured on a PS5 payload process (firmware 12.70):

  • GetFlipStatus on a fresh handle: ret 0, touches 128 bytes: bytes 24-31 (flipArg) and 56-59 (currentBuffer) are 0xff, every other byte is 0. With null buffer: ret 0x80290002, buffer untouched.
  • IsFlipPending on a fresh handle: returns 0.
  • SetFlipMaster (all argument shapes) on a fresh handle: returns 0x8029000b. ClearFlipMaster: returns 0x8029001c.
  • CursorSetPosition: returns 0 (success). CursorDisable: returns 0. CursorEnable(handle, 0, null): returns 0x80290002. CursorSetImageAddress(handle, 0, null): returns 0x80290002.
  • All of the above on an invalid handle (-1): return 0x8029000b, buffers untouched.

Moves the cursor and flip-fresh implementations from Unimplemented.cpp into Output.cpp (SetFlipMaster and ClearFlipMaster stay as stubs in Unimplemented.cpp; their values above are measurements only) and adds a guest test that pins every measured value.

Overlaps: #8784 adds assertions to core/libs/tests/GuestVideoOutCursor.cpp, which this PR removes (its cases expected all four cursor calls to throw on an unopened handle, which the measurement contradicts); whichever lands second rebases, and its two flip-master assertions can move into tests/Flip.cpp. #6977 declares the same four cursor exports as parameterless throwing stubs inside a much larger PS4-on-AGC change that already conflicts with main; this PR implements them with measured behaviour, so the two cannot both merge as they are. File overlaps only: #7814 and #4040 (Output.cpp, debt file), #7965 (debt file), #8418 and #6044 (Flip.cpp).

Tested

Windows 11, guest tests (video_out, videoout, flip): 29/29 pass twice; the new test (video_out_flip_fresh) passes directly with ANYPS5_VIDEO_OUT_TEST_DRIVER=windows twice. Revert check: removing the fix fails the new test as expected.

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
  • 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 (no GPU changes; cursor/flip logic is CPU-side)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4947439160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927). Originally posted by [ionut27001](https://github.com/ionut27001) on 2026-10-21T06:34:18Z. --- ### What Make the VideoOut cursor, flip-status and is-flip-pending calls return the values measured on a PS5 payload process (firmware 12.70): - **GetFlipStatus** on a fresh handle: ret 0, touches 128 bytes: bytes 24-31 (`flipArg`) and 56-59 (`currentBuffer`) are 0xff, every other byte is 0. With null buffer: ret 0x80290002, buffer untouched. - **IsFlipPending** on a fresh handle: returns 0. - **SetFlipMaster** (all argument shapes) on a fresh handle: returns 0x8029000b. **ClearFlipMaster**: returns 0x8029001c. - **CursorSetPosition**: returns 0 (success). **CursorDisable**: returns 0. **CursorEnable(handle, 0, null)**: returns 0x80290002. **CursorSetImageAddress(handle, 0, null)**: returns 0x80290002. - All of the above on an invalid handle (-1): return 0x8029000b, buffers untouched. Moves the cursor and flip-fresh implementations from Unimplemented.cpp into Output.cpp (SetFlipMaster and ClearFlipMaster stay as stubs in Unimplemented.cpp; their values above are measurements only) and adds a guest test that pins every measured value. Overlaps: #8784 adds assertions to `core/libs/tests/GuestVideoOutCursor.cpp`, which this PR removes (its cases expected all four cursor calls to throw on an unopened handle, which the measurement contradicts); whichever lands second rebases, and its two flip-master assertions can move into `tests/Flip.cpp`. #6977 declares the same four cursor exports as parameterless throwing stubs inside a much larger PS4-on-AGC change that already conflicts with `main`; this PR implements them with measured behaviour, so the two cannot both merge as they are. File overlaps only: #7814 and #4040 (`Output.cpp`, debt file), #7965 (debt file), #8418 and #6044 (`Flip.cpp`). ### Tested Windows 11, guest tests (video_out, videoout, flip): 29/29 pass twice; the new test (`video_out_flip_fresh`) passes directly with `ANYPS5_VIDEO_OUT_TEST_DRIVER=windows` twice. Revert check: removing the fix fails the new test as expected. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (no GPU changes; cursor/flip logic is CPU-side) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-21 06:35:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T06:35:12Z.


The current Conventions run fails only on the template checklist: Depends on: none, Fixes: none, and Unblocks: none are still unchecked. Please check those three boxes (or replace them with applicable values) and rerun; the rest of the current required checks shown are passing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309713084 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927#issuecomment-6309713084). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T06:35:12Z. --- The current Conventions run fails only on the template checklist: `Depends on: none`, `Fixes: none`, and `Unblocks: none` are still unchecked. Please check those three boxes (or replace them with applicable values) and rerun; the rest of the current required checks shown are passing.
ionut27001 commented 2026-10-21 06:38:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ionut27001 on 2026-10-21T06:38:45Z.


Checked the three boxes (all three are none) and corrected the flip-status byte description in the body (bytes 56-59 are 0xff as well, as the test pins).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309765290 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927#issuecomment-6309765290). Originally posted by [ionut27001](https://github.com/ionut27001) on 2026-10-21T06:38:45Z. --- Checked the three boxes (all three are none) and corrected the flip-status byte description in the body (bytes 56-59 are 0xff as well, as the test pins).
MarcZX10 commented 2026-10-21 06:41:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T06:41:16Z.


Thanks for checking the three checklist items and correcting the byte description. I verified the latest Conventions run now passes; the current required intake/report checks also pass. The remaining platform build jobs are skipped by the workflow for this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309801762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927#issuecomment-6309801762). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T06:41:16Z. --- Thanks for checking the three checklist items and correcting the byte description. I verified the latest Conventions run now passes; the current required intake/report checks also pass. The remaining platform build jobs are skipped by the workflow for this PR.
MarcZX10 commented 2026-10-21 06:51:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T06:51:39Z.


I checked the latest run: the follow-up conventions check passed after the earlier template failure. Thanks for fixing it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309957589 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927#issuecomment-6309957589). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T06:51:39Z. --- I checked the latest run: the follow-up conventions check passed after the earlier template failure. Thanks for fixing it.
harisibrar1 commented 2026-10-24 15:32:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:32:46Z.

Review: COMMENTED


Checked against main b607bfdc8b and the struct/error constants on main:

  • The error constants and the flip-status offsets match main (flipArg at 24 and currentBuffer at 56 in VideoOutFlipStatus; 0x80290002/0x8029000b in VideoOutDriver.hpp), and the check order in the new code matches each measured case. It needs a rebase: git merge-tree shows conflicts in all five shared files.
  • After rebasing: main's 61a44c79e2 gave sceVideoOutSetFlipMaster(handle, masterHandle) and sceVideoOutClearFlipMaster(handle) signatures (Unimplemented.cpp:10, :15) and removed the "declared without parameters, signatures unknown" debt line. The new flip-master debt line still says the shapes are unknown, so it would contradict main. Keeping the measured codes with the signatures main now has would fix that (main has no debt entry for these two stubs, so the line is still worth having).
  • Coverage note: guest_video_out_cursor runs with no skip code, but its replacement, video_out_flip_fresh, opens a port first, and the flip test's main() returns 77 when there's no Vulkan display. I couldn't run it, but reading the code, the handle -1 cursor checks would then be skipped on headless hosts. Running those checks before sceVideoOutOpen would keep them always on.
  • Small one: the closed-handle case the cursor debt line mentions ("answered like -1") isn't exercised by the test.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638796184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8927#pullrequestreview-5638796184). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T15:32:46Z. **Review:** COMMENTED --- Checked against main b607bfdc8b and the struct/error constants on main: - The error constants and the flip-status offsets match main (`flipArg` at 24 and `currentBuffer` at 56 in `VideoOutFlipStatus`; 0x80290002/0x8029000b in VideoOutDriver.hpp), and the check order in the new code matches each measured case. It needs a rebase: `git merge-tree` shows conflicts in all five shared files. - After rebasing: main's 61a44c79e2 gave `sceVideoOutSetFlipMaster(handle, masterHandle)` and `sceVideoOutClearFlipMaster(handle)` signatures (Unimplemented.cpp:10, :15) and removed the "declared without parameters, signatures unknown" debt line. The new flip-master debt line still says the shapes are unknown, so it would contradict main. Keeping the measured codes with the signatures main now has would fix that (main has no debt entry for these two stubs, so the line is still worth having). - Coverage note: `guest_video_out_cursor` runs with no skip code, but its replacement, `video_out_flip_fresh`, opens a port first, and the flip test's main() returns 77 when there's no Vulkan display. I couldn't run it, but reading the code, the handle -1 cursor checks would then be skipped on headless hosts. Running those checks before `sceVideoOutOpen` would keep them always on. - Small one: the closed-handle case the cursor debt line mentions ("answered like -1") isn't exercised by the test. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
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!8927
No description provided.