From 1c721962f46d30fdb46090b6b3b0e20d076bf825 Mon Sep 17 00:00:00 2001 From: Wanjohi Date: Thu, 24 Sep 2026 16:42:16 +0300 Subject: [PATCH] fix(nescapture): put the masks in the DMA-BUF import failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "No suitable memory type for DMA-BUF import" names neither mask, so it cannot tell a driver that refused the descriptor outright (fd_type_bits=0) from one whose memory types simply do not overlap the image's — which are different bugs in different components. The three numbers were already computed for a debug! two lines above, and a debug line only fires at a level nobody runs in the field; this one did not print at all while a neighbouring crate's did. Now the failure carries image_type_bits, fd_type_bits, their intersection, and the size, format, modifier and stride it was importing. On a virtualised NVIDIA node this turned three unknowns into one measurement and pointed straight at the kernel side. --- apps/nescapture/src/dmabuf_import.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/nescapture/src/dmabuf_import.rs b/apps/nescapture/src/dmabuf_import.rs index 1d42394a..ba5adb47 100644 --- a/apps/nescapture/src/dmabuf_import.rs +++ b/apps/nescapture/src/dmabuf_import.rs @@ -199,7 +199,24 @@ impl DmaBufImporter { let memory_type_index = self .context .find_memory_type(memory_type_bits, vk::MemoryPropertyFlags::empty()) - .ok_or_else(|| anyhow::anyhow!("No suitable memory type for DMA-BUF import"))?; + .ok_or_else(|| { + // The numbers, in the error rather than in the debug! above + // it: fd_type_bits=0 means the driver could not resolve the + // descriptor at all, which is a different fault from a + // mismatch, and the difference is the whole diagnosis. + anyhow::anyhow!( + "No suitable memory type for DMA-BUF import: \ + image_type_bits={:#x} & fd_type_bits={:#x} = {:#x}, \ + size={}, format={:?}, modifier={:#x}, stride={}", + mem_requirements.memory_type_bits, + memory_fd_properties.memory_type_bits, + memory_type_bits, + mem_requirements.size, + format, + planes[0].modifier, + planes[0].stride + ) + })?; // Dedicated allocation (required by many drivers for external memory). let mut dedicated_alloc_info = vk::MemoryDedicatedAllocateInfo::default().image(image);