perf(videoout): don't hold a flip thread's CPU flips behind queued work #6507

Merged
karanvora2599 merged 1 commit from upstream-pr/6507 into main 2026-10-19 02:49:51 +00:00
karanvora2599 commented 2026-10-15 18:05:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-15T18:05:20Z.


What

A CPU flip (sceVideoOutSubmitFlip) from a thread that has never submitted queue-0 work no longer waits for the command buffers queued ahead of it. In vkQuake this removes the paired presents (about 4.7 ms then 29 ms apart) that show as stutter, and frame rate rises from 60 to 72-74 presents per second.

Title. vkQuake (PPSA99010): mihawk-99's PS5_vkQuake port, which renders through their RADV fork PS5_Mesa and its VideoOut WSI.

Background.

  • sceVideoOutSubmitFlip reaches the driver as a one-packet queue-0 command buffer (VideoOutDriver::SubmitFlip → sceAgcDriverSubmitDcb). The queue worker runs submissions in order, so a CPU flip waits until the worker has translated every command buffer submitted before it.
  • The PS5 RADV WSI (wsi_common_videoout.c in mihawk-99/PS5_Mesa) queue_present only hands {buffer, fence} to a flip thread. That thread waits for the frame's fence, then calls sceVideoOutSubmitFlip.
  • vkQuake keeps two frames in flight. When frame A's fence signals, frame B's command buffer is already queued, so flip A waits about 10 ms for the worker to translate B. Flip B arrives about 0.6 ms after B finishes on the GPU, so the two presents land together.
  • The title's vkAcquireNextImageKHR for frame C needs flip A to be shown. Meanwhile the worker sits idle, about 7.5 ms per pair. On main the worker is busy 76% of the time.

How.

  • VideoOutDriver::SubmitFlip calls a new driver entry, AgcDriverSubmitFlip_nid_postfix, which builds the same flip packet and submits it as a CPU flip.

  • Each thread records whether it has ever submitted queue-0 work (Submit on queue 0, or SuspendPoint). The record uses HostThreadLocal, so it ends with the thread.

  • A CPU flip skips the queue when all of the following hold:

    • its thread has never submitted queue-0 work;
    • no command-buffer or EOP flip ahead of it is still unreached (flipsAhead == 0, after the usual holdFlipBehindWorker);
    • no submission capture is active;
    • APS5_SYNC_FLIP is off, and the build is not APS5_ENABLE_TIMING_LOG.

    In that case it is reserved and handed to the presenter (GpuReady) under the driver lock, so it cannot overtake a flip reserved before it. The graphics end-of-pipe event that every flip raises is then delivered at once, since the frame was already finished.

  • Every other CPU flip is queued as before.

  • The presenter is unchanged. present() still submits all recorded work before its blit, and the flip completes only after the blit's fence: @oneandonlydean's rule from #417 (d9632d552) holds for these flips too.

  • The flip hold that @AymanFE's #1745 and @sridhar777911's #2666 added (holdFlipBehindWorker, flipsAhead) is reused as is. A flip-thread flip still waits there for an unreached flip ahead of it.

  • APS5_CPU_FLIP_IN_ORDER=1 queues every CPU flip, as on main.

  • frameSerial is now atomic, because the flip's FrameTiming can now be created off the worker thread.

  • A flip that skips the queue is not a queue-0 submission. It takes no serial, so it is not kept in @fdfawef324's per-queue PM4 ring (13b171cab), which records queue submissions.

Why only flip threads. A thread that submits its own frames may flip without waiting for them, and then it relies on the flip completing after the work submitted ahead of it:

  • @oneandonlydean's video_out_flip_tests aftergpu (#417) checks that order;
  • titles that pace on flipPendingNum, like Balatro in @gjonn's #1034, would otherwise run ahead of the worker.

A thread that never submits GPU work can only know its frame is done by waiting for it, which is what the RADV WSI does. The debt note in libSceVideoOut.md records the inference: whether the console ever orders a CPU flip behind the graphics queue is not measured.

Where it matters. Any title that flips from a dedicated thread after waiting for its frame: vkQuake and other ports on the PS5 RADV WSI. ps5-opengl (PPSA99005 and others) waits for GPU idle on its submitting thread before flipping, so it keeps the queued path. Command-buffer flips (sceAgcDcbSetFlip) and @JJenkx's EOP flips (#5539) are unaffected.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release. The branch is now rebased onto main 51cee9031 (db091f5fb). In Submission.cpp, main's queue bound and submission-ring setup come first, then this change; Flip.cpp keeps both the ps4 and cpuflip modes. The measurements below are from the first head, on main fa9365ca7. The runs used a build of ae47bd08d. It has the same code as this commit and differs only in the wording of the debt note.

vkQuake (PPSA99010)

  • RTX 4060 Laptop (Ada), driver 591.86, 3840x2160.
  • Demo loop with r_rtshadows 0, APS5_TRACE_SECONDS=15:10, APS5_SPIRV_OPT=none and ANYPS5_PRESENT_MODE=immediate (the summary line records only APS5_ variables).
  • Run order: main, this PR, this PR with APS5_CPU_FLIP_IN_ORDER=1, this PR, main, APS5_CPU_FLIP_IN_ORDER=1, after a warm-up run of main.
  • Present intervals are from the presenter's Driver.Present slices in the traces. The vblank buckets are from vkQuake's own PS5 present: lines (frames taking 1/2/3/4+ vblanks at 60 Hz).
Build presents in 10 s frame p50 / p90 interval sd intervals > 25 ms worker 0 busy vkQuake fps (vblanks), a mid-run report
main fa9365ca7 602 / 600 17.2 / 31.0, 15.1 / 31.1 ms 12.2 / 12.3 ms 40% / 43% 75.9 / 76.5% 59.2 (409/182/1/1)
this PR 737 / 724 13.3 / 15.0, 13.4 / 15.7 ms 2.2 / 2.1 ms 1% / 1% 97.8 / 97.7% 71.9 (715/2/1/1)
this PR, APS5_CPU_FLIP_IN_ORDER=1 608 / 594 16.8 / 30.9, 20.7 / 31.3 ms 12.0 / 12.8 ms 40% / 44% 76.1 / 76.5% 58.6 (382/205/0/1)

With the default present mode (FIFO), one run each: main 601 presents, p90 30.8 ms, interval sd 12.3 ms; this PR 722 presents, p90 15.9 ms, interval sd 1.9 ms. GPU busy per present is about 10 ms in every run. The frame is now bound by the queue worker.

