fix(agc): record large memory-to-memory DMA_DATA copies on the GPU in queue order #439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/439"
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-03T07:35:02Z.
What
A memory-to-memory DMA_DATA larger than the 64 KiB store limit drained the device and was then copied with a CPU memcpy on the submitting queue's worker thread. For a large range that copy takes milliseconds, and meanwhile another queue's worker records and runs work that reads the destination in place.
PPSA21564 copies each decoded frame of its intro video (a 3840x3240 R8 NV12 surface, 12 MiB) into one of two textures with a single DMA_DATA on an async queue, and samples the texture on queue 0 without waiting for that queue. On the console the DMA finishes in microseconds, so the title never needs to wait. Here the copy took 5 to 10 ms, and queue 0's upload of the texture ran while the copy was still writing it: a frame showed the new frame's luma over the chroma of the frame two before (torn video frames once the intro runs at about 56 fps).
Pm4::DecodeMemoryCopyrecognises a memory-to-memory DMA_DATA: both selectors memory, both addresses incrementing, no GDS, immediate or register operand, ranges non-empty and disjoint.preparePacketMemory, such a copy above the store limit now goes throughVulkanDevice::CopyBuffer, the path the copy kernel already uses, with no CPU path (cpuMax0). It records a transfer between the host imports in queue order, with the source's pending storage results flushed first and pending write and read notes taken, so everything recorded after the packet reads the whole copy and work recorded before it reads the old bytes, as on hardware.Tested
BUILD_TESTING=ONandctestpass (126/126).testMemoryCopyDecodeinagc_driver_pm4: a memory-to-memory copy decodes with its addresses and size; immediate fills, GDS on either side, register operands, non-incrementing addresses, an empty copy, overlapping ranges and COPY_DATA do not; adjacent ranges do. The function is new, so the test does not build without this change. The race itself depends on thread timing and has no deterministic test.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)