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 <boris.brezillon@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12762>
This commit is contained in:
Boris Brezillon 2021-09-06 16:23:08 +02:00
parent 81e8a5d83a
commit 1b53600ff4

View file

@ -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;
}