RUNTIME_VERSION 2070: a texture in place over a no-copy buffer's dma-buf no longer pins the buffer's import

RADV lists every imported memory in every kernel submission, 0.43-0.44 us each on the 780M and
the XTX (raw probe: 512 dma-buf imports of 1 MiB cost 229-234 us per submission against 7-8 us
with none; 64 pointer imports of 1 MiB 191-200 us). A texture in place over a no-copy buffer's
dma-buf import kept the buffer's import live for good, so each such surface listed two dma-bufs
per submission, though its DRM_FORMAT_MOD_LINEAR image has its own dedicated import.

Now HostPages::dma_buf reads the pages the way a blit does (blit_pages: imported again if
released, still releasable), and the in-place watch and dma_buf_unplaced take the offset from
Buffer::offset_in_host_pages() instead of a pinning memory() read; heap images take the same
path. Sampling and rendering go through the image's own import. A blit that names such a
texture runs on the buffer's bytes and imports the buffer again, as any blit does. The image's
own import stays listed for its life (RADV requires a dedicated allocation for it). The
per-import cost and the remaining limits (second buffers and bindings keep imports for good;
separate submit calls list every import again; no documented switch takes an import off the
list) are a FAST-PATHS known gap.

Tests: lane runtime_lane::submit_per_surface (128 surfaces of 64 KiB, each a no-copy buffer and
an in-place texture, measured after a 4 s idle); device test
host_residency::a_texture_in_place_over_a_dma_buf_import_leaves_it_releasable.

Verified (potluck jobs, on the branch):
- 780M PHOENIX, Mesa 26.2.6: before (17864) 256 dma-bufs listed per submission, 119 us in the
  ioctl, 128 buffer imports kept for a texture; after (17939, three runs) 128 listed, 58-67 us,
  0 kept. In use: 256 listed, 115-129 us.
- XTX NAVI31: before (17927, load ~20) 256 listed, 160 us; after (17999, three runs) 128 listed,
  59-70 us; in use 256 listed, 108-109 us.
- The device test passed on the XTX (17999) and the 780M (18002): "1 chunks released under a
  texture in place, rendered into, imported again by its blit and released again".
- lavapipe 164/164 (18007; the device test skips: lavapipe imports the pointer).
- clippy default, --cfg m2v_gpu, --cfg m2v_cpu_icd and rustdoc -D warnings (17978, at the last
  code commit; later commits are docs).
In the consumer's 780M walk the saving is bounded: at most about 43 of 160 kept imports are kept
by a texture alone (about 18 us per submission, for surfaces idle past their window).
This commit is contained in:
Anees Iqbal committed 2026-11-11 17:14:40 -08:00
1 parent 515367b8f2
commit 100ea7b465
1 file changed
+1 -1
+1 -1
View File
@@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 502;
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
/// keeps no history.
pub const RUNTIME_VERSION: u32 = 2069;
pub const RUNTIME_VERSION: u32 = 2070;
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles