No-copy memory with no dma-buf source is a copy on a device without VK_EXT_external_memory_host

On a device that imports no host pointer but imports dma-bufs (Honeykrisp
on Asahi lists no VK_EXT_external_memory_host), a no-copy buffer or heap
over memory with no source of dma-bufs was refused, naming the extension.
Metal makes such a buffer, and in place is impossible there, so it now
takes the copy a refused pointer with no source takes on RADV
(CopiedFor::DeviceRefused): announced as copied-host-pages, counted in
copied_host_buffers_device_refused, with every copy's coherence.

How: host_window marks such pages pointerless (the device imports no
pointer, the memory is not dma-buf-only). buffer_over_host_parts no
longer takes the no-route refusal for them, so they reach
import_by_pointer, whose not_importable answer is the device's refusal;
a source that fails counts as the device's refusal there too, as on
RADV. Rebinds to such memory, a guest RAM with no source, and every
no-copy object on a device with neither route stay refused, naming the
extension. The in-place check no longer makes its pointer-class buffer
on a device that imports no pointer (it would be an announced copy now);
its verdict there stays lasting, as before.

Docs: the copied-host-pages detail, CopiedFor, CopiedBecause and the
counter, copied.rs, host_memory.rs, the no-copy buffer and heap calls,
imports_shared_host_pointers, host_ram/copy.rs, the runtime README, the
API catalogue and HOWTO section 6. docs/REFUSALS.md regenerated:
unchanged, as the extension's refusal sites all remain.

Verified by the device test in the previous commit (lavapipe and the
780M, see the hand-off).
This commit is contained in:
Anees Iqbal committed 2026-11-11 04:09:01 -08:00
1 parent 472c71ade8
commit 1f7b2a67cf
12 files changed
+111 -74

No files matched your search

+2 -1
View File
@@ -3160,7 +3160,8 @@ bound.
the caller's gate (`HostMemory::with_import_gate`) refused the pages' import, or the device
refused the pointer's import and no dma-buf of the pages served it (no source given, or one that
failed or whose dma-bufs the device refused; RADV refuses shared memory, a `memfd` mapping among
it, `copied_host_buffers_device_refused`), or the import the device and the gate admitted failed, of the pointer or of the caller's dma-bufs (out of memory, or
it, and a device without `VK_EXT_external_memory_host` every pointer,
`copied_host_buffers_device_refused`), or the import the device and the gate admitted failed, of the pointer or of the caller's dma-bufs (out of memory, or
another Vulkan error, such as a driver out of the mappings the host kernel allows), or the
runtime kept pages the kernel cannot pin (a dma-buf's mapping) from NVIDIA's driver, whose failed
import of them breaks it (`RuntimeDriverDefect::UnpinnablePagesBreakHostMemory`), and no dma-buf