Summary lines (main ab1, PR ab1, in-order ab1, PR ab2, main ab2, in-order ab2, main fifo, PR fifo)
{"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":753,"ms":10007.221},"presents":602,"frame_ms":{"p50":17.183,"p90":30.955,"p99":36.148,"max":47.601},"gpu_busy_ms_per_present":10.066,"worker_busy_pct":{"queue worker 0x0":75.949},"top_phases_ms_per_frame":{"Driver.Packet":12.620,"Driver.Packet.draw":8.118,"Driver.Draw":8.072,"Driver.Draw.draw_and_resource_release":4.691,"Driver.Packet.device_lock":3.168,"Graphics.Draw":1.876,"Graphics.Draw.draw_and_resource_release":1.822,"Driver.Draw.shader_compile_and_link":1.698},"trace_dropped":false,"trace":"aps5-trace-fa9365ca74ac-7948.json.gz"}
{"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":893,"ms":10008.238},"presents":737,"frame_ms":{"p50":13.252,"p90":15.020,"p99":18.156,"max":41.447},"gpu_busy_ms_per_present":9.866,"worker_busy_pct":{"queue worker 0x0":97.776},"top_phases_ms_per_frame":{"Driver.Packet":13.275,"Driver.Packet.draw":8.743,"Driver.Draw":8.695,"Driver.Draw.draw_and_resource_release":5.146,"Driver.Packet.device_lock":3.340,"Graphics.Draw":2.222,"Graphics.Draw.draw_and_resource_release":2.161,"Driver.Draw.shader_compile_and_link":1.825},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.173,"events_lost":58994,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-35660.json.gz"}
{"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_CPU_FLIP_IN_ORDER":"1","APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":755,"ms":10013.217},"presents":608,"frame_ms":{"p50":16.833,"p90":30.890,"p99":33.398,"max":43.649},"gpu_busy_ms_per_present":10.035,"worker_busy_pct":{"queue worker 0x0":76.114},"top_phases_ms_per_frame":{"Driver.Packet":12.530,"Driver.Packet.draw":8.064,"Driver.Draw":8.017,"Driver.Draw.draw_and_resource_release":4.538,"Driver.Packet.device_lock":3.112,"Graphics.Draw":1.894,"Graphics.Draw.draw_and_resource_release":1.838,"Driver.Draw.shader_compile_and_link":1.759},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.964,"events_lost":1454,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-33736.json.gz"}
{"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":917,"ms":10010.790},"presents":724,"frame_ms":{"p50":13.399,"p90":15.728,"p99":22.584,"max":37.264},"gpu_busy_ms_per_present":9.871,"worker_busy_pct":{"queue worker 0x0":97.731},"top_phases_ms_per_frame":{"Driver.Packet":13.511,"Driver.Packet.draw":8.902,"Driver.Draw":8.852,"Driver.Draw.draw_and_resource_release":5.085,"Driver.Packet.device_lock":3.360,"Graphics.Draw":2.289,"Graphics.Draw.draw_and_resource_release":2.226,"Driver.Draw.shader_compile_and_link":1.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.195,"events_lost":58091,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-34664.json.gz"}
{"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":756,"ms":10014.395},"presents":600,"frame_ms":{"p50":15.050,"p90":31.099,"p99":38.922,"max":49.068},"gpu_busy_ms_per_present":9.939,"worker_busy_pct":{"queue worker 0x0":76.534},"top_phases_ms_per_frame":{"Driver.Packet":12.768,"Driver.Packet.draw":7.984,"Driver.Draw":7.934,"Driver.Draw.draw_and_resource_release":4.525,"Driver.Packet.device_lock":3.358,"Graphics.Draw":1.980,"Graphics.Draw.draw_and_resource_release":1.921,"Driver.Draw.shader_compile_and_link":1.820},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.919,"events_lost":2670,"totals_full":false}},"trace":"aps5-trace-fa9365ca74ac-27036.json.gz"}
{"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_CPU_FLIP_IN_ORDER":"1","APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":759,"ms":10013.520},"presents":594,"frame_ms":{"p50":20.698,"p90":31.276,"p99":39.025,"max":58.915},"gpu_busy_ms_per_present":9.951,"worker_busy_pct":{"queue worker 0x0":76.486},"top_phases_ms_per_frame":{"Driver.Packet":12.888,"Driver.Packet.draw":8.137,"Driver.Draw":8.087,"Driver.Draw.draw_and_resource_release":4.657,"Driver.Packet.device_lock":3.335,"Graphics.Draw":1.957,"Graphics.Draw.draw_and_resource_release":1.900,"Driver.Draw.shader_compile_and_link":1.795},"trace_dropped":false,"trace":"aps5-trace-ae47bd08d7d1-6908.json.gz"}
{"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":767,"ms":10015.494},"presents":601,"frame_ms":{"p50":14.162,"p90":30.770,"p99":34.510,"max":50.958},"gpu_busy_ms_per_present":9.939,"worker_busy_pct":{"queue worker 0x0":75.326},"top_phases_ms_per_frame":{"Driver.Packet":12.548,"Driver.Packet.draw":7.978,"Driver.Draw":7.931,"Driver.Draw.draw_and_resource_release":4.603,"Driver.Packet.device_lock":3.216,"Graphics.Draw":1.924,"Graphics.Draw.draw_and_resource_release":1.867,"Driver.Draw.shader_compile_and_link":1.762},"trace_dropped":false,"trace":"aps5-trace-fa9365ca74ac-4536.json.gz"}
{"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":884,"ms":10013.463},"presents":722,"frame_ms":{"p50":13.551,"p90":15.857,"p99":18.064,"max":37.536},"gpu_busy_ms_per_present":10.017,"worker_busy_pct":{"queue worker 0x0":97.788},"top_phases_ms_per_frame":{"Driver.Packet":13.560,"Driver.Packet.draw":8.913,"Driver.Draw":8.864,"Driver.Draw.draw_and_resource_release":5.329,"Driver.Packet.device_lock":3.412,"Graphics.Draw":2.224,"Graphics.Draw.draw_and_resource_release":2.162,"Driver.Present":1.925},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.161,"events_lost":59117,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-27796.json.gz"}

Black frames. vkQuake shows near-black frames on main as well; APS5_DUMP_FRAMES=60 APS5_DUMP_FRAMES_EVERY=20 gave 5 of 60 on main and 2 of 60 with this PR. Every one is an item pickup ("You got the Grenade Launcher", "You get 3 rockets"): the scene is black and only the HUD text is drawn. They are not caused by flip order, and I haven't looked into them further.

Tests

  • New video_out_flip_cpuflip:
    1. A command-buffer flip on a gated test output parks the queue worker.
    2. A flip submitted from a new thread completes while the worker is parked.
    3. A flip submitted from the thread that submitted the parked work does not complete until the gate is released.
    4. Each flip presents its own argument.
  • video_out_flip_cpuflip_in_order runs the same test with APS5_CPU_FLIP_IN_ORDER=1 and expects the first flip to wait as well.
  • Negative check: this branch's test executable run against main's libraries fails at step 2 (the flip waits for the parked work). With APS5_CPU_FLIP_IN_ORDER=1 it passes.
  • The flip tests need a Vulkan window, and SDL's offscreen driver has none on Windows. So I ran every video_out_flip_tests mode directly with SDL_VIDEODRIVER=windows ANYPS5_REQUIRE_DISPLAY=1:
    • RTX 4060: cpuflip (both ways), aftergpu, lifetime, reopen, deferred, unregistered, pacing, present, backtoback, onedevice, labels, labels_main, overlay, controls, unopened and decode pass. eop and eop_main fail ("EOP packet did not finish its label and reserved flip"), and eop_aftergpu crashes; all three do the same with main's build on this machine.
    • Intel UHD (NVIDIA hidden with VK_LOADER_DRIVERS_DISABLE=*nv-vk*): cpuflip (both ways), lifetime, deferred and pacing pass. aftergpu fails with "the GPU work did not land", also with main's libraries.
    • lavapipe 25.2.8: cpuflip (both ways), aftergpu, lifetime, deferred and pacing pass.
  • RTX 4060, one at a time: agc_driver_flip, agc_driver_flip_compute, agc_driver_flip_stores_small_results, agc_driver_presentation_pass, agc_driver_present_mode, agc_resident_present, agc_driver_gated_dispatch_capture (and _short_timeout), agc_driver_pipelined_predicated_label_order, agc_driver_same_queue_label_wait, agc_driver_unimported_label_order, agc_driver_queue_zero_idle_wait, agc_driver_wait_shutdown, agc_driver_registration_prepare_shutdown, agc_copied_direct_ordering, agc_storage_written_buffer_order, agc_queued_write_groups and video_out_hdr_present 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: none. #6208 also edits Submission.cpp, and #6134, #6188, #6292, #6454 and #6501 add Driver.hpp members; the overlap is textual only.
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU (Ada), driver 591.86, Windows 11; Intel UHD Graphics (Raptor Lake), driver 101.6790, Windows 11; lavapipe (Mesa 25.2.8), Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4877724398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-15T18:05:20Z. --- ### What A CPU flip (`sceVideoOutSubmitFlip`) from a thread that has never submitted queue-0 work no longer waits for the command buffers queued ahead of it. In vkQuake this removes the paired presents (about 4.7 ms then 29 ms apart) that show as stutter, and frame rate rises from 60 to 72-74 presents per second. **Title.** vkQuake (PPSA99010): mihawk-99's [PS5_vkQuake](https://github.com/mihawk-99/PS5_vkQuake) port, which renders through their RADV fork [PS5_Mesa](https://github.com/mihawk-99/PS5_Mesa) and its VideoOut WSI. **Background.** - `sceVideoOutSubmitFlip` reaches the driver as a one-packet queue-0 command buffer (`VideoOutDriver::SubmitFlip` → `sceAgcDriverSubmitDcb`). The queue worker runs submissions in order, so a CPU flip waits until the worker has translated every command buffer submitted before it. - The PS5 RADV WSI (`wsi_common_videoout.c` in mihawk-99/PS5_Mesa) `queue_present` only hands `{buffer, fence}` to a flip thread. That thread waits for the frame's fence, then calls `sceVideoOutSubmitFlip`. - vkQuake keeps two frames in flight. When frame A's fence signals, frame B's command buffer is already queued, so flip A waits about 10 ms for the worker to translate B. Flip B arrives about 0.6 ms after B finishes on the GPU, so the two presents land together. - The title's `vkAcquireNextImageKHR` for frame C needs flip A to be shown. Meanwhile the worker sits idle, about 7.5 ms per pair. On main the worker is busy 76% of the time. **How.** - `VideoOutDriver::SubmitFlip` calls a new driver entry, `AgcDriverSubmitFlip_nid_postfix`, which builds the same flip packet and submits it as a CPU flip. - Each thread records whether it has ever submitted queue-0 work (`Submit` on queue 0, or `SuspendPoint`). The record uses `HostThreadLocal`, so it ends with the thread. - A CPU flip skips the queue when all of the following hold: - its thread has never submitted queue-0 work; - no command-buffer or EOP flip ahead of it is still unreached (`flipsAhead == 0`, after the usual `holdFlipBehindWorker`); - no submission capture is active; - `APS5_SYNC_FLIP` is off, and the build is not `APS5_ENABLE_TIMING_LOG`. In that case it is reserved and handed to the presenter (`GpuReady`) under the driver lock, so it cannot overtake a flip reserved before it. The graphics end-of-pipe event that every flip raises is then delivered at once, since the frame was already finished. - Every other CPU flip is queued as before. - The presenter is unchanged. `present()` still submits all recorded work before its blit, and the flip completes only after the blit's fence: @oneandonlydean's rule from #417 (d9632d552) holds for these flips too. - The flip hold that @AymanFE's #1745 and @sridhar777911's #2666 added (`holdFlipBehindWorker`, `flipsAhead`) is reused as is. A flip-thread flip still waits there for an unreached flip ahead of it. - `APS5_CPU_FLIP_IN_ORDER=1` queues every CPU flip, as on main. - `frameSerial` is now atomic, because the flip's `FrameTiming` can now be created off the worker thread. - A flip that skips the queue is not a queue-0 submission. It takes no serial, so it is not kept in @fdfawef324's per-queue PM4 ring (13b171cab), which records queue submissions. **Why only flip threads.** A thread that submits its own frames may flip without waiting for them, and then it relies on the flip completing after the work submitted ahead of it: - @oneandonlydean's `video_out_flip_tests aftergpu` (#417) checks that order; - titles that pace on `flipPendingNum`, like Balatro in @gjonn's #1034, would otherwise run ahead of the worker. A thread that never submits GPU work can only know its frame is done by waiting for it, which is what the RADV WSI does. The debt note in `libSceVideoOut.md` records the inference: whether the console ever orders a CPU flip behind the graphics queue is not measured. **Where it matters.** Any title that flips from a dedicated thread after waiting for its frame: vkQuake and other ports on the PS5 RADV WSI. ps5-opengl (PPSA99005 and others) waits for GPU idle on its submitting thread before flipping, so it keeps the queued path. Command-buffer flips (`sceAgcDcbSetFlip`) and @JJenkx's EOP flips (#5539) are unaffected. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Release. The branch is now rebased onto main 51cee9031 (db091f5fb). In `Submission.cpp`, `main`'s queue bound and submission-ring setup come first, then this change; `Flip.cpp` keeps both the `ps4` and `cpuflip` modes. The measurements below are from the first head, on main fa9365ca7. The runs used a build of ae47bd08d. It has the same code as this commit and differs only in the wording of the debt note. **vkQuake (PPSA99010)** - RTX 4060 Laptop (Ada), driver 591.86, 3840x2160. - Demo loop with `r_rtshadows 0`, `APS5_TRACE_SECONDS=15:10`, `APS5_SPIRV_OPT=none` and `ANYPS5_PRESENT_MODE=immediate` (the summary line records only `APS5_` variables). - Run order: main, this PR, this PR with `APS5_CPU_FLIP_IN_ORDER=1`, this PR, main, `APS5_CPU_FLIP_IN_ORDER=1`, after a warm-up run of main. - Present intervals are from the presenter's `Driver.Present` slices in the traces. The vblank buckets are from vkQuake's own `PS5 present:` lines (frames taking 1/2/3/4+ vblanks at 60 Hz). | Build | presents in 10 s | frame p50 / p90 | interval sd | intervals > 25 ms | worker 0 busy | vkQuake fps (vblanks), a mid-run report | |---|---|---|---|---|---|---| | main fa9365ca7 | 602 / 600 | 17.2 / 31.0, 15.1 / 31.1 ms | 12.2 / 12.3 ms | 40% / 43% | 75.9 / 76.5% | 59.2 (409/182/1/1) | | this PR | 737 / 724 | 13.3 / 15.0, 13.4 / 15.7 ms | 2.2 / 2.1 ms | 1% / 1% | 97.8 / 97.7% | 71.9 (715/2/1/1) | | this PR, `APS5_CPU_FLIP_IN_ORDER=1` | 608 / 594 | 16.8 / 30.9, 20.7 / 31.3 ms | 12.0 / 12.8 ms | 40% / 44% | 76.1 / 76.5% | 58.6 (382/205/0/1) | With the default present mode (FIFO), one run each: main 601 presents, p90 30.8 ms, interval sd 12.3 ms; this PR 722 presents, p90 15.9 ms, interval sd 1.9 ms. GPU busy per present is about 10 ms in every run. The frame is now bound by the queue worker. <details><summary>Summary lines (main ab1, PR ab1, in-order ab1, PR ab2, main ab2, in-order ab2, main fifo, PR fifo)</summary> ``` {"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":753,"ms":10007.221},"presents":602,"frame_ms":{"p50":17.183,"p90":30.955,"p99":36.148,"max":47.601},"gpu_busy_ms_per_present":10.066,"worker_busy_pct":{"queue worker 0x0":75.949},"top_phases_ms_per_frame":{"Driver.Packet":12.620,"Driver.Packet.draw":8.118,"Driver.Draw":8.072,"Driver.Draw.draw_and_resource_release":4.691,"Driver.Packet.device_lock":3.168,"Graphics.Draw":1.876,"Graphics.Draw.draw_and_resource_release":1.822,"Driver.Draw.shader_compile_and_link":1.698},"trace_dropped":false,"trace":"aps5-trace-fa9365ca74ac-7948.json.gz"} {"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":893,"ms":10008.238},"presents":737,"frame_ms":{"p50":13.252,"p90":15.020,"p99":18.156,"max":41.447},"gpu_busy_ms_per_present":9.866,"worker_busy_pct":{"queue worker 0x0":97.776},"top_phases_ms_per_frame":{"Driver.Packet":13.275,"Driver.Packet.draw":8.743,"Driver.Draw":8.695,"Driver.Draw.draw_and_resource_release":5.146,"Driver.Packet.device_lock":3.340,"Graphics.Draw":2.222,"Graphics.Draw.draw_and_resource_release":2.161,"Driver.Draw.shader_compile_and_link":1.825},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.173,"events_lost":58994,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-35660.json.gz"} {"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_CPU_FLIP_IN_ORDER":"1","APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":755,"ms":10013.217},"presents":608,"frame_ms":{"p50":16.833,"p90":30.890,"p99":33.398,"max":43.649},"gpu_busy_ms_per_present":10.035,"worker_busy_pct":{"queue worker 0x0":76.114},"top_phases_ms_per_frame":{"Driver.Packet":12.530,"Driver.Packet.draw":8.064,"Driver.Draw":8.017,"Driver.Draw.draw_and_resource_release":4.538,"Driver.Packet.device_lock":3.112,"Graphics.Draw":1.894,"Graphics.Draw.draw_and_resource_release":1.838,"Driver.Draw.shader_compile_and_link":1.759},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.964,"events_lost":1454,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-33736.json.gz"} {"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":917,"ms":10010.790},"presents":724,"frame_ms":{"p50":13.399,"p90":15.728,"p99":22.584,"max":37.264},"gpu_busy_ms_per_present":9.871,"worker_busy_pct":{"queue worker 0x0":97.731},"top_phases_ms_per_frame":{"Driver.Packet":13.511,"Driver.Packet.draw":8.902,"Driver.Draw":8.852,"Driver.Draw.draw_and_resource_release":5.085,"Driver.Packet.device_lock":3.360,"Graphics.Draw":2.289,"Graphics.Draw.draw_and_resource_release":2.226,"Driver.Draw.shader_compile_and_link":1.911},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.195,"events_lost":58091,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-34664.json.gz"} {"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":756,"ms":10014.395},"presents":600,"frame_ms":{"p50":15.050,"p90":31.099,"p99":38.922,"max":49.068},"gpu_busy_ms_per_present":9.939,"worker_busy_pct":{"queue worker 0x0":76.534},"top_phases_ms_per_frame":{"Driver.Packet":12.768,"Driver.Packet.draw":7.984,"Driver.Draw":7.934,"Driver.Draw.draw_and_resource_release":4.525,"Driver.Packet.device_lock":3.358,"Graphics.Draw":1.980,"Graphics.Draw.draw_and_resource_release":1.921,"Driver.Draw.shader_compile_and_link":1.820},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":9.919,"events_lost":2670,"totals_full":false}},"trace":"aps5-trace-fa9365ca74ac-27036.json.gz"} {"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_CPU_FLIP_IN_ORDER":"1","APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":759,"ms":10013.520},"presents":594,"frame_ms":{"p50":20.698,"p90":31.276,"p99":39.025,"max":58.915},"gpu_busy_ms_per_present":9.951,"worker_busy_pct":{"queue worker 0x0":76.486},"top_phases_ms_per_frame":{"Driver.Packet":12.888,"Driver.Packet.draw":8.137,"Driver.Draw":8.087,"Driver.Draw.draw_and_resource_release":4.657,"Driver.Packet.device_lock":3.335,"Graphics.Draw":1.957,"Graphics.Draw.draw_and_resource_release":1.900,"Driver.Draw.shader_compile_and_link":1.795},"trace_dropped":false,"trace":"aps5-trace-ae47bd08d7d1-6908.json.gz"} {"commit":"fa9365ca74ac","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":767,"ms":10015.494},"presents":601,"frame_ms":{"p50":14.162,"p90":30.770,"p99":34.510,"max":50.958},"gpu_busy_ms_per_present":9.939,"worker_busy_pct":{"queue worker 0x0":75.326},"top_phases_ms_per_frame":{"Driver.Packet":12.548,"Driver.Packet.draw":7.978,"Driver.Draw":7.931,"Driver.Draw.draw_and_resource_release":4.603,"Driver.Packet.device_lock":3.216,"Graphics.Draw":1.924,"Graphics.Draw.draw_and_resource_release":1.867,"Driver.Draw.shader_compile_and_link":1.762},"trace_dropped":false,"trace":"aps5-trace-fa9365ca74ac-4536.json.gz"} {"commit":"ae47bd08d7d1","dirty":false,"env":{"APS5_SPIRV_OPT":"none","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"15:10"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 15:10","first_present":884,"ms":10013.463},"presents":722,"frame_ms":{"p50":13.551,"p90":15.857,"p99":18.064,"max":37.536},"gpu_busy_ms_per_present":10.017,"worker_busy_pct":{"queue worker 0x0":97.788},"top_phases_ms_per_frame":{"Driver.Packet":13.560,"Driver.Packet.draw":8.913,"Driver.Draw":8.864,"Driver.Draw.draw_and_resource_release":5.329,"Driver.Packet.device_lock":3.412,"Graphics.Draw":2.224,"Graphics.Draw.draw_and_resource_release":2.162,"Driver.Present":1.925},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":8.161,"events_lost":59117,"totals_full":false}},"trace":"aps5-trace-ae47bd08d7d1-27796.json.gz"} ``` </details> **Black frames.** vkQuake shows near-black frames on main as well; `APS5_DUMP_FRAMES=60 APS5_DUMP_FRAMES_EVERY=20` gave 5 of 60 on main and 2 of 60 with this PR. Every one is an item pickup ("You got the Grenade Launcher", "You get 3 rockets"): the scene is black and only the HUD text is drawn. They are not caused by flip order, and I haven't looked into them further. **Tests** - New `video_out_flip_cpuflip`: 1. A command-buffer flip on a gated test output parks the queue worker. 2. A flip submitted from a new thread completes while the worker is parked. 3. A flip submitted from the thread that submitted the parked work does not complete until the gate is released. 4. Each flip presents its own argument. - `video_out_flip_cpuflip_in_order` runs the same test with `APS5_CPU_FLIP_IN_ORDER=1` and expects the first flip to wait as well. - Negative check: this branch's test executable run against main's libraries fails at step 2 (the flip waits for the parked work). With `APS5_CPU_FLIP_IN_ORDER=1` it passes. - The flip tests need a Vulkan window, and SDL's offscreen driver has none on Windows. So I ran every `video_out_flip_tests` mode directly with `SDL_VIDEODRIVER=windows ANYPS5_REQUIRE_DISPLAY=1`: - **RTX 4060:** `cpuflip` (both ways), `aftergpu`, `lifetime`, `reopen`, `deferred`, `unregistered`, `pacing`, `present`, `backtoback`, `onedevice`, `labels`, `labels_main`, `overlay`, `controls`, `unopened` and `decode` pass. `eop` and `eop_main` fail ("EOP packet did not finish its label and reserved flip"), and `eop_aftergpu` crashes; all three do the same with main's build on this machine. - **Intel UHD** (NVIDIA hidden with `VK_LOADER_DRIVERS_DISABLE=*nv-vk*`): `cpuflip` (both ways), `lifetime`, `deferred` and `pacing` pass. `aftergpu` fails with "the GPU work did not land", also with main's libraries. - **lavapipe 25.2.8:** `cpuflip` (both ways), `aftergpu`, `lifetime`, `deferred` and `pacing` pass. - RTX 4060, one at a time: `agc_driver_flip`, `agc_driver_flip_compute`, `agc_driver_flip_stores_small_results`, `agc_driver_presentation_pass`, `agc_driver_present_mode`, `agc_resident_present`, `agc_driver_gated_dispatch_capture` (and `_short_timeout`), `agc_driver_pipelined_predicated_label_order`, `agc_driver_same_queue_label_wait`, `agc_driver_unimported_label_order`, `agc_driver_queue_zero_idle_wait`, `agc_driver_wait_shutdown`, `agc_driver_registration_prepare_shutdown`, `agc_copied_direct_ordering`, `agc_storage_written_buffer_order`, `agc_queued_write_groups` and `video_out_hdr_present` pass. ### 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](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: none. #6208 also edits `Submission.cpp`, and #6134, #6188, #6292, #6454 and #6501 add `Driver.hpp` members; the overlap is textual only. - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU (Ada), driver 591.86, Windows 11; Intel UHD Graphics (Raptor Lake), driver 101.6790, Windows 11; lavapipe (Mesa 25.2.8), Windows 11 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 18:27:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T18:27:14Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 674 core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp
docs/dev/debt/libSceVideoOut.md
PR 4650 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 4891 core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp
PR 5021 core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 5404 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5431 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6044 core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6292 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6501 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6539 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6615 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6747 core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp
PR 6786 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6867 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp
PR 6879 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 6941 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6946 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6947 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6963 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp
core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/tests/Flip.cpp
docs/dev/debt/libSceVideoOut.md
PR 7008 core/libs/prx/libSceAgcDriver/Execution/include/VideoOutput.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp
core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 7201 core/libs/prx/libSceVideoOut/CMakeLists.txt
core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 7332 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
core/libs/prx/libSceVideoOut/tests/Flip.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199323267 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6199323267). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T18:27:14Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 674](https://www.github.com/boykopovar/AnyPS5/pull/674) | `core/libs/prx/libSceVideoOut/CMakeLists.txt`<br>`core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp`<br>`docs/dev/debt/libSceVideoOut.md` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceVideoOut/CMakeLists.txt`<br>`core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp`<br>`core/libs/prx/libSceVideoOut/tests/Flip.cpp` | | [PR 5404](https://www.github.com/boykopovar/AnyPS5/pull/5404) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceVideoOut/CMakeLists.txt`<br>`core/libs/prx/libSceVideoOut/tests/Flip.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6501](https://www.github.com/boykopovar/AnyPS5/pull/6501) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6747](https://www.github.com/boykopovar/AnyPS5/pull/6747) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp` | | [PR 6786](https://www.github.com/boykopovar/AnyPS5/pull/6786) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6867](https://www.github.com/boykopovar/AnyPS5/pull/6867) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 6941](https://www.github.com/boykopovar/AnyPS5/pull/6941) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6963](https://www.github.com/boykopovar/AnyPS5/pull/6963) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp`<br>`core/libs/prx/libSceVideoOut/CMakeLists.txt`<br>`core/libs/prx/libSceVideoOut/tests/Flip.cpp`<br>`docs/dev/debt/libSceVideoOut.md` | | [PR 7008](https://www.github.com/boykopovar/AnyPS5/pull/7008) | `core/libs/prx/libSceAgcDriver/Execution/include/VideoOutput.hpp`<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp`<br>`core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceVideoOut/CMakeLists.txt`<br>`core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp`<br>`core/libs/prx/libSceVideoOut/tests/Flip.cpp` | | [PR 7369](https://www.github.com/boykopovar/AnyPS5/pull/7369) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp` |
screamm commented 2026-10-16 08:28:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-16T08:28:35Z.


Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head f0d9d0122 merged on main 5d9dcc42d (together with #6504, no overlap, no conflicts). Only NVIDIA on Windows: no AMD, Intel or Linux run from me. The host was shared (other agents were compiling, CPU load 41 to 100% during the runs), so read the numbers as direction, not magnitude.

  • Build: only the known 64 KiB alignas AGC test fails (#6452/#6478). The two new flip tests skip under ctest's offscreen driver; run directly with SDL_VIDEODRIVER=windows ANYPS5_REQUIRE_DISPLAY=1, 3 times each: cpuflip passes, cpuflip with APS5_CPU_FLIP_IN_ORDER=1 passes, aftergpu passes.
  • Negative control: the PR's video_out_flip_tests cpuflip against main's libraries fails 3 of 3 ("a flip from a thread that never submitted queue-0 work waited for a held queue-0 submission"), passes with APS5_CPU_FLIP_IN_ORDER=1; aftergpu passes on main's libraries.
  • Non-GPU suite (838 tests, agc_driver_* and video_out_flip* excluded): 13 load timeouts, all pass on serial rerun or when run directly; none touches flips. check_conventions.py and git diff --check pass.
  • vkQuake PPSA99010 with the demo loop, the author's switches (APS5_TRACE_SECONDS=15:10, APS5_SPIRV_OPT=none, ANYPS5_PRESENT_MODE=immediate, r_rtshadows 0) plus APS5_TRACE_SUMMARY_EVERY=10, 120 s per run, default window size, shareware id1/pak0.pak, main/PR runs interleaved: 5 runs on main, 6 on the PR. Medians (range) over runs of the per-run median of the 10 s intervals: presents per 10 s 378 (183 to 546) on main, 544 (411 to 735) with the PR; frame p50 22.4 ms (15.2 to 48.1) vs 15.2 ms (12.6 to 21.9); frame p90 40.4 ms (33.5 to 102) vs 24.3 ms (18.0 to 34.7); queue worker busy 83.5% (75.7 to 97.6) vs 97.5% (96.1 to 97.6). Host CPU load: main median 76% (41 to 100), PR 66% (41 to 97). At the quietest pair (41% load): main p50/p90 15.2/34.3 ms, PR 12.6/18.0 ms. The ranges overlap because of the load, and two PR runs had a poor 15 s to 25 s window (167 and 223 presents) while their interval medians were normal, so the direction and the saturated worker match your description but I cannot confirm 60 to 72 presents per second or the interval sd.
  • Near-black frames in the 12 dumps per run (mean below 2): main 7 of 60, PR 7 of 72.
  • Not checked: the PPSA99005 (ps5-opengl) control, 4K, Intel, AMD, Linux, the agc_driver_* and video_out_flip* GPU suites, and a title that renders on one thread and flips from a thread that never submits (the case the debt note describes).

Two review points: (1) APS5_CPU_FLIP_IN_ORDER is a new environment switch; the condition already honours APS5_SYNC_FLIP, which the in-order test could use instead. (2) Per the perf policy this still needs AMD, Intel and Linux runs; mine only adds a second NVIDIA/Windows sample.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6211387164 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6211387164). Originally posted by [screamm](https://github.com/screamm) on 2026-10-16T08:28:35Z. --- Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head `f0d9d0122` merged on main `5d9dcc42d` (together with #6504, no overlap, no conflicts). Only NVIDIA on Windows: no AMD, Intel or Linux run from me. The host was shared (other agents were compiling, CPU load 41 to 100% during the runs), so read the numbers as direction, not magnitude. - Build: only the known 64 KiB `alignas` AGC test fails (#6452/#6478). The two new flip tests skip under ctest's offscreen driver; run directly with `SDL_VIDEODRIVER=windows ANYPS5_REQUIRE_DISPLAY=1`, 3 times each: `cpuflip` passes, `cpuflip` with `APS5_CPU_FLIP_IN_ORDER=1` passes, `aftergpu` passes. - Negative control: the PR's `video_out_flip_tests cpuflip` against main's libraries fails 3 of 3 ("a flip from a thread that never submitted queue-0 work waited for a held queue-0 submission"), passes with `APS5_CPU_FLIP_IN_ORDER=1`; `aftergpu` passes on main's libraries. - Non-GPU suite (838 tests, `agc_driver_*` and `video_out_flip*` excluded): 13 load timeouts, all pass on serial rerun or when run directly; none touches flips. `check_conventions.py` and `git diff --check` pass. - vkQuake PPSA99010 with the demo loop, the author's switches (`APS5_TRACE_SECONDS=15:10`, `APS5_SPIRV_OPT=none`, `ANYPS5_PRESENT_MODE=immediate`, `r_rtshadows 0`) plus `APS5_TRACE_SUMMARY_EVERY=10`, 120 s per run, default window size, shareware `id1/pak0.pak`, main/PR runs interleaved: 5 runs on main, 6 on the PR. Medians (range) over runs of the per-run median of the 10 s intervals: presents per 10 s 378 (183 to 546) on main, 544 (411 to 735) with the PR; frame p50 22.4 ms (15.2 to 48.1) vs 15.2 ms (12.6 to 21.9); frame p90 40.4 ms (33.5 to 102) vs 24.3 ms (18.0 to 34.7); queue worker busy 83.5% (75.7 to 97.6) vs 97.5% (96.1 to 97.6). Host CPU load: main median 76% (41 to 100), PR 66% (41 to 97). At the quietest pair (41% load): main p50/p90 15.2/34.3 ms, PR 12.6/18.0 ms. The ranges overlap because of the load, and two PR runs had a poor 15 s to 25 s window (167 and 223 presents) while their interval medians were normal, so the direction and the saturated worker match your description but I cannot confirm 60 to 72 presents per second or the interval sd. - Near-black frames in the 12 dumps per run (mean below 2): main 7 of 60, PR 7 of 72. - Not checked: the PPSA99005 (ps5-opengl) control, 4K, Intel, AMD, Linux, the `agc_driver_*` and `video_out_flip*` GPU suites, and a title that renders on one thread and flips from a thread that never submits (the case the debt note describes). Two review points: (1) `APS5_CPU_FLIP_IN_ORDER` is a new environment switch; the condition already honours `APS5_SYNC_FLIP`, which the in-order test could use instead. (2) Per the perf policy this still needs AMD, Intel and Linux runs; mine only adds a second NVIDIA/Windows sample. Written with Claude Code assistance (validation by a subagent, reviewed in this session).
blawesom commented 2026-10-16 17:22:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-16T17:22:55Z.


Rebase handoff — rebased onto current main (authorship unchanged). One conflict in Submission.cpp: main extended the compute-queue bound to SubmissionQueueEnd and added the submission-ring preparation, while this PR adds the flip-ordering logic (flipsInOrder/unorderedFlip/submitsQueue0) at the same spot; the merged version keeps main's queue bound and ring setup followed by this PR's flip logic.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1286/1287 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6507
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 7510b102d.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6220942880 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6220942880). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-16T17:22:55Z. --- **Rebase handoff** — rebased onto current `main` (authorship unchanged). One conflict in `Submission.cpp`: `main` extended the compute-queue bound to `SubmissionQueueEnd` and added the submission-ring preparation, while this PR adds the flip-ordering logic (`flipsInOrder`/`unorderedFlip`/`submitsQueue0`) at the same spot; the merged version keeps `main`'s queue bound and ring setup followed by this PR's flip logic. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1286/1287** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6507 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `7510b102d`.
blawesom commented 2026-10-17 12:14:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T12:14:14Z.


Re-anchored rebase handoff — main moved since the earlier handoff; rebased onto current main again (authorship unchanged). The same resolution: main's queue bound and ring preparation followed by your flip-ordering logic, and both flip test modes (ps4, cpuflip) kept.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1338/1339 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6507
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is ca5ce7ad3.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233754949 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6233754949). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T12:14:14Z. --- **Re-anchored rebase handoff** — `main` moved since the earlier handoff; rebased onto current `main` again (authorship unchanged). The same resolution: `main`'s queue bound and ring preparation followed by your flip-ordering logic, and both flip test modes (`ps4`, `cpuflip`) kept. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1338/1339** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6507 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `ca5ce7ad3`.
karanvora2599 commented 2026-10-18 00:57:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-18T00:57:56Z.


Rebased onto main 51cee9031 (db091f5fb). Thanks @blawesom for the two rebase handoffs. I redid the rebase on my side with the same resolution: main's queue bound and submission-ring setup first, then the flip ordering, and both the ps4 and cpuflip modes kept. On the new head, all 18 video_out_flip_tests modes I can run pass on the RTX 4060 (ps4 and cpuflip among them; cpuflip passes both by default and with APS5_CPU_FLIP_IN_ORDER=1). A vkQuake A/B against main 51cee9031 (main, PR, main, PR; same settings as the table) repeats the result:

Build presents in 10 s interval sd intervals > 25 ms frame p90
main 51cee9031 604 / 598 12.7 / 12.1 ms 41% / 45% 30.9 / 30.9 ms
this PR, db091f5fb 719 / 717 2.0 / 1.8 ms 0% / 0% 15.4 / 15.4 ms

These four traces are attached below too. A flip that skips the queue isn't a queue-0 submission, so it takes no serial and isn't kept in the PM4 ring; the description says so now.

@screamm, thanks for the Windows run. On your two points:

  1. APS5_SYNC_FLIP isn't the same as main. It also parks the queue worker until the presenter has finished each flip (FlipRequest::GpuReady), and it turns off in-flight presentation (FlipInFlight() returns 0). A control run with it would change two things at once. APS5_CPU_FLIP_IN_ORDER=1 restores only main's flip order, which is why the control rows in the table match main. I'd keep it as the A/B switch, and it's listed in the debt note.
  2. Other vendors: the flip tests ran on the Intel UHD and lavapipe as well as the RTX 4060, and @blawesom's rebase ran the full suite on an RX 9070 XT with RADV. I don't have an AMD or Linux machine for a vkQuake run. A 4K run on the Intel iGPU here would be bound by that GPU, so it wouldn't show the queue-worker effect. An AMD or Linux vkQuake run from anyone would be welcome.

The traces for the table are attached below.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6243971481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6243971481). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-18T00:57:56Z. --- Rebased onto `main` 51cee9031 (db091f5fb). Thanks @blawesom for the two rebase handoffs. I redid the rebase on my side with the same resolution: `main`'s queue bound and submission-ring setup first, then the flip ordering, and both the `ps4` and `cpuflip` modes kept. On the new head, all 18 `video_out_flip_tests` modes I can run pass on the RTX 4060 (`ps4` and `cpuflip` among them; `cpuflip` passes both by default and with `APS5_CPU_FLIP_IN_ORDER=1`). A vkQuake A/B against `main` 51cee9031 (main, PR, main, PR; same settings as the table) repeats the result: | Build | presents in 10 s | interval sd | intervals > 25 ms | frame p90 | |---|---|---|---|---| | `main` 51cee9031 | 604 / 598 | 12.7 / 12.1 ms | 41% / 45% | 30.9 / 30.9 ms | | this PR, db091f5fb | 719 / 717 | 2.0 / 1.8 ms | 0% / 0% | 15.4 / 15.4 ms | These four traces are attached below too. A flip that skips the queue isn't a queue-0 submission, so it takes no serial and isn't kept in the PM4 ring; the description says so now. @screamm, thanks for the Windows run. On your two points: 1. `APS5_SYNC_FLIP` isn't the same as `main`. It also parks the queue worker until the presenter has finished each flip (`FlipRequest::GpuReady`), and it turns off in-flight presentation (`FlipInFlight()` returns 0). A control run with it would change two things at once. `APS5_CPU_FLIP_IN_ORDER=1` restores only `main`'s flip order, which is why the control rows in the table match `main`. I'd keep it as the A/B switch, and it's listed in the debt note. 2. Other vendors: the flip tests ran on the Intel UHD and lavapipe as well as the RTX 4060, and @blawesom's rebase ran the full suite on an RX 9070 XT with RADV. I don't have an AMD or Linux machine for a vkQuake run. A 4K run on the Intel iGPU here would be bound by that GPU, so it wouldn't show the queue-worker effect. An AMD or Linux vkQuake run from anyone would be welcome. The traces for the table are attached below.
karanvora2599 commented 2026-10-18 01:29:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-18T01:29:58Z.


