RADV imports host pointers through amdgpu userptr with ANONONLY, so it
refuses MAP_SHARED memfd pages (QEMU's memory-backend-memfd guest RAM and
views of it): every no-copy buffer, heap and rebind over them was refused,
and a macOS guest could not boot on AMD. NVIDIA imports the same pages.
What:
- The five no-copy entry points (new_buffer_with_bytes_no_copy, both
new_heap_with_bytes_no_copy calls, Buffer and Heap rebind_bytes_no_copy)
take a HostMemory; HostMemory::with_dma_buf adds a retained DmaBufSource.
- Where the pointer import is refused, and only there, on any device that
lists VK_KHR_external_memory_fd and VK_EXT_external_memory_dma_buf, the
runtime asks the source for dma-bufs of the window's pages (chunks cut at
the device's sparse granule, sized by the caller within udmabuf's default
limits) and binds one buffer over them: plain for one chunk, sparse for
several (vkQueueBindSparse signalling queue 0's timeline; later work waits
on it, no host wait). Every path that imported before is unchanged.
- Textures over such pages get a dedicated DRM_FORMAT_MOD_LINEAR image import
of their own pages where the driver takes the plane offset and row pitch
(multiples of 256 on RADV), with 64-bit modifier features; elsewhere, or on
a source error, the existing shadow path.
- The extensions are enabled outside the compile profile: no device's enable
set, fingerprint or ARTIFACT_FORMAT_VERSION changes. The translator crate is
unchanged.
- Imports free inside exit-guard sections; the source is never called with a
runtime lock held. WorkCounts gains dma_buf_imports, dma_buf_sparse_buffers,
dma_buf_images and dma_buf_image_fallbacks.
Verified:
- Product suites 4553/4553, validation suite 1289/1289, clippy in every
configuration, rustdoc -D warnings, scripts/api-docs.
- runtime_lane::dma_buf_imports and rebinds on RADV Mesa 26.2.4 (validation
layer clean), the RTX 3090 and lavapipe (pointer imported, source never
called), and dma_buf_imports on RADV Mesa 26.0.8.
- reims-vgpu on the Radeon 780M (RADV 26.0.8, udmabuf at its defaults): a
macOS 26 guest cold-boots to the desktop and runs Safari; 5,119 dma-buf
requests, none refused.
- 64 MiB on RADV 26.2.4, release: pointer import 187 us; one chunk 665 us;
16 chunks 16.9 ms, about half of it the refused pointer attempt. The old
host-fence bind waited 1.26 s behind queue-0 work on RADV 26.0.8.
Rolls up everything since 43c46ac8 into a single commit. Its tree is
identical to the tree of private master at
b3c77f2d2b20a432be10591a2129547c10b1c24b.
- A Cargo workspace of five crates under crates/: metal2vulkan (the
translator and the metal2vulkan command), metal2vulkan-runtime (the
Metal API on Vulkan), metal2vulkan-air (the AIR front end),
metal2vulkan-validation and metal2vulkan-devtools.
- Dual license: GPL-2.0-or-later OR LGPL-3.0-or-later.
- docs/: API, architecture, fast paths, how-to, Metal coverage,
refusals, runtime porting and validation guides.
Private-Commit: b3c77f2d2b20a432be10591a2129547c10b1c24b