What changes for the guest: on a host whose GPU shares the CPU's memory
(RGFX_FEATURE_SURFACE_CACHE_REFUSED), with VA-API's hardware video (the
Radeon 780M's radeonsi, the Iris Xe's iHD), the video caps now say
RGFX_VIDEO_CAPS_OUTPUT_CACHED, with no output layouts, as a host of a GPU
of its own memory says them where its video lands pictures in caches. The
guest's video driver then asks its output surfaces cached, with their
layout, as any other surface (RgfxAskUncachedScope no longer covers them),
and the device keeps a cache of those it answers RGFX_STATUS_CACHE: an
output whose textures would not lie in place in its pages, or whose view
has no room for its mappings. A picture lands in such a cache by the
runtime device's copy of the decode surface (or the CPU's, through the
session's staging, where that copy is refused), and a CPU read of a decoded
frame has the cache copied out into its pages first. An output that lies
in place stays in its pages, as before.
For the host: VaapiVideo::lands_in_device_caches is true, and the device
offers cached outputs wherever the kext makes caches (video_caps, out of
GraphicsDevice::with_platform). The caches lay the first plane on 256
bytes of their memory (the commit before), so textures over the decoded
planes lie in them rather than in the runtime's shadows.
Measured on guest boots of macOS 26.7.2, Safari playing 4K60 HEVC clips
(8-bit, then 10-bit; then two and three at once), against development
81f187735 on the same host, vm.max_map_count 1048576, before this change
was rebased onto development's df50639ea (a laid-out cache's bytes between
rows declared unobserved), which the boots did not include:
- Radeon 780M (radeonsi and RADV, Mesa 26.2.6): the runtime's shadow
texels copied in per presented frame fell from 10.2-15.6 M to 0.00-0.03 M.
18 of 85 sessions landed in caches (4K outputs whose planes exceed
udmabuf's 1024 pieces), the rest in place; 148 caches were made aligned.
Presented fps 55.8/55.5 single, 53.9/57.0 two, 52.1/51.9/54.0 three
(development 57.0/57.2, 56.0/57.5, 53.9/53.3/52.6), drops 14/14/6 at
three (13/15/5). Mappings 5.7-6.6 k both.
- Iris Xe (iHD, ANV Mesa 26.2.6), where ANV answers a cache for every
surface: all 85 sessions landed in caches, and the process's mappings
peaked at 13.3 k (311 k on development). Shadow texels 0.07-0.32 M per
frame both. Presented fps 53.3/54.0 single, 54.4/53.6 two,
54.5/55.2/55.0 three (development 57.1/56.6, 55.4/53.9, 54.0/51.8/54.0),
at most 2 drops a clip; a second pair of boots, development's first,
gave 56.5/55.4 single (development 54.1/55.7): the single clips' spread
is the boots', not the change's.
- Both: 0 pictures copied by the CPU, 0 fatal lines. A guest process
reading every decoded frame on the CPU (decode_md5 against ffmpeg's
framemd5) matched on 63 of 75 streams both ways, the same 12 failing on
development, the three 4K streams (in caches) among those matching. The
byte-exact test lands every third of 4951 pictures of the conformance
streams in a cache made as the device makes one, equal to the CPU's copy.
- RTX 5080 Laptop GPU (NVDEC): its caps and caches are as before (no cache
made aligned); the boot's playback swung as development's does there.