From fdc21a95aa6cbb0a47a37155b76c19a92b99f5a0 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Thu, 25 Apr 2024 18:34:41 +0000 Subject: [PATCH] venus: workaround excessive dma-buf import failure on turnip Workaround dEQP-VK.wsi.android.swapchain.simulate_oom.* test failures on turnip where excessive imports can fail, and venus has to propagate oom. Signed-off-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_device_memory.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c index 1317a41d065..7dce2231509 100644 --- a/src/virtio/vulkan/vn_device_memory.c +++ b/src/virtio/vulkan/vn_device_memory.c @@ -30,7 +30,15 @@ vn_device_memory_alloc_simple(struct vn_device *dev, { VkDevice dev_handle = vn_device_to_handle(dev); VkDeviceMemory mem_handle = vn_device_memory_to_handle(mem); - if (VN_PERF(NO_ASYNC_MEM_ALLOC)) { + + /* Workaround dEQP-VK.wsi.android.swapchain.simulate_oom.* test failures on + * turnip where excessive imports can fail, and venus has to propagate oom. + */ + const bool force_sync = + mem->base.base.import_handle_type == + VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT && + dev->physical_device->renderer_driver_id == VK_DRIVER_ID_MESA_TURNIP; + if (VN_PERF(NO_ASYNC_MEM_ALLOC) || force_sync) { return vn_call_vkAllocateMemory(dev->primary_ring, dev_handle, alloc_info, NULL, &mem_handle); }