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>
(cherry picked from commit a8ff1bdc83)
This commit is contained in:
Mike Blumenkrantz 2024-07-17 12:36:45 -04:00 committed by Eric Engestrom
parent dd3f21e8a2
commit d10fa7e4d3
2 changed files with 6 additions and 1 deletions

View file

@ -1224,7 +1224,7 @@
"description": "llvmpipe: handle vma allocation failure",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a062544d3d0519aaa3845b7cfd79e925b9352a55",
"notes": null

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 */