fix(videoout): accept a buffer attribute change while a flip is pending #3867

Merged
tv7 merged 1 commit from upstream-pr/3867 into main 2026-10-12 04:28:16 +00:00
tv7 commented 2026-10-11 18:16:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-11T18:16:22Z.


What

sceVideoOutSubmitChangeBufferAttribute2 threw VideoOut: buffer attributes are in use by a pending flip when any buffer of the group had a flip queued. Marvel's Wolverine (PPSA03671) makes this call with flips in the queue, at the end of its intro videos, so it stopped there.

The flip read its buffer group late, in resolveFlipBuffer when the GPU reached the flip, so a change at that point would have reached flips submitted before it. The throw kept that from happening. Now:

  • Reserve (submission order, under the config mutex) copies the buffer's group into the request. resolveFlipBuffer uses that copy, and reads cfg.groups only for a request reserved without one.
  • With that, a flip submitted before the change keeps the attributes its buffer was rendered with, and flips after it use the new ones. So the change no longer needs to wait for pending flips. The new attributes are still validated against the registered buffers, as before.
  • Unregistering a buffer with a pending flip still throws, since the flip needs the buffer itself.

Tested

Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release, on main a11c8f7f7.

  • video_out_flip_lifetime (and _reopen): with a flip held pending behind a gated GPU flip, the attribute change now returns 0, the group holds the new attributes, and the flip stays pending. An invalid change (DCC without metadata) still throws. Before this change the test fails with buffer attributes are in use by a pending flip. These tests skip under the default SDL_VIDEODRIVER=offscreen on this machine (no Vulkan there), so I ran the five video_out_flip_* tests with SDL_VIDEODRIVER=windows, a local CMake edit that is not in the PR (#3810 makes this configurable): 5/5 pass.
  • ctest 832/836. The other 4 (guest_kernel_sys, windows_exceptions, guest_filesystem, agc_driver_emulated_color_compare) fail the same way on main on this machine.
  • tools/check_conventions.py passes.
  • Wolverine on main plus #757, #3588, #3633, #3846 and #3336: without this change it stops after about 7 minutes of intro video with the error above. With it, it goes on into what looks like a loading screen (black frames at about 6.7 FPS), then stops at an unimplemented sceAjmBatchJobInitialize Opus sample rate (separate topic).
  • Merges cleanly with the open PRs touching libSceVideoOut Buffer.cpp, VideoOutDriver.cpp or Flip.cpp (#3817, #3818, #3664, #1050).

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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes, Claude Code

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821244978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3867). Originally posted by [tv7](https://github.com/tv7) on 2026-10-11T18:16:22Z. --- ### What `sceVideoOutSubmitChangeBufferAttribute2` threw `VideoOut: buffer attributes are in use by a pending flip` when any buffer of the group had a flip queued. Marvel's Wolverine (PPSA03671) makes this call with flips in the queue, at the end of its intro videos, so it stopped there. The flip read its buffer group late, in `resolveFlipBuffer` when the GPU reached the flip, so a change at that point would have reached flips submitted before it. The throw kept that from happening. Now: - `Reserve` (submission order, under the config mutex) copies the buffer's group into the request. `resolveFlipBuffer` uses that copy, and reads `cfg.groups` only for a request reserved without one. - With that, a flip submitted before the change keeps the attributes its buffer was rendered with, and flips after it use the new ones. So the change no longer needs to wait for pending flips. The new attributes are still validated against the registered buffers, as before. - Unregistering a buffer with a pending flip still throws, since the flip needs the buffer itself. ### Tested Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release, on main `a11c8f7f7`. - `video_out_flip_lifetime` (and `_reopen`): with a flip held pending behind a gated GPU flip, the attribute change now returns 0, the group holds the new attributes, and the flip stays pending. An invalid change (DCC without metadata) still throws. Before this change the test fails with `buffer attributes are in use by a pending flip`. These tests skip under the default `SDL_VIDEODRIVER=offscreen` on this machine (no Vulkan there), so I ran the five `video_out_flip_*` tests with `SDL_VIDEODRIVER=windows`, a local CMake edit that is not in the PR (#3810 makes this configurable): 5/5 pass. - ctest 832/836. The other 4 (`guest_kernel_sys`, `windows_exceptions`, `guest_filesystem`, `agc_driver_emulated_color_compare`) fail the same way on main on this machine. - `tools/check_conventions.py` passes. - Wolverine on main plus #757, #3588, #3633, #3846 and #3336: without this change it stops after about 7 minutes of intro video with the error above. With it, it goes on into what looks like a loading screen (black frames at about 6.7 FPS), then stops at an unimplemented `sceAjmBatchJobInitialize` Opus sample rate (separate topic). - Merges cleanly with the open PRs touching `libSceVideoOut` `Buffer.cpp`, `VideoOutDriver.cpp` or `Flip.cpp` (#3817, #3818, #3664, #1050). ### 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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes, Claude Code 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-11 18:25:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T18:25:21Z.


I independently built video_out_flip_tests from head 5cd25dedbd2e673d210b6567a078b5f6f7590d28 in Release with GCC 12.2.0 on Linux. The default CTest invocations skipped under SDL_VIDEODRIVER=offscreen because that driver did not provide Vulkan here. Running the test binary with xvfb-run -a env SDL_VIDEODRIVER=x11 used Mesa llvmpipe (LLVM 15.0.6); both the default lifetime case and the reopen case passed (VideoOut flip tests passed). This is local software Vulkan validation, not a Windows or physical-GPU run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112227448 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3867#issuecomment-6112227448). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T18:25:21Z. --- I independently built `video_out_flip_tests` from head `5cd25dedbd2e673d210b6567a078b5f6f7590d28` in Release with GCC 12.2.0 on Linux. The default CTest invocations skipped under `SDL_VIDEODRIVER=offscreen` because that driver did not provide Vulkan here. Running the test binary with `xvfb-run -a env SDL_VIDEODRIVER=x11` used Mesa llvmpipe (LLVM 15.0.6); both the default lifetime case and the `reopen` case passed (`VideoOut flip tests passed`). This is local software Vulkan validation, not a Windows or physical-GPU run.
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!3867
No description provided.