Traces for the vkQuake runs (PPSA99010, RTX 4060 Laptop, driver 591.86, APS5_TRACE_SECONDS=15:10, APS5_SPIRV_OPT=none, ANYPS5_PRESENT_MODE=immediate except the two FIFO runs), in run order.

The table in the description (ae47bd08d, this change on main fa9365ca7):

  1. main fa9365ca7, ab1: main-cf-ab1-aps5-trace-fa9365ca74ac-7948.json.gz
  2. this PR, ab1: fix-cf-ab1-aps5-trace-ae47bd08d7d1-35660.json.gz
  3. this PR with APS5_CPU_FLIP_IN_ORDER=1, ab1: fix-cf-ord1-aps5-trace-ae47bd08d7d1-33736.json.gz
  4. this PR, ab2: fix-cf-ab2-aps5-trace-ae47bd08d7d1-34664.json.gz
  5. main fa9365ca7, ab2: main-cf-ab2-aps5-trace-fa9365ca74ac-27036.json.gz
  6. this PR with APS5_CPU_FLIP_IN_ORDER=1, ab2: fix-cf-ord2-aps5-trace-ae47bd08d7d1-6908.json.gz
  7. main, FIFO: main-cf-fifo1-aps5-trace-fa9365ca74ac-4536.json.gz
  8. this PR, FIFO: fix-cf-fifo1-aps5-trace-ae47bd08d7d1-27796.json.gz

