Files
reims-vgpu/docs/graphics-kext
Anees Iqbal aad69b90cd 🐎 Lay a device cache out at the GPU's pitch
A device cache held its surface's bytes in the pages' layout, so a texture
over a plane whose rows lie at another pitch than the GPU's own linear images
lay them was the runtime's shadow: an image of its own that each command
buffer copies in before its use. CoreAnimation names its backing stores' rows
at multiples of 64 bytes, and RADV lays its images' at 256: on an RX 7900 XTX,
552 of the textures over a macOS 26.7.2 guest's caches in Apple's sample app
were such shadows (RGBA16Float, BGRA8Unorm, RGBA8Unorm and R32Uint).

Where the kext gives the surface's layout and a plane's rows lie off the
device's pitch (GpuDevice::linear_rows_pitch), the cache now lays each plane's
rows out at that pitch: the first plane from the cache's first byte, each next
on a 4 KiB boundary past the last's rows. A texture over a plane lies at the
same byte of the same row of the plane in the cache, at the cache's pitch, a
two-plane texture's chroma alike, so it is the device's image over the
cache's memory. Every copy between the cache and the pages moves each row's
texels between its place in the pages and its place in the cache: by the
pages' runs in one copy, each part at its own byte of the cache; through the
view or a copied cache's staging, a copy for each row. A host video op writes
its picture at the cache's place of its texture. Every plane format is laid
out alike, from the layout's row bytes and rows.

The guest sees nothing change: each texture reads and writes the same texels,
and the bytes between the pages' rows and outside the planes stay the guest's
CPU's, as a copy out already left them. A fill no longer copies those bytes
into the cache, where no texture's texel lies.
2026-11-12 10:30:41 -08:00
..