On the 780M (RADV PHOENIX) the runtime's memory exported as dma-bufs
kept every texture a shadow: the device's image format query refuses
the dma-buf handle type to a plain linear image and takes it for a
DRM_FORMAT_MOD_LINEAR image only in a dedicated allocation, so the
in-place check of that memory made no image and its verdicts stayed
Unchecked (m3-max-10261). RADV takes an opaque file descriptor for the
same images in a shared block (the opaque-descriptor planes are in
place there, alignment 256).
The remedy, decided from documented queries alone:
- exported_memory.rs: FdExport::new asks
vkGetPhysicalDeviceExternalBufferProperties for the dma-buf and the
opaque handle types with the runtime's buffer usage. Where the
dma-buf's compatible types hold the opaque one, and the opaque one is
exportable, not DEDICATED_ONLY, and compatible with both, a shared
block of dma-bufs is allocated exportable as DMA_BUF | OPAQUE_FD
(Memory::export_dma_bufs_as). Elsewhere, and for a buffer's dedicated
allocation, it stays the dma-buf alone. The buffer still names the
dma-buf type (VUID-vkBindBufferMemory-memory-02726 needs one in
common) and export_memory_dma_buf is unchanged: vkGetMemoryFdKHR of
the dma-buf type, a dma-buf of the same memory.
- memory.rs: Exported carries the export set beside the handle type;
bound_memory answers the set.
- texture.rs: alias_unbound tries the image naming the dma-buf type,
then, where the block exports both, the one naming the opaque type,
each through the same linear-then-DRM_FORMAT_MOD_LINEAR route
(alias_unbound_in). An image takes a handle type only where
vkGetPhysicalDeviceImageFormatProperties2 with that type reports it
exportable, not DEDICATED_ONLY, and lists every type the block is
exported as among its compatible types (external_image_limits,
modifier_image_limits; LinearRefusal::Incompatible). Where neither
takes it, the shadow and its notice name both refusals.
- in_place.rs: the class follows the memory (ExportedDmaBuf for any
block of dma-bufs); the check's own textures go through the same
route, so its verdicts are of the image a texture names.
CHECK_VERSION 13 -> 14: 13's records kept ExportedDmaBuf Unchecked as
a cause that lasts.
- WorkCounts::exported_dma_buf_images_named_opaque_fd counts the images
that name the opaque type over a dma-buf block (api_signatures.tsv).
Test: exported_textures'
a_dma_buf_block_s_planes_name_an_opaque_fd_where_its_images_take_no_dma_buf_in_a_shared_block
asks the buffer and image queries itself, apart from the runtime: it
asserts the block's export set matches the buffer queries, the
buffer's export is a dma-buf (fdinfo exp_name), and, where the block
exports both and the dma-buf type takes no image of the plane's format
in a shared block, each plane is in place naming the opaque type
(counted) or a shadow of a byte the check found changed, never
Unchecked; no VUID under the layer. Without the change it fails on
RADV: the block exports the dma-buf alone where the buffer queries
answer both.
Docs: API.md's shadow rule, HOWTO section 7, the runtime README and the
module docs.
Verification: to run on the 780M, the RX 550 and lavapipe, then the
5080 through an entry.
(cherry picked from commit 1acb4f1fbf1fd4df8fcee2948417dcc089909fe4)