From cab80223fd8fd72cd9a95484ae023708714f42ad Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Fri, 7 Mar 2025 13:55:34 -0500 Subject: [PATCH] nvk: Don't zero imported memory This fixes eg. dEQP-VK.drm_format_modifiers.export_import_fmt_features2.a8b8g8r8_uint_pack32 with NVK_DEBUG=zero_memory Fixes: 0399999decd ("nvk: Support dma-buf import") Reviewed-by: Faith Ekstrand Part-of: --- src/nouveau/vulkan/nvk_device_memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nouveau/vulkan/nvk_device_memory.c b/src/nouveau/vulkan/nvk_device_memory.c index 8eaa1e5ef76..967076ceaeb 100644 --- a/src/nouveau/vulkan/nvk_device_memory.c +++ b/src/nouveau/vulkan/nvk_device_memory.c @@ -157,7 +157,8 @@ nvk_AllocateMemory(VkDevice device, if (!mem) return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY); - if (fd_info && fd_info->handleType) { + const bool is_import = fd_info && fd_info->handleType; + if (is_import) { assert(fd_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT || fd_info->handleType == @@ -188,7 +189,7 @@ nvk_AllocateMemory(VkDevice device, goto fail_alloc; } - if (pdev->debug_flags & NVK_DEBUG_ZERO_MEMORY) { + if ((pdev->debug_flags & NVK_DEBUG_ZERO_MEMORY) && !is_import) { if (type->propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { void *map; result = nvkmd_mem_map(mem->mem, &dev->vk.base,