fix(libSceVideoOut): overlay-bus flips no longer replace the main output #2142

Merged
MathiasDevelopes merged 2 commits from upstream-pr/2142 into main 2026-10-10 07:01:38 +00:00
MathiasDevelopes commented 2026-10-09 09:55:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-09T09:55:50Z.


What

sceVideoOutOpen accepts the overlay bus (busType 1), and each bus gets its own port. [VideoOutDriver::processFlip](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp) presented every flip on every port as a whole frame in the one window. A title that flips both a main and an overlay port therefore made the window alternate between the two buses.

Planet Coaster (PPSA01736) opens both. Traced with temporary logging in sceVideoOutOpen and sceVideoOutRegisterBuffers2:

sceVideoOutOpen bus 0 index 0 -> handle 1
RegisterBuffers2 handle 1 set 0 start 0 num 2 first 0x327c00000
sceVideoOutOpen bus 1 index 0 -> handle 2
RegisterBuffers2 handle 2 set 0 start 0 num 2 first 0x329000000

It shows its intro on the main bus and leaves the overlay empty, and it flips both every frame. Without this change, the intro blinks black on every other frame. In 373 presented frames dumped with APS5_DUMP_FRAMES, the picture switched between black and image 178 times, and every black frame was a flip of the overlay buffers at 0x329000000/0x329a00000.

Overlay-bus flips now complete like main-bus flips. They still wait for their vblank and flip rate, and they signal the flip event, flip status, flip arg and buffer reuse as before. They no longer reach the presenter. The port remembers its bus type from sceVideoOutOpen. Main and sub bus flips are presented as before.

Because an overlay flip is not presented, it is marked GPU-complete without waiting for the GPU work that rendered into its buffer, which the present path does for a shown buffer. The buffer is never read for display, so the only effect is that the title may get the buffer back for reuse earlier than after a real present.

Compositing the overlay over the main output is not implemented. It is recorded in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#functional), so a title that draws UI on the overlay will not show it yet. No public reference I found describes how the PS5 composites the overlay bus. [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/videoout/video_out.cpp) supports only the main bus and asserts on any other.

Tested

Windows 11, MinGW-w64 15.2.0, RTX 3060.

  • New video_out_flip_tests overlay case. It opens a main and an overlay port, flips the main port and waits for a present, then flips the overlay twice. Both overlay flips complete with the right flip arg and buffer, and VulkanDevice::PresentCounts().presents does not change. A later main-bus flip is presented again. Without the change, it fails with an overlay-bus flip replaced the main output.
  • The existing present, backtoback and controls modes still pass. video_out_flip_tests opens a real window and is not registered with ctest (it is in KNOWN_UNRUN), so I ran these modes by hand. If #1048 or #1575 registers the flip tests, the overlay mode should be added there. The default lifetime mode crashes on unmodified main as well.
  • Full ctest suite: 494/494 passed. tools/check_conventions.py --base origin/main passes.
  • PPSA01736: with the change, the same 60-second capture switches between black and image 4 times in 194 frames, only at the title's own fades, and the intro plays without blinking. Both captures were taken on a build that also has the other fixes the title needs to reach its intro: #1782, #1775, #1777, #1836, #1673 and some local commits.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798864566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2142). Originally posted by [MathiasDevelopes](https://github.com/MathiasDevelopes) on 2026-10-09T09:55:50Z. --- ### What `sceVideoOutOpen` accepts the overlay bus (`busType` 1), and each bus gets its own port. [`[VideoOutDriver::processFlip](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp)`](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp) presented every flip on every port as a whole frame in the one window. A title that flips both a main and an overlay port therefore made the window alternate between the two buses. Planet Coaster (PPSA01736) opens both. Traced with temporary logging in `sceVideoOutOpen` and `sceVideoOutRegisterBuffers2`: ``` sceVideoOutOpen bus 0 index 0 -> handle 1 RegisterBuffers2 handle 1 set 0 start 0 num 2 first 0x327c00000 sceVideoOutOpen bus 1 index 0 -> handle 2 RegisterBuffers2 handle 2 set 0 start 0 num 2 first 0x329000000 ``` It shows its intro on the main bus and leaves the overlay empty, and it flips both every frame. Without this change, the intro blinks black on every other frame. In 373 presented frames dumped with `APS5_DUMP_FRAMES`, the picture switched between black and image 178 times, and every black frame was a flip of the overlay buffers at `0x329000000`/`0x329a00000`. Overlay-bus flips now complete like main-bus flips. They still wait for their vblank and flip rate, and they signal the flip event, flip status, flip arg and buffer reuse as before. They no longer reach the presenter. The port remembers its bus type from `sceVideoOutOpen`. Main and sub bus flips are presented as before. Because an overlay flip is not presented, it is marked GPU-complete without waiting for the GPU work that rendered into its buffer, which the present path does for a shown buffer. The buffer is never read for display, so the only effect is that the title may get the buffer back for reuse earlier than after a real present. Compositing the overlay over the main output is not implemented. It is recorded in [[TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#functional)](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#functional), so a title that draws UI on the overlay will not show it yet. No public reference I found describes how the PS5 composites the overlay bus. [[shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/videoout/video_out.cpp)](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/videoout/video_out.cpp) supports only the main bus and asserts on any other. ### Tested Windows 11, MinGW-w64 15.2.0, RTX 3060. - New `video_out_flip_tests overlay` case. It opens a main and an overlay port, flips the main port and waits for a present, then flips the overlay twice. Both overlay flips complete with the right flip arg and buffer, and `VulkanDevice::PresentCounts().presents` does not change. A later main-bus flip is presented again. Without the change, it fails with `an overlay-bus flip replaced the main output`. - The existing `present`, `backtoback` and `controls` modes still pass. `video_out_flip_tests` opens a real window and is not registered with ctest (it is in `KNOWN_UNRUN`), so I ran these modes by hand. If #1048 or #1575 registers the flip tests, the `overlay` mode should be added there. The default lifetime mode crashes on unmodified main as well. - Full ctest suite: 494/494 passed. `tools/check_conventions.py --base origin/main` passes. - PPSA01736: with the change, the same 60-second capture switches between black and image 4 times in 194 frames, only at the title's own fades, and the intro plays without blinking. Both captures were taken on a build that also has the other fixes the title needs to reach its intro: #1782, #1775, #1777, #1836, #1673 and some local commits. ### 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 in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
copilot-pull-request-reviewer[bot] commented 2026-10-09 09:55:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-09T09:55:56Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5468538679 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2142#pullrequestreview-5468538679). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-09T09:55:56Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
adriadam10 commented 2026-10-10 06:13:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:13:40Z.


Checked on Linux, this head rebased on main: build and the libSceVideoOut ctest tests. video_out_flip_overlay skips on the offscreen driver (no Vulkan window), so the new case is only exercised on a machine with a display; the code path (overlay ports mark the flip GPU-complete, signal events as before, skip the presenter) reads correct.

Added by us on your branch:

  • Moved the Overlay output bus TechnicalDebt line off the end of the Functional section, to avoid adjacency conflicts with other PRs.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094544263 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2142#issuecomment-6094544263). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:13:40Z. --- Checked on Linux, this head rebased on `main`: build and the libSceVideoOut ctest tests. `video_out_flip_overlay` skips on the offscreen driver (no Vulkan window), so the new case is only exercised on a machine with a display; the code path (overlay ports mark the flip GPU-complete, signal events as before, skip the presenter) reads correct. Added by us on your branch: - Moved the `Overlay output bus` TechnicalDebt line off the end of the Functional section, to avoid adjacency conflicts with other PRs. Merging once CI is green.
adriadam10 commented 2026-10-10 06:50:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:50:37Z.


Rebased on current main (conflicts in VideoOutDriver.cpp, the flip test list and TechnicalDebt.md). The overlay branch of processFlip keeps the CheckAlive()/Closed() handling main now has, and overlay joins the registered flip modes.

Checked on Linux: build and the libSceVideoOut ctest tests pass; the video_out_flip_* cases skip on the offscreen driver (no Vulkan window).

Added by us on your branch:

  • Rebase onto main.
  • The Overlay output bus TechnicalDebt line stays off the end of the Functional section.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094825098 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2142#issuecomment-6094825098). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:50:37Z. --- Rebased on current `main` (conflicts in `VideoOutDriver.cpp`, the flip test list and `TechnicalDebt.md`). The overlay branch of `processFlip` keeps the `CheckAlive()`/`Closed()` handling main now has, and `overlay` joins the registered flip modes. Checked on Linux: build and the libSceVideoOut ctest tests pass; the `video_out_flip_*` cases skip on the offscreen driver (no Vulkan window). Added by us on your branch: - Rebase onto `main`. - The `Overlay output bus` TechnicalDebt line stays off the end of the Functional section. Merging once CI is green.
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!2142
No description provided.