From 1fa171650aae7848f88eac1c2f2a898de12076aa Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 2 Feb 2024 22:42:44 +0100 Subject: [PATCH] zink: remove invalid scope in bo allocation loop The braces resulted in the never demoting the heap type which resulted in an infinite loop if this become a necessity. Fixes: eb394f53162ea447fa427740b66af49e5e7ff946 zink: redesign the allocation try loop to test all heaps Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/zink/zink_resource.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 85a3c0f2eed..2d60e8ffda5 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1058,7 +1058,7 @@ allocate_bo(struct zink_screen *screen, const struct pipe_resource *templ, obj->bo = zink_bo(zink_bo_create(screen, reqs->size, alignment, heap, mai.pNext ? ZINK_ALLOC_NO_SUBALLOC : 0, mai.memoryTypeIndex, mai.pNext)); } - if (obj->bo || heap != ZINK_HEAP_DEVICE_LOCAL_VISIBLE) { + if (obj->bo || heap != ZINK_HEAP_DEVICE_LOCAL_VISIBLE) break; /* demote BAR allocations to a different heap on failure to avoid oom */ @@ -1066,7 +1066,6 @@ allocate_bo(struct zink_screen *screen, const struct pipe_resource *templ, heap = ZINK_HEAP_HOST_VISIBLE_COHERENT; else heap = ZINK_HEAP_DEVICE_LOCAL; - } }; return obj->bo ? roc_success : roc_fail_and_cleanup_object;