[Mesa-dev] [PATCH 1/3] anv/device: Don't even try to map memory with a size of 0

Jason Ekstrand jason at jlekstrand.net
Tue Nov 8 01:28:12 UTC 2016


Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: "12.0 13.0" <mesa-dev at lists.freedesktop.org>
---
 src/intel/vulkan/anv_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 5393144..8055893 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1258,6 +1258,11 @@ VkResult anv_MapMemory(
    if (size == VK_WHOLE_SIZE)
       size = mem->bo.size - offset;
 
+   if (size == 0) {
+      *ppData = NULL;
+      return VK_SUCCESS;
+   }
+
    /* FIXME: Is this supposed to be thread safe? Since vkUnmapMemory() only
     * takes a VkDeviceMemory pointer, it seems like only one map of the memory
     * at a time is valid. We could just mmap up front and return an offset
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list