With GPU_MENU=1, every menu screen is drawn by the PS5's GPU through Vulkan
(Mesa RADV from PS5_Mesa) at the
display's full resolution. Playback is unchanged: the moment a title starts,
the display goes back to the CPU path it has always used.
Measured on Brett's PS5 at 3840x2160, Home screen (frame cost trace lines):
| CPU renderer | GPU, first version | GPU now | |
|---|---|---|---|
| Frames per second | ~20 | ~20 | 59.9 (the refresh rate) |
| GPU work per frame | n/a | not measured | 1.5 ms |
| Dispatches per frame | n/a | ~490 | ~60 |
| Pixels checksummed per frame | n/a | 66-98 MB | 0 |
gfx keeps its drawing API. While the GPU menu is active, each primitive
(fill, gradient, image, rounded rectangle, shadow, arc, stroke, glyph) becomes
one compute dispatch of shaders/menu.comp into a 4K surface owned by
gpu_menu. present() adds one more dispatch that converts that surface into
the display's tiled buffer, which VideoOut scans out directly
(VK_EXT_external_memory_host).
- Pictures are named, not compared. A decoded poster or backdrop gets an
id when it enters the image cache (
gfx::Bitmap::id), and the cached background composition is named by its composition count. The GPU keeps one copy per id and never reads the pixels again. Unnamed pixels still work: a checksum finds them and a byte comparison confirms them. - Text and icons are batched. Glyph and icon masks go into one 32 MiB
atlas, uploaded once per character, size and weight (
text.cpp,icons.cppname them). A run of glyphs is one dispatch with one workgroup layer per glyph, instead of one dispatch each. - Barriers only where they are needed. A dispatch waits for earlier ones only when its clip rectangle overlaps one written since the last barrier. Glyphs along a line, cards in a row and most panels never do.
- Opaque and transparent pixels skip the blend, exactly as the CPU renderer does, so most of the screen is written without being read.
- Backdrops are composed on the GPU.
media_scrimcombines the base, vertical and horizontal darkening in one integer-matched dispatch. Home and detail pages skip their CPU background cache while accelerated; a new focused item no longer builds and uploads a 4K composition. CPU fallback retains its cache. Host comparison tests cover full and clipped scrims, degenerate ramps, and the absence of CPU synchronization in the menu scene.
GPU timestamps showed the work itself takes 1.5 ms, but a submission finishes about 16.7 ms after it is made: this console starts GPU work about a refresh late (PS5_Vulkan's notes call this R68, seen on a regular PS5 even with the suspend point that fixes it on a Pro). Waiting for that, then for the flip, cost two refreshes per frame.
So the render thread never waits for the GPU in menus:
- It records the frame into one of three submission slots and submits it.
- It hands
{display buffer, slot}to the flip thread and starts the next frame. - The flip thread waits for that submission, flips the buffer, and waits for the flip to show. Then it frees the buffer that was on screen.
There are three display buffers (kFrameCount): one on screen, one waiting to
flip, one being written. Frames reach the screen about two refreshes after
they are drawn. Each submission's command buffer starts with a barrier after
all earlier GPU writes and reads, because submissions are no longer waited for
and the previous frame's scanout may still be reading the surface.
wait_for_flip() first empties the flip thread (drain_flips()), so every
caller that touches the display gets it back exactly as before: entering
playback (set_menu_acceleration(false)), HDR/SDR switches, captures,
benchmarks and shutdown. Playback then flips and waits for every frame on the
render thread, as it always has. shutdown() stops the flip thread before
releasing the GPU.
On entering playback the trace records the largest free direct-memory block
(gfx: playback takes the display; largest free direct block ...); 1846 MiB
of 2304 on the last check. All Vulkan memory types come from the same direct
memory on this console, so the memory type choice in gpu_menu.cpp does not
change what the video decoder can get.
Every 120 frames:
frame cost: 59.9 fps, present 0.0 ms, buffer wait 16.3 ms, gpu busy 1.5 ms,
gpu start-to-finish 16.6 ms, cpu wait for gpu 0.0 ms, 59 dispatches,
454 glyphs, 33 barriers, 1.0 submits, 0.00 cpu syncs, hashed 0.0 MB, ...
- buffer wait: the render thread idle until a display buffer is free; this is the headroom left in the frame.
- gpu busy: the GPU's own timestamps around each submission.
- gpu start-to-finish: submission to completion, as the flip thread saw it.
- cpu syncs / read back: CPU drawing forced a round trip; should stay 0 in menus. hashed: unnamed pixels compared; should stay near 0.
bash tools/setup-gpu-menu.sh # once: fetches and builds RADV (pinned)
GPU_MENU=1 make PS5_CLANG=/usr/bin/clang SOFTWARE_AUDIO=1
bash tools/test-gpu-menu.sh # GPU and CPU renderers agree, 4 sizestools/test-gpu-menu.sh draws the same scene with both renderers on the
host's own Vulkan device. It fails when more than one pixel in 10,000 differs
by more than 2/255 (rounding at arc edges is all it allows), when the tiled
scanout disagrees with the surface, or when new pixels at a reused address
come back stale. The last run: 44 pixels differ, by 1/255 at most.
The test also wraps the three submission/display slots repeatedly, switches to CPU rendering and back, and shuts down with a frame queued. These are host regressions for display ownership; they do not replace console playback tests.
Mesa deliberately leaves some weak entrypoint hooks undefined so its dispatch tables can select a common implementation. LLD 18 preserves these absent hooks as dynamic imports, which the PS5 module converter correctly rejects as having no system-module provider. Newer LLD resolves them to null at link time.
tools/gpu-weak-entrypoints.py identifies only unimplemented, weak-only
radv_* and vk_common_* hooks in the pinned driver archive. The link recipe
resolves these to zero locally on both toolchains. Defined implementations,
strong references and system-module import validation stay intact.
tests/test_gpu_link.py checks those distinctions and links a small fixture
without building Mesa. Set GPU_TEST_LLD to test another linker executable.
CI explicitly runs this regression with ld.lld-18.