The rebased head db091f5fb against main 51cee9031 (my comment above):

  1. main 51cee9031, r1: main-r1-aps5-trace-51cee90311b4-36732.json.gz
  2. this PR, r1: fix-r1-aps5-trace-db091f5fbb1e-20516.json.gz
  3. main 51cee9031, r2: main-r2-aps5-trace-51cee90311b4-16048.json.gz
  4. this PR, r2: fix-r2-aps5-trace-db091f5fbb1e-23388.json.gz

Each file's summary line is in the description or in that comment, in the same order.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6244234213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6507#issuecomment-6244234213). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-18T01:29:58Z. --- Traces for the vkQuake runs (PPSA99010, RTX 4060 Laptop, driver 591.86, `APS5_TRACE_SECONDS=15:10`, `APS5_SPIRV_OPT=none`, `ANYPS5_PRESENT_MODE=immediate` except the two FIFO runs), in run order. The table in the description (ae47bd08d, this change on main fa9365ca7): 1. main fa9365ca7, ab1: [main-cf-ab1-aps5-trace-fa9365ca74ac-7948.json.gz](https://github.com/user-attachments/files/33614768/main-cf-ab1-aps5-trace-fa9365ca74ac-7948.json.gz) 2. this PR, ab1: [fix-cf-ab1-aps5-trace-ae47bd08d7d1-35660.json.gz](https://github.com/user-attachments/files/33614769/fix-cf-ab1-aps5-trace-ae47bd08d7d1-35660.json.gz) 3. this PR with `APS5_CPU_FLIP_IN_ORDER=1`, ab1: [fix-cf-ord1-aps5-trace-ae47bd08d7d1-33736.json.gz](https://github.com/user-attachments/files/33614770/fix-cf-ord1-aps5-trace-ae47bd08d7d1-33736.json.gz) 4. this PR, ab2: [fix-cf-ab2-aps5-trace-ae47bd08d7d1-34664.json.gz](https://github.com/user-attachments/files/33614771/fix-cf-ab2-aps5-trace-ae47bd08d7d1-34664.json.gz) 5. main fa9365ca7, ab2: [main-cf-ab2-aps5-trace-fa9365ca74ac-27036.json.gz](https://github.com/user-attachments/files/33614773/main-cf-ab2-aps5-trace-fa9365ca74ac-27036.json.gz) 6. this PR with `APS5_CPU_FLIP_IN_ORDER=1`, ab2: [fix-cf-ord2-aps5-trace-ae47bd08d7d1-6908.json.gz](https://github.com/user-attachments/files/33614774/fix-cf-ord2-aps5-trace-ae47bd08d7d1-6908.json.gz) 7. main, FIFO: [main-cf-fifo1-aps5-trace-fa9365ca74ac-4536.json.gz](https://github.com/user-attachments/files/33614775/main-cf-fifo1-aps5-trace-fa9365ca74ac-4536.json.gz) 8. this PR, FIFO: [fix-cf-fifo1-aps5-trace-ae47bd08d7d1-27796.json.gz](https://github.com/user-attachments/files/33614776/fix-cf-fifo1-aps5-trace-ae47bd08d7d1-27796.json.gz) The rebased head db091f5fb against main 51cee9031 (my comment above): 1. main 51cee9031, r1: [main-r1-aps5-trace-51cee90311b4-36732.json.gz](https://github.com/user-attachments/files/33614777/main-r1-aps5-trace-51cee90311b4-36732.json.gz) 2. this PR, r1: [fix-r1-aps5-trace-db091f5fbb1e-20516.json.gz](https://github.com/user-attachments/files/33614778/fix-r1-aps5-trace-db091f5fbb1e-20516.json.gz) 3. main 51cee9031, r2: [main-r2-aps5-trace-51cee90311b4-16048.json.gz](https://github.com/user-attachments/files/33614779/main-r2-aps5-trace-51cee90311b4-16048.json.gz) 4. this PR, r2: [fix-r2-aps5-trace-db091f5fbb1e-23388.json.gz](https://github.com/user-attachments/files/33614780/fix-r2-aps5-trace-db091f5fbb1e-23388.json.gz) Each file's summary line is in the description or in that comment, in the same order.
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!6507
No description provided.