feat(videoout): expose buffer labels and release replaced frames #5592

Merged
JJenkx merged 7 commits from upstream-pr/5592 into main 2026-10-14 12:50:50 +00:00
JJenkx commented 2026-10-14 00:33:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T00:33:21Z.


What

Implement sceVideoOutGetBufferLabelAddress with a port-owned array of 16 aligned 64-bit labels. Return its address and count, reset newly registered slots, and release the previous displayed buffer's label when its replacement completes presentation. Black/blank replacements release the previous buffer without using a negative index. Ports and reopened generations have separate arrays.

Route stores through a graphics-driver helper retained by production NID patching, so the memory tracker observes an atomic release store. Failed handle/pointer queries preserve output, and successful pointer output supports unaligned storage.

Astro Bot PPSA21564's bundled driver uses a pointer output and base + index * 8. Count and release behavior follow shadPS4 and its driver. PS5 timing, error policy, repeated same-buffer flips and concurrent guest stores remain unverified and documented in library debt. This does not implement EOP-flip tokens, which are separate work in #5539.

Tested

  • Full standalone Linux/Windows fork CI passes published head d1de55fb3306, containing main d1670009fbfd: Linux 1,037 passed / 48 skipped; Windows 714 passed / 391 skipped. Display-dependent label cases are skipped on these runners and remain outside CI's functional validation.
  • Local native X11 tests on Radeon and lavapipe cover count/width/alignment, unaligned output canaries, failure output preservation, registration resets, first-frame retention, replacement release, black/blank frames, port separation and close/reopen generations. Main and overlay presentation are exercised. Four label cases, eight related VideoOut cases and 14 CPU regressions passed without skips at their earlier tested integration; no standalone title startup or FPS improvement is claimed.
  • Removing the replacement-label release makes the regression fail; restoring it makes the test pass. Production NID-patched API/helper probes also passed.
  • The latest edits relocate the byte-identical label test function/dispatch, register label modes separately and place the debt entry beside related buffer behavior. Merge-tree checks merge the branch cleanly with #5539, #4863, #5239 and #5466. These are independent features and require no dependency.
  • This branch also merges cleanly with newer main feddf7f4c654; the full CI above remains tied to its recorded earlier source/base. Conventions and whitespace checks pass.

Checklist

  • Based on main; merges cleanly with current main, with validation revisions recorded above
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • No silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA21564 #357 (buffer-label import and host presentation behavior)
  • GPUs tested: AMD Radeon RX 6650 XT / RADV Mesa 26.2.4 and software lavapipe / Mesa 26.2.4, Arch Linux; native validation scope above
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4851258687 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5592). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-14T00:33:21Z. --- ### What Implement `sceVideoOutGetBufferLabelAddress` with a port-owned array of 16 aligned 64-bit labels. Return its address and count, reset newly registered slots, and release the previous displayed buffer's label when its replacement completes presentation. Black/blank replacements release the previous buffer without using a negative index. Ports and reopened generations have separate arrays. Route stores through a graphics-driver helper retained by production NID patching, so the memory tracker observes an atomic release store. Failed handle/pointer queries preserve output, and successful pointer output supports unaligned storage. Astro Bot PPSA21564's bundled driver uses a pointer output and `base + index * 8`. Count and release behavior follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/23c41333822fe8eca4c609b43119180af63ae4ac/src/core/libraries/videoout/video_out.cpp) and its driver. PS5 timing, error policy, repeated same-buffer flips and concurrent guest stores remain unverified and documented in library debt. This does not implement EOP-flip tokens, which are separate work in #5539. ### Tested - [Full standalone Linux/Windows fork CI](https://github.com/JJenkx/AnyPS5/actions/runs/38489010851) passes published head `d1de55fb3306`, containing main `d1670009fbfd`: Linux 1,037 passed / 48 skipped; Windows 714 passed / 391 skipped. Display-dependent label cases are skipped on these runners and remain outside CI's functional validation. - Local native X11 tests on Radeon and lavapipe cover count/width/alignment, unaligned output canaries, failure output preservation, registration resets, first-frame retention, replacement release, black/blank frames, port separation and close/reopen generations. Main and overlay presentation are exercised. Four label cases, eight related VideoOut cases and 14 CPU regressions passed without skips at their earlier tested integration; no standalone title startup or FPS improvement is claimed. - Removing the replacement-label release makes the regression fail; restoring it makes the test pass. Production NID-patched API/helper probes also passed. - The latest edits relocate the byte-identical label test function/dispatch, register label modes separately and place the debt entry beside related buffer behavior. Merge-tree checks merge the branch cleanly with #5539, #4863, #5239 and #5466. These are independent features and require no dependency. - This branch also merges cleanly with newer main `feddf7f4c654`; the full CI above remains tied to its recorded earlier source/base. Conventions and whitespace checks pass. ### Checklist - [x] Based on main; merges cleanly with current main, with validation revisions recorded above - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] No silent stubs added - [x] No notes, investigation files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA21564 #357 (buffer-label import and host presentation behavior) - [x] GPUs tested: AMD Radeon RX 6650 XT / RADV Mesa 26.2.4 and software lavapipe / Mesa 26.2.4, Arch Linux; native validation scope above - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-14 00:34:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T00:34:06Z.


Progress report (ce5c839 → d1de55f)

📈 System libraries: 88.19% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceVideoOut sceVideoOutGetBufferLabelAddress
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158183286 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5592#issuecomment-6158183286). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T00:34:06Z. --- <!-- progress-report --> ### Progress report (ce5c839 → d1de55f) 📈 **System libraries**: 88.19% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceVideoOut | `sceVideoOutGetBufferLabelAddress` | </details>
adriadam10 commented 2026-10-14 12:32:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T12:32:05Z.


Checked the label array against shadPS4 and fpPS4 (null output, invalid handle, count 16), the registration reset and the release of the previous buffer on replacement/black/blank flips. Built and ran video_out_flip_labels and video_out_flip_labels_main on a real X display (both pass; they skip under the offscreen CI driver). Removing the release in processFlip makes the test fail, restoring it passes. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6168411304 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5592#issuecomment-6168411304). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T12:32:05Z. --- Checked the label array against shadPS4 and fpPS4 (null output, invalid handle, count 16), the registration reset and the release of the previous buffer on replacement/black/blank flips. Built and ran `video_out_flip_labels` and `video_out_flip_labels_main` on a real X display (both pass; they skip under the offscreen CI driver). Removing the release in `processFlip` makes the test fail, restoring it passes. Merging once the full Build 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!5592
No description provided.