Module: Mesa
Branch: main
Commit: 9d923b14f959e23bd5fc24d5542b00de2d3c0d38
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d923b14f959e23bd5fc24d5542b00de2d3c0d38

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Apr 13 13:56:55 2023 -0400

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22479>

---

 src/gallium/drivers/zink/zink_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index 253b4a3ade3..eb5535d5359 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1080,10 +1080,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) {

Reply via email to