fix(agc-driver): queue frame dumps at the dump scale #4320
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4320"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T06:04:20Z.
What
With
APS5_DUMP_FRAMESset, a run can end withVulkan presentation: frame dump queue exceeded 64 MiB. It depends on timing: the same build aborted on one run and finished on the next.A frame presented from guest memory is read back at the size of the display buffer (
PresentSlot::dumpBuffer, 31.6 MiB for 3840x2160).WriteFrameDumpcopied all of it intoFrameDumpWriter's queue and passed the scale along, so the reduction toAPS5_DUMP_SCALEhappened later, on the writer thread. The queue is limited to 64 MiB and a frame counts until its file is written, so two such frames fill it and the third one that arrives while the writer is still busy throws. A frame blitted from the resident image does not have this problem: it is reduced on the GPU (dumpScaler) and queued at the reduced size with scale 1. The dump code is from #76; the message started to appear in runs after #3777.The change:
WriteFrameDumpreduces the readback by the slot's dump scale when the slot retires and queues the reduced pixels with scale 1, as the resident path does. The pixels kept are the same onesWriteFrameBmpkept before (everyscale-th pixel in each direction), so the files do not change. At the default scale of 4 a 3840x2160 frame takes 1.98 MiB of the queue instead of 31.6 MiB, and the presenter copies those 1.98 MiB instead of the whole readback.What this does not change: the limit itself. With
APS5_DUMP_SCALE=1nothing is reduced, a 3840x2160 frame is still 31.6 MiB on either path, and the third frame behind a busy writer still throws. At scale 4 the same happens once the writer is 32 frames behind. If the queue should make the presenter wait for the writer instead of throwing when it is full, that is a different change toFrameDumpWriter::Enqueueand I left it alone; say if you want it.Tested
Linux (CachyOS, GCC, RTX 4090, NVIDIA driver), Release, configured with the CI flags (
-DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON), onmainb42ef24e:video_out_frame_dump_queue(new, not on Windows): registers a 3840x2160 display buffer in guest memory and flips it four times withAPS5_DUMP_FRAMES=4andAPS5_DUMP_SCALE=4, throughsceVideoOutSubmitFlipand the driver's presenter.frame_000.bmpis a named pipe the test does not read until the four flips are done, so the writer is held on the first file for certain. It then reads the four dumps and compares every pixel withReadDisplayBufferof the same buffer.mainit fails 5 of 5 runs at the third flip with[videoout] presentation failed: Vulkan presentation: frame dump queue exceeded 64 MiB, the message from the game runs. With the change it passes 5 of 5.APS5_DUMP_SCALE=1still stops at the third frame with that message with the change (see above).ANYPS5_VIDEO_OUT_TEST_DRIVER=offscreenit reportsskipped, no display or Vulkan device, which is what the CI job will show. The runs above are with-DANYPS5_VIDEO_OUT_TEST_DRIVER=x11.ctest -R "agc|video_out"with the x11 driver: 447 of 447 pass; onmain446 of 447, the new test being the one that fails.python3 tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.Not tested: a game run with GPU frame dumps (in ten earlier runs of a 2D title we test with, five with this change and five without, the message did not appear either way, so game runs do not show anything here); Windows (the change is not platform specific, but the test uses a named pipe and is not registered there);
PresentPixelsandAPS5_NO_GPU_DUMP=1, which write their files directly and do not use the queue.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T06:15:13Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL595