Hi Samuel, On 3 May 2017 at 08:57, Samuel Iglesias Gonsálvez <sigles...@igalia.com> wrote: > Take it into account when checking if the mapping failed. > > Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> > --- > src/intel/vulkan/anv_allocator.c | 2 +- > src/intel/vulkan/anv_image.c | 4 ++++ > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/intel/vulkan/anv_allocator.c > b/src/intel/vulkan/anv_allocator.c > index 554ca4ac5f..6ab2da5d64 100644 > --- a/src/intel/vulkan/anv_allocator.c > +++ b/src/intel/vulkan/anv_allocator.c > @@ -889,7 +889,7 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo > *bo, uint32_t size) > assert(new_bo.size == pow2_size); > > new_bo.map = anv_gem_mmap(pool->device, new_bo.gem_handle, 0, pow2_size, > 0); > - if (new_bo.map == NULL) { > + if (new_bo.map == MAP_FAILED) { > anv_gem_close(pool->device, new_bo.gem_handle); > return vk_error(VK_ERROR_MEMORY_MAP_FAILED); > } > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c > index 4874f2f3d3..d7d53f96a4 100644 > --- a/src/intel/vulkan/anv_image.c > +++ b/src/intel/vulkan/anv_image.c > @@ -26,6 +26,7 @@ > #include <string.h> > #include <unistd.h> > #include <fcntl.h> > +#include <sys/mman.h> > > #include "anv_private.h" > #include "util/debug.h" > @@ -369,6 +370,9 @@ VkResult anv_BindImageMemory( > if (map == NULL) > return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); > Shouldn't we drop this check alongside its comment? There's a another comment a few lines further up which should be updated as well. With that Reviewed-by: Emil Velikov <emil.veli...@collabora.com>
Some suggestions for follow-up patches: - check if anv_gem_mmap in genX_query.c fails - document the anv_gem_mmap return value -Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev