From 1b53600ff46e34ad4ad535f813e3ba4518422e46 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 6 Sep 2021 16:23:08 +0200 Subject: [PATCH] panvk: Don't take a BO reference when binding memory to an image Memory is never unbound, and vulkan mandates that the memory stays around for the image lifetime, unless another chunk of memory is bound to this image. Let's keep things simple and don't take a reference on the BO we bind to an image, this way, the memory gets released as soon as vkFreeMemory() is called. Signed-off-by: Boris Brezillon Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/vulkan/panvk_device.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/panfrost/vulkan/panvk_device.c b/src/panfrost/vulkan/panvk_device.c index 2eb8fa3100b..4d2dc4f9e4c 100644 --- a/src/panfrost/vulkan/panvk_device.c +++ b/src/panfrost/vulkan/panvk_device.c @@ -1413,7 +1413,6 @@ panvk_BindImageMemory2(VkDevice device, VK_FROM_HANDLE(panvk_device_memory, mem, pBindInfos[i].memory); if (mem) { - panfrost_bo_reference(mem->bo); image->pimage.data.bo = mem->bo; image->pimage.data.offset = pBindInfos[i].memoryOffset; /* Reset the AFBC headers */ @@ -1430,7 +1429,6 @@ panvk_BindImageMemory2(VkDevice device, } } } else { - panfrost_bo_unreference(image->pimage.data.bo); image->pimage.data.bo = NULL; image->pimage.data.offset = pBindInfos[i].memoryOffset; }