From ad7cbe2590495e264c8ae1263fa4d5677ed4993f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 13 Apr 2023 13:56:55 -0400 Subject: [PATCH] zink: restore BAR allocation failure demotion this restores the fallback used when BAR allocation fails due to oom by re-selecting memoryTypeIndex after the heap demotion Fixes: f6d3a5755f6 ("zink: zink_heap isn't 1-to-1 with memoryTypeIndex") Part-of: --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_resource.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ccd81c82ae2..6d8ad50e8f3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -130,7 +130,7 @@ "description": "zink: restore BAR allocation failure demotion", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f6d3a5755f63c81881ff5647fe783038c955e8e3" }, diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 1a7d238370d..19fb67b4d21 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1075,10 +1075,10 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t } assert(zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits) != UINT32_MAX); } - mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits); - assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex)); retry: + mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits); + assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex)); 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) { if (heap == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) {