perf(agc): keep the 10-bit scanout resident and present it with the guest path's pixels #278
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/278"
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-01T21:36:46Z.
What
A title that composites into a 10-bit scanout (
COLOR_2_10_10_10with the alternate swap, A2R10G10B10) never presents from a resident image. No guest texture format matches that color format, so the target stays non-resident. Every frame's composite draw then runs synchronously, and the flip reads the frame back through guest memory. On main,ResidentPresentablealso only accepts an image in exactly the display's format, and it would blit a 10-bit image. A blit rounds where the guest-memory path drops each channel's low two bits.FindGuestColorTargetFormat).DisplayFormat.cppnames a display buffer's texel order as the guest-memory path reads it: red low for the R8G8B8A8 base, otherwise blue low, with A2B10G10R10 or A2R10G10B10 for the 10-bit variant. The bit-56 and R8G8B8A8 checks thatVulkanDevice.cpprepeated in two places now use it.ResidentPresentPathblits a resident image only when it holds the display's 8-bit texel format and can be a blit source, which makes it an exact copy. It converts instead when the image is 10-bit, holds the other 8-bit order or is an sRGB type that a blit would decode.GpuColorTransfer::DetileImagecopies the image's texels raw into the color transfer's buffer and runs the guest path's own conversion shader on them, so both paths present the same pixels. A converted present uses the shared transfer and scaler source, so it waits for the slots like the guest-memory path (PresentWaitsForSlots).This builds on the recorder's resident presentation path (
ResidentPresentable/PresentableResident, from #5) and @boykopovar's GPU color transfer (7ed9ef1e).DetileImagereusesGpuColorTransfer's buffers and pipeline.convertwas split into the copy and adispatchso the image path skips the guest upload.Measured in PPSA21564 on my integration branch: the final composite renders into 4K A2R10G10B10 scanout buffers. Before this change that composite ran synchronously, about 11 ms each, 143 times per 10 s at the title, plus a guest-memory readback for every flip. With this change the scanout stays resident, so the composite is recorded like any other draw and the flip presents from the image through the conversion, with no readback.
Tested
tests/ResidentPresent.cpp, run fromagc_driver_recorder_tests(a GPU test, built but not part of ctest):DetileImage. The result must equal both the CPU decode (DecodeDisplayBuffer) and the GPU detile of the same words in guest memory.TextureFormat.cppline it fails with "the blue-low 10-bit color target has no storage format".ctest --test-dir build --timeout 120: 96/96 pass on current main with this branch.agc_driver_recorder_tests,agc_driver_graphics_testsandagc_structurizer_testspass when run directly, and thelibstarget builds.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