With buffers grouped into shared dma-buf files (RUNTIME 2290), the residency
still counted and released one buffer at a time. On RADV a shared file's
import leaves the submissions' list only with its last holder, so releasing a
piece of a file other buffers still hold took nothing off the list and cost a
VkBuffer and a bind at the piece's next use. The 780M run of the shared_files
example (job m3-max-29062) released and rejoined 936 of 1,000 pieces of one
file that way, once the cap of 64 applied.
Now every pass groups the releasable imports by the shared files their pieces
lie in (union-find over the files each holds), and a group goes whole or not
at all: every member released together under all their locks (taken in
address order; no other path holds two), and only where every hold of each of
its files is a member's, so that the release frees each file's import. A file
a heap, a buffer kept for good or a command buffer still holds stays imported
with all its pieces. The cap counts the imports on the device's list: a
group's files once each plus each import of its own. The wake trigger counts
each import's listed weight, less a gap the last pass found (pieces past a
file's first), so pieces of one file wake no thread; the periodic pass
catches what a race misses.
Tests: src/tests/host_import_groups.rs (no device): grouping, joining through
an import over two files, a file held elsewhere, holds read apart.
src/tests/dma_buf_shared_files.rs (device, no-pointer route): four buffers
over one file past a cap of 1 see no release and no import again over three
rounds of blits; the negative control, four buffers of their own dma-bufs,
has three released past the most and imported again; two files of two
buffers have the least recently read file's pieces released together, its
import freed once, the other file's kept, and once one of its buffers is
exposed the other is released no more, even forced.
Verified (dmagroup, msi lavapipe --cfg m2v_cpu_icd, no-pointer device): m3-max-29116 at the same
content: 102/102 (dma_buf, host_residency, host_import_groups, pointer_residency, no_pointer_import,
host_ram_dma_buf, host_aliases, dropped_uncommitted, chunks_cover, copied dma-buf tests). 4 buffers
over one file, cap 1: released 0, past the most 0, imported again 0 over three rounds; negative
control (4 own dma-bufs, cap 1): 3 released past the most, 6 by the end, 3 imported again; two files
of two buffers, cap 1: the least recently read file's 2 buffers released together, shared imports
live -1, an exposed buffer's file not released. m3-max-29139: clippy cpuicd/plain/m2v_gpu 0,
private-items rustdoc 0, touched tests 12/12. No WorkCounts field, Degradation kind or API change.