What changes for the guest: a device cache made for a surface the host answered
RGFX_STATUS_CACHE with its layout (on a host whose GPU shares the CPU's memory)
is copied into the surface's pages, at a download, a release or an early copy,
plane by plane and row by row: each row's texel bytes alone. The bytes between
rows and outside the planes stay as the guest's CPU wrote them. Before, every
byte of the surface was copied, so a CPU write between rows made while the GPU
held the cache was overwritten by the cache's copy of those bytes. A fill still
copies every byte in, and caches with no layout (a GPU of its own memory) are
copied whole as before.
Nothing on the GPU writes those bytes: no texture's texel lies there, and the
device makes no buffer over an IOSurface. With them left to the CPU, a render
over a cache whose rows hold bytes between them can lie in place where only
those bytes would be rewritten, which metal2vulkan is asked for. Today the
runtime shadows such a texture. On the 780M, WindowServer's 3662x2038 surface
at 14848-byte rows is cached because its pages are more than one dma-buf, and
its shadow copies about 1 G texels a second out of the cache during a window
drag.
The ask's layout reaches the cache through the views (SurfaceViews::laid_out,
taken by the block's cached SURFACE_PAGES). New tests: a download of a laid-out
cache leaves the bytes between rows and past the last row as the CPU wrote them
whatever the cache holds there, and the spans and run cuts the copies use.