Phases

  1. Done. The trap layer and the map, Linux first, with tests/memory_own.c (synthetic owners, no Vulkan): read and write faults return the owner's bytes, a neighbor's writes on an edge page are not lost, the write-tracking markers question, every alias of a page, system calls with and without acquire, unmapping, a fault under vk_lock, and a stress run of threads reading and writing while owners come and go.
  2. Done. The consumers: texture uploads, render target loads, guest buffers, the vi present and VIC inputs look the map up and copy on the GPU.
  3. Done. NVDEC and VIC: FFmpeg stays the decoder. Its planes are staged whole and laid out on the GPU (NV12, block linear) into GPU-owned surfaces. VIC composes from them on the GPU into a GPU-owned output, with no fence wait and no copy back. compose_cpu goes: large jobs go in bands, and the shader takes the cases the GPU path refuses now. Vulkan Video decode is an option, off by default and marked experimental: the vulkan_video setting gives FFmpeg this device with a decode queue (vk/nvdec.c), and its H.264 pictures, and the native video service's AV1 ones, are copied out of their images on the GPU. VP9 stays on the CPU decoder (the NVDEC probability patch is in FFmpeg's software VP9), and so does VP8, which FFmpeg decodes with no Vulkan Video. AV1 runs on RADV (vulkan_video_av1); H.264 has not run on a GPU with Vulkan Video yet, and lavapipe has no decode queue.
  4. Done, inline-to-memory aside. DMA, 2D, inline-to-memory: every copy, layout change, remap and fill as a GPU copy or dispatch from the source's owner (or its guest bytes, staged whole) into a GPU-owned destination. f2d_blit_memory, the DMA engine's CPU loops and the render target flush and reload around them go. The clear before the renderer starts is kept for the renderer. Inline-to-memory stays a CPU write: its data is born on the CPU (the pushbuffer), and the runtime's own readers of what it writes (the shader translator, MME macros) would land every GPU-owned copy of it again. vulkan_headless holds the DMA engine and the 2D blit to dma_ref.c and fermi2d_ref.c on lavapipe.
  5. Windows and the other hosts. Linux without minor faults and Android trap by protection now (memory_traps=1 tests that path on any Linux), and so does Windows, landing in place with no pool (above; tests/memory_own.c runs there too). macOS and FreeBSD need the alias pool first (a shared memory object). Until then their plat_trap_* fail, and a published result lands at once (a readback per result, correct and slow). The setting memory_traps=2 makes a Linux or Windows host take that path, to measure and test it there.
  6. Started: memory the CPU and the GPU share (above). Guest vertex, index and read-only storage ranges are read in place on a GPU that shares memory (vk_memory), and so are constant buffers but the pages the runtime wrote; writable storage, transform feedback and the engines' results are written there in place, and dispatches run on the graphics queue. Placed maps are there, off by default (above). Next: write tracking by protection on their pages, and then placed maps on by default.

Made from docs/layers/gpu/ownership.md at 69237645142c. GPL-3.0-or-later.