From: Matt Coster Date: Fri, 28 Apr 2023 14:00:21 +0000 (+0100) Subject: pvr: Unmap mapped memory on free X-Git-Tag: upstream/23.3.3~9247 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11b1a37553a9339b358ddae99df38160c4cc2252;p=platform%2Fupstream%2Fmesa.git pvr: Unmap mapped memory on free From the Vulkan spec (§11.2.13. Freeing Device Memory): If a memory object is mapped at the time it is freed, it is implicitly unmapped. Signed-off-by: Matt Coster Reviewed-by: Karmjit Mahil Part-of: --- diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 7d652d6..fefa258 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -2112,6 +2112,13 @@ void pvr_FreeMemory(VkDevice _device, if (!mem) return; + /* From the Vulkan spec (§11.2.13. Freeing Device Memory): + * If a memory object is mapped at the time it is freed, it is implicitly + * unmapped. + */ + if (mem->bo->map) + device->ws->ops->buffer_unmap(mem->bo); + device->ws->ops->buffer_destroy(mem->bo); vk_object_free(&device->vk, pAllocator, mem);