diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-11-07 17:25:07 -0800 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-11-09 18:17:55 -0800 |
commit | b1217eada9e32bf387d4d14615340aa5b5fd1f5c (patch) | |
tree | 031c51fb29c08f8b7e1859b71f61526c4e0b083b /src/intel | |
parent | 920f34a2d9f14f023aee5203baa110c971519ee8 (diff) |
anv/device: Implicitly unmap memory objects in FreeMemory
From the Vulkan spec version 1.0.32 docs for vkFreeMemory:
"If a memory object is mapped at the time it is freed, it is implicitly
unmapped."
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 528cbe1b59c..0999fcf63fe 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1235,6 +1235,9 @@ VkResult anv_AllocateMemory( mem->type_index = pAllocateInfo->memoryTypeIndex; + mem->map = NULL; + mem->map_size = 0; + *pMem = anv_device_memory_to_handle(mem); return VK_SUCCESS; @@ -1256,6 +1259,9 @@ void anv_FreeMemory( if (mem == NULL) return; + if (mem->map) + anv_UnmapMemory(_device, _mem); + if (mem->bo.map) anv_gem_munmap(mem->bo.map, mem->bo.size); @@ -1335,6 +1341,9 @@ void anv_UnmapMemory( return; anv_gem_munmap(mem->map, mem->map_size); + + mem->map = NULL; + mem->map_size = 0; } static void |