Repository navigation
fix(libc): register guest heap blocks without GPU access - #3213
Conversation
AnyPS5's libc heap registered every block with GPU access, so every address-based build imported or mirrored each malloc block the title had made. The console's libc.prx maps its heap with protection 3 (CPU read and write, no GPU bits), so the GPU never sees it there either. Heap blocks are now registered without GPU access; reallocating keeps the block's access. The AvPlayer fallback for a title that passes no texture allocator stands in for that allocator, which hands out memory the GPU reads, so it allocates through a new GuestHeapAlignForGpu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Windows run, since the PR has no Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto
In the full AI-assisted (Claude Code); I ran this on my machine. |
|
Checked the diff: heap blocks register without GPU access, realloc/realign keep it, |
What
This is the follow-up #1905 left open: AnyPS5's own libc heap without GPU access. @TheAggie measured what it costs today in #1905: vkQuake (PPSA99010, homebrew, RADV) makes about 10,000 small blocks through this heap, every address-based build refreshes a heap mirror for each, and leaving only those blocks out took the demo from about 22 to 44 FPS, with correct rendering and no BDA faults.
AnyPS5's libc heap registered every block it hands out with GPU access, so every address-based build imported or mirrored each of the title's malloc blocks. On the console the heap is not GPU memory: a title's own
libc.prxmaps it withsceKernelMapNamedFlexibleMemoryInternaland protection3(CPU read and write, no GPU bits). PPSA36082's bundledlibc.prxdoes this at both of its heap mapping sites (+0xb2eb,+0xb4fd).GuestHeapAlignForGpu, which registers the block with GPU access.Of the local changes I listed in #1905, this is the libc heap part of the first one (GPU read and write kept apart), taken alone because of that measurement. The rest stay local. In particular, paths other than address-based builds (DMA copies, textures) still import a heap block if a title points them at one; making every path follow GPU access was the second change listed there.
Tested
Linux, RTX 4090, NVIDIA 615.71.09, local run of the Linux CI job (SPIRV tools on): ctest 754/755. The failure,
agc_driver_dcc_keys_first_write, fails the same way on main.agc_driver_graphics(tests/BdaResources.cpp): a plain heap block has no GPU access and is left out of an address-based build, a block fromGuestHeapAlignForGpuhas it and is in the build, and both keep their access through a reallocation. Registering plain blocks with GPU access again, as main does, fails it. The cached-address-space test andagc_driver's copy into host memory model memory the GPU reads, so they now allocate it with GPU access.libc.prx, so I expected no change): boot and the hub, no BDA faults, the same frame rate within noise (34.0 / 34.5 fps).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)