if (mem == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- result = anv_bo_init_new(&mem->bo, device, pAllocateInfo->allocationSize);
+ /* The kernel is going to give us whole pages anyway */
+ uint64_t alloc_size = align_u64(pAllocateInfo->allocationSize, 4096);
+
+ result = anv_bo_init_new(&mem->bo, device, alloc_size);
if (result != VK_SUCCESS)
goto fail;
uint64_t map_size = (offset + size) - map_offset;
/* Let's map whole pages */
- map_size = (map_size + 4095) & ~4095ull;
+ map_size = align_u64(map_size, 4096);
mem->map = anv_gem_mmap(device, mem->bo.gem_handle,
map_offset, map_size, gem_flags);
return (v + a - 1) & ~(a - 1);
}
+static inline uint64_t
+align_u64(uint64_t v, uint64_t a)
+{
+ return (v + a - 1) & ~(a - 1);
+}
+
static inline int32_t
align_i32(int32_t v, int32_t a)
{