summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_device.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-11-07 17:24:24 -0800
committerJason Ekstrand <[email protected]>2016-11-09 18:17:48 -0800
commit920f34a2d9f14f023aee5203baa110c971519ee8 (patch)
treeb3c6ea4da614997bc24afec739d7c7974b164d06 /src/intel/vulkan/anv_device.c
parent73ef9c8f047835d369db3646853cdb25442db8d3 (diff)
anv/device: Return the right error for failed maps
Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Nanley Chery <[email protected]> Cc: "12.0 13.0" <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r--src/intel/vulkan/anv_device.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index abc511c4d24..528cbe1b59c 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -24,6 +24,7 @@
#include <assert.h>
#include <stdbool.h>
#include <string.h>
+#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
@@ -1311,8 +1312,12 @@ VkResult anv_MapMemory(
/* Let's map whole pages */
map_size = align_u64(map_size, 4096);
- mem->map = anv_gem_mmap(device, mem->bo.gem_handle,
- map_offset, map_size, gem_flags);
+ void *map = anv_gem_mmap(device, mem->bo.gem_handle,
+ map_offset, map_size, gem_flags);
+ if (map == MAP_FAILED)
+ return vk_error(VK_ERROR_MEMORY_MAP_FAILED);
+
+ mem->map = map;
mem->map_size = map_size;
*ppData = mem->map + (offset - map_offset);