llvmpipe: handle vma allocation failure

Fixes: a062544d3d ("llvmpipe: Use an anonymous file for memory allocations")

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30229>
This commit is contained in:
Mike Blumenkrantz
2024-07-17 12:36:45 -04:00
committed by Marge Bot
parent 3e01422a16
commit a8ff1bdc83

View File

@@ -1305,6 +1305,11 @@ llvmpipe_allocate_memory(struct pipe_screen *_screen, uint64_t size)
mtx_lock(&screen->mem_mutex);
mem->offset = util_vma_heap_alloc(&screen->mem_heap, mem->size, alignment);
if (!mem->offset) {
mtx_unlock(&screen->mem_mutex);
FREE(mem);
return NULL;
}
if (mem->offset + mem->size > screen->mem_file_size) {
/* expand the anonymous file */