feat(videoout): composite the overlay bus over the main output #10507

Merged
orezraey merged 5 commits from upstream-pr/10507 into main 2026-10-26 19:00:55 +00:00
orezraey commented 2026-10-24 05:50:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-24T05:50:20Z.


What

A title that opens a second VideoOut port on SCE_VIDEO_OUT_BUS_TYPE_OVERLAY draws its UI there, but overlay flips only completed (#2142): their buffers were never shown. PPSA01670 (DEATHLOOP) draws every menu, prompt, dialog, subtitle and cursor on the overlay bus, so it ran with no visible UI at all. Its title screen showed a blurred background with an invisible "not signed into PlayStation Network" dialog over it.

The buffer the overlay port displays is now blended over every main-bus presentation:

  • Which buffer: the one selected by the overlay port's last completed flip, while it stays registered and the port open. Black and unregistered main flips get the overlay too.
  • Blend: premultiplied alpha, overlay + main * (1 - overlay alpha), applied to the encoded 8-bit values. Each plane is scaled to fit the window on its own.
  • Why premultiplied: at PPSA01670's title screen its 3840x2160 0x8000000022000000 overlay held 527,020 translucent texels, and none had a color channel above its alpha. A straight-alpha plane would have many.

How it is drawn:

  • PresentationPass gets RecordOverlay. It is the existing decode shader with a load-and-blend render pass and a scissor to the plane's rectangle.
  • It also gets BindTexels, a per-slot upload image for an overlay whose results are not resident on the GPU. Either path draws onto the swapchain image after the main plane and before the F10 overlay.
  • VideoOut passes the overlay plane with each main present (AgcDriverPresentBuffer/PresentClear gain a plane argument).
  • GPU frame dumps (APS5_DUMP_FRAMES) and screenshots blend the same plane into the image they read back (the presentation dump, the direct-blit dump and the scaler source), so a dump shows what the window shows. PresentationPass::RecordDump is split into RecordDumpImage and RecordDumpReadback for this.

Not done, recorded in the libSceVideoOut debt entry:

  • 10-bit, PQ and float overlays throw.
  • The overlay is not composited over an HDR10 swapchain; one stderr line reports this.
  • An overlay flip alone does not present. A new overlay buffer shows at the next main flip.
  • CPU-decoded dumps (APS5_NO_GPU_DUMP, HDR10) and the frame recorder hold the main plane only.
  • An overlay that is not resident on the GPU is read and detiled on the CPU each present.

Tested

Windows 11 26200, NVIDIA GeForce RTX 5070 Ti (driver 616.64), MinGW build.

  • PPSA01670 (DEATHLOOP):
    • Before: the title screen, the PSN dialog and the brightness calibration showed no text, prompts or cursor.
    • After: all of these are shown, at the same ~8 FPS.
    • This run includes #10414, without which the title stops before its title screen.
  • agc_driver_presentation_pass: new overlay cases cover 8-bit BGRA and RGBA overlays over a main plane and over a cleared destination, through both a resident image and uploaded texels, at five window sizes (exact, letterboxed both ways, scaled down and up). They match the CPU blend of the plane presented alone with the destination by at most 0 levels. Outside the plane's rectangle they are unchanged. The test also covers refusals: 10-bit and PQ overlays, an HDR10 destination, discarded contents, and short texels.
  • Dumps with the overlay (948e969ba0): agc_driver_presentation_pass blends an overlay into the presentation dump at strides 1 and 3 and into the scaler source, and matches the CPU blend by at most 0 levels. In PPSA01670, 600 dumped boot frames now show the logos and copyright screen drawn on the overlay instead of only the key art under it.
  • video_out_flip_overlay: a main flip composites the overlay only once the overlay port has a displayed buffer. It does not composite after the overlay flips to black, after its buffers are unregistered, or after the port closes.
  • Focused tests on main and on this change, same machine: run with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, using agc_resident_present|agc_driver_presentation_pass|agc_performance_overlay|agc_screenshot|agc_driver_flip|agc_driver_flip_compute|agc_driver_present_mode|video_out_flip_.*|video_out_hdr_present|guest_video_out_hdr|guest_screenshot.*.
    • Results: all 25 pass on both, three times on this change (head 948e969ba0 as well). Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS. main logs 0 VUID- lines, and so does this change. An earlier revision of this change logged VUID-vkCmdBeginRenderPass-initialLayout-00899 (a load-from-TRANSFER_DST view without that usage); that is fixed here.
  • Head 655d0f3f32 (main 5b85225ef3 merged in, with #10807): only the last lines of PresentationPass.cpp's main met; both overlayPlaneTests and #10807's sourceImageOutsideDeviceMemoryTests run, with one success message. The 31 focused tests above pass three runs in a row on Windows (same GPU) with validation; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none logs a VUID- line.
  • Linux (WSL Ubuntu, GCC) at 655d0f3f32: the same 31 tests pass three runs in a row; WSL has no Vulkan driver, so 22 of them skip and 9 run.
  • Head f34c280578 (main 14c99b52ac merged in, with #10160): VulkanDevice met main's display-key writer sync (96bccd4c94, a3af6b1149); PresentStatistics keeps both planes and keyWriterWaits/keyWriterWaitMs, and PresentDisplayBuffer keeps the plane parameter with the sync before it. The 31 focused tests pass three runs in a row on Windows (same GPU) with validation; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none logs a VUID- line. On WSL Ubuntu (GCC) the same 31 pass three runs in a row (22 skip without a Vulkan driver, 9 run).
  • Full suite: ctest -E "^agc_|^select_tests$", 1096 of 1096 pass.

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: #10043, #10160, #10487, #9508 (merge order only: each changes a line or two this PR also changes in PresentationPass or VulkanDevice.cpp/.hpp; #10420 was closed unmerged and its replacements do not touch these files; this PR goes after them and is refreshed over each one as it merges); #9508 edits the same lines too (merge order only); #1395, #6202, #7642, #10193, #10807, #11207 edit the same lines too (merge order only)
  • Fixes: none
  • Unblocks: PPSA01670 #11484 (DEATHLOOP)
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 26200
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4992913917 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10507). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-24T05:50:20Z. --- ### What A title that opens a second VideoOut port on `SCE_VIDEO_OUT_BUS_TYPE_OVERLAY` draws its UI there, but overlay flips only completed (#2142): their buffers were never shown. PPSA01670 (DEATHLOOP) draws every menu, prompt, dialog, subtitle and cursor on the overlay bus, so it ran with no visible UI at all. Its title screen showed a blurred background with an invisible "not signed into PlayStation Network" dialog over it. The buffer the overlay port displays is now blended over every main-bus presentation: - **Which buffer:** the one selected by the overlay port's last completed flip, while it stays registered and the port open. Black and unregistered main flips get the overlay too. - **Blend:** premultiplied alpha, `overlay + main * (1 - overlay alpha)`, applied to the encoded 8-bit values. Each plane is scaled to fit the window on its own. - **Why premultiplied:** at PPSA01670's title screen its 3840x2160 `0x8000000022000000` overlay held 527,020 translucent texels, and none had a color channel above its alpha. A straight-alpha plane would have many. How it is drawn: - `PresentationPass` gets `RecordOverlay`. It is the existing decode shader with a load-and-blend render pass and a scissor to the plane's rectangle. - It also gets `BindTexels`, a per-slot upload image for an overlay whose results are not resident on the GPU. Either path draws onto the swapchain image after the main plane and before the F10 overlay. - VideoOut passes the overlay plane with each main present (`AgcDriverPresentBuffer`/`PresentClear` gain a `plane` argument). - GPU frame dumps (`APS5_DUMP_FRAMES`) and screenshots blend the same plane into the image they read back (the presentation dump, the direct-blit dump and the scaler source), so a dump shows what the window shows. `PresentationPass::RecordDump` is split into `RecordDumpImage` and `RecordDumpReadback` for this. Not done, recorded in the `libSceVideoOut` debt entry: - 10-bit, PQ and float overlays throw. - The overlay is not composited over an HDR10 swapchain; one stderr line reports this. - An overlay flip alone does not present. A new overlay buffer shows at the next main flip. - CPU-decoded dumps (`APS5_NO_GPU_DUMP`, HDR10) and the frame recorder hold the main plane only. - An overlay that is not resident on the GPU is read and detiled on the CPU each present. ### Tested Windows 11 26200, NVIDIA GeForce RTX 5070 Ti (driver 616.64), MinGW build. - **PPSA01670 (DEATHLOOP):** - Before: the title screen, the PSN dialog and the brightness calibration showed no text, prompts or cursor. - After: all of these are shown, at the same ~8 FPS. - This run includes #10414, without which the title stops before its title screen. - **`agc_driver_presentation_pass`:** new overlay cases cover 8-bit BGRA and RGBA overlays over a main plane and over a cleared destination, through both a resident image and uploaded texels, at five window sizes (exact, letterboxed both ways, scaled down and up). They match the CPU blend of the plane presented alone with the destination by at most 0 levels. Outside the plane's rectangle they are unchanged. The test also covers refusals: 10-bit and PQ overlays, an HDR10 destination, discarded contents, and short texels. - **Dumps with the overlay (948e969ba0):** `agc_driver_presentation_pass` blends an overlay into the presentation dump at strides 1 and 3 and into the scaler source, and matches the CPU blend by at most 0 levels. In PPSA01670, 600 dumped boot frames now show the logos and copyright screen drawn on the overlay instead of only the key art under it. - **`video_out_flip_overlay`:** a main flip composites the overlay only once the overlay port has a displayed buffer. It does not composite after the overlay flips to black, after its buffers are unregistered, or after the port closes. - **Focused tests on `main` and on this change, same machine:** run with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, using `agc_resident_present|agc_driver_presentation_pass|agc_performance_overlay|agc_screenshot|agc_driver_flip|agc_driver_flip_compute|agc_driver_present_mode|video_out_flip_.*|video_out_hdr_present|guest_video_out_hdr|guest_screenshot.*`. - **Results:** all 25 pass on both, three times on this change (head 948e969ba0 as well). Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. `main` logs 0 `VUID-` lines, and so does this change. An earlier revision of this change logged `VUID-vkCmdBeginRenderPass-initialLayout-00899` (a load-from-`TRANSFER_DST` view without that usage); that is fixed here. - **Head `655d0f3f32` (`main` `5b85225ef3` merged in, with #10807):** only the last lines of `PresentationPass.cpp`'s `main` met; both `overlayPlaneTests` and #10807's `sourceImageOutsideDeviceMemoryTests` run, with one success message. The 31 focused tests above pass three runs in a row on Windows (same GPU) with validation; neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and none logs a `VUID-` line. - **Linux (WSL Ubuntu, GCC) at `655d0f3f32`:** the same 31 tests pass three runs in a row; WSL has no Vulkan driver, so 22 of them skip and 9 run. - **Head `f34c280578` (`main` `14c99b52ac` merged in, with #10160):** `VulkanDevice` met main's display-key writer sync (`96bccd4c94`, `a3af6b1149`); `PresentStatistics` keeps both `planes` and `keyWriterWaits`/`keyWriterWaitMs`, and `PresentDisplayBuffer` keeps the `plane` parameter with the sync before it. The 31 focused tests pass three runs in a row on Windows (same GPU) with validation; neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and none logs a `VUID-` line. On WSL Ubuntu (GCC) the same 31 pass three runs in a row (22 skip without a Vulkan driver, 9 run). - **Full suite:** `ctest -E "^agc_|^select_tests$"`, 1096 of 1096 pass. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #10043, #10160, #10487, #9508 (merge order only: each changes a line or two this PR also changes in `PresentationPass` or `VulkanDevice.cpp`/`.hpp`; #10420 was closed unmerged and its replacements do not touch these files; this PR goes after them and is refreshed over each one as it merges); #9508 edits the same lines too (merge order only); #1395, #6202, #7642, #10193, #10807, #11207 edit the same lines too (merge order only) - [x] Fixes: none - [x] Unblocks: PPSA01670 #11484 (DEATHLOOP) - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 616.64, Windows 11 26200 - [x] AI-assisted: yes
adriadam10 commented 2026-10-24 06:05:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-24T06:05:39Z.

Review: CHANGES_REQUESTED


Thanks, the blend, layout transitions and refusals read correctly, and the new tests pin behaviour that main lacks. One thing is missing before merge (memory is bounded and measured, per CONTRIBUTING / the memory rules):

  • core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp:286-315 (ensureUploadImage) keeps, per present slot, an R32_UINT device-local image plus a host-visible staging buffer, both the overlay's size, and VulkanDevice.cpp:3652 keeps a second PresentationPass alive. At 3840x2160 that is about 33 MB + 33 MB per slot, over FlipInFlight() + 1 slots, and it is only freed when the device or swapchain is torn down. The non-resident path also detiles the whole overlay on the CPU each present. Please state the bound (what frees it, slot count) and give peak RSS / VRAM before and after on PPSA01670 or an equivalent 4K overlay workload. If the staging buffer can be shared across slots or sized once, say so, or do it.
  • Add that bound to the Overlay output bus line in docs/dev/debt/libSceVideoOut.md.

Everything else I checked (premultiplied blend factors, render-pass dependencies, refusal paths, debt entry) is fine; the Build run of the head will cover the Linux/Windows tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5637100199 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10507#pullrequestreview-5637100199). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-24T06:05:39Z. **Review:** CHANGES_REQUESTED --- Thanks, the blend, layout transitions and refusals read correctly, and the new tests pin behaviour that `main` lacks. One thing is missing before merge (memory is bounded and measured, per CONTRIBUTING / the memory rules): - `core/libs/prx/libSceAgcDriver/Execution/src/PresentationPass.cpp:286-315` (`ensureUploadImage`) keeps, per present slot, an R32_UINT device-local image plus a host-visible staging buffer, both the overlay's size, and `VulkanDevice.cpp:3652` keeps a second `PresentationPass` alive. At 3840x2160 that is about 33 MB + 33 MB per slot, over `FlipInFlight() + 1` slots, and it is only freed when the device or swapchain is torn down. The non-resident path also detiles the whole overlay on the CPU each present. Please state the bound (what frees it, slot count) and give peak RSS / VRAM before and after on PPSA01670 or an equivalent 4K overlay workload. If the staging buffer can be shared across slots or sized once, say so, or do it. - Add that bound to the `Overlay output bus` line in `docs/dev/debt/libSceVideoOut.md`. Everything else I checked (premultiplied blend factors, render-pass dependencies, refusal paths, debt entry) is fine; the Build run of the head will cover the Linux/Windows tests.
MarcZX10 commented 2026-10-24 11:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:17:35Z.

Review: DISMISSED


I reviewed the exact head 5515884034 and the reported GPU validation and focused test evidence are strong. One contribution-rule item is missing: the current checklist says , while the overlap report identifies open PRs #10043, #10160, and #10487 changing the same lines this patch changes in the presentation pass/Vulkan device. #10420 also has an unresolved base conflict and is listed among the comparisons the bot could not complete. CONTRIBUTING.md requires the authors to agree on merge order for overlapping PRs and declare it in . Please coordinate the order and update the checklist (including resolving the #10420 overlap manually). This is a merge-order bookkeeping blocker; I found no additional code defect in this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638052905 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10507#pullrequestreview-5638052905). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T11:17:35Z. **Review:** DISMISSED --- I reviewed the exact head 5515884034eda64b05272613fee274b988a91c2e and the reported GPU validation and focused test evidence are strong. One contribution-rule item is missing: the current checklist says , while the overlap report identifies open PRs #10043, #10160, and #10487 changing the same lines this patch changes in the presentation pass/Vulkan device. #10420 also has an unresolved base conflict and is listed among the comparisons the bot could not complete. CONTRIBUTING.md requires the authors to agree on merge order for overlapping PRs and declare it in . Please coordinate the order and update the checklist (including resolving the #10420 overlap manually). This is a merge-order bookkeeping blocker; I found no additional code defect in this review.
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!10507
No description provided.