summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-11-07 17:25:07 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2016-12-15 16:14:55 +0000
commit626b85cc15d8a57954f956620c0b89c3a06559af (patch)
tree59cb6805517705b2f0acbb99be6b3a7e732144a6 /src/intel
parent23f1e04abbc6cb97b18a2902e9231983856672dd (diff)
downloadexternal_mesa3d-626b85cc15d8a57954f956620c0b89c3a06559af.zip
external_mesa3d-626b85cc15d8a57954f956620c0b89c3a06559af.tar.gz
external_mesa3d-626b85cc15d8a57954f956620c0b89c3a06559af.tar.bz2
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> (cherry picked from commit b1217eada9e32bf387d4d14615340aa5b5fd1f5c)
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 9595fe3..5333856 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1243,6 +1243,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;
@@ -1264,6 +1267,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);
@@ -1333,6 +1339,9 @@ void anv_UnmapMemory(
return;
anv_gem_munmap(mem->map, mem->map_size);
+
+ mem->map = NULL;
+ mem->map_size = 0;
}
static void