fix(agc): keep RADV's descriptor pool overrun inside the pool's pages #1065
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1065"
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 alfalfa-star on 2026-10-07T07:19:10Z.
What
The descriptor cache's chain pools are created with two more storage buffer descriptors than a set may take (
ChainPoolCreateSizes). This keeps a RADV overrun inside the pool's pages. A TechnicalDebt line records the workaround.RADV (Mesa 26.0 and later, since 849d41db "radv: implement a new descriptor sets allocator") sets up a
FREE_DESCRIPTOR_SETpool's allocator withutil_vma_heap_inittakes a start and a size, so the heap ends 32 bytes past the pool's buffer, and a set can be placed up to 32 bytes past its end. Mesa main still has this. The chain pools come out at exactly 0x26000 bytes, a page multiple, so those 32 bytes are an unmapped page:SQC (data)). The gfx ring times out and is reset, and the recorder then waits on a fence that never signals. In PPSA14632, Unreal aborts after 120 s withGameThread timed out waiting for RenderThread. ARADV_DEBUG=hangdump shows a 160-byte set at offset 0x25f80, with ans_load_b128of its storage buffer descriptor at 0x26000.vkUpdateDescriptorSetscan write there. Under GPU-assisted validation this segfaulted inradv_write_sampler_descriptor, with the destination exactly at the end of a 0x26000-byte/dev/dri/renderD128mapping.With two more storage buffers the pool is 0x26020 bytes. The 16-byte slack RADV adds per set is already capped by
maxSets, so the only change is the 32 bytes. The buffer then spans 0x27000 bytes and the overrun stays in mapped memory. The other pools in the driver are linear (noFREE_DESCRIPTOR_SET), and RADV bounds those correctly.Standalone repro on RADV, no AnyPS5 needed: a pool for four sampled images (128 bytes,
maxSets1).FREE_DESCRIPTOR_SETpoolVK_ERROR_OUT_OF_POOL_MEMORYVK_ERROR_OUT_OF_POOL_MEMORYVK_ERROR_FRAGMENTED_POOLTested
Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT (RDNA4).
cteston this branch: 382 of 382 pass.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T07:35:01Z.
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)docs/dev/TechnicalDebt.mdL255core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL2155-2156docs/dev/TechnicalDebt.mdL255Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T05:49:35Z.
Checked: build + ctest on the merge with current
main(415/415), CI green, and the RADVutil_vma_heap_init(bo_size + RADV_POOL_HEAP_OFFSET)claim against Mesa main (radv_descriptor_pool.c). The pool size arithmetic (0x26000 → 0x26020) matches, andChainPoolSizesstill drives the capacity check. Merging.Note for #1184: it rewrites the same
poolInfolines inShaderResources.cpp, so whichever lands second needs a rebase.