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

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Feb 24 15:56:05 2023 -0500

zink: fix slab allocator sizing

now that the mem type is passed directly to pb, there have to be enough
slabs to allocate all the mem types (not heaps), so create memoryTypeCount
slabs to allow this

fixes #8369

Fixes: f6d3a5755f6 ("zink: zink_heap isn't 1-to-1 with memoryTypeIndex"
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21526>

---

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

diff --git a/src/gallium/drivers/zink/zink_bo.c 
b/src/gallium/drivers/zink/zink_bo.c
index f5ad823d752..a69a050f323 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -1282,7 +1282,7 @@ zink_bo_init(struct zink_screen *screen)
    for (uint32_t i = 0; i < screen->info.mem_props.memoryHeapCount; ++i)
       total_mem += screen->info.mem_props.memoryHeaps[i].size;
    /* Create managers. */
-   pb_cache_init(&screen->pb.bo_cache, ZINK_HEAP_MAX,
+   pb_cache_init(&screen->pb.bo_cache, screen->info.mem_props.memoryTypeCount,
                  500000, 2.0f, 0,
                  total_mem / 8, screen,
                  (void*)bo_destroy, (void*)bo_can_reclaim);
@@ -1300,7 +1300,7 @@ zink_bo_init(struct zink_screen *screen)
 
       if (!pb_slabs_init(&screen->pb.bo_slabs[i],
                          min_order, max_order,
-                         ZINK_HEAP_MAX, true,
+                         screen->info.mem_props.memoryTypeCount, true,
                          screen,
                          bo_can_reclaim_slab,
                          bo_slab_alloc_normal,

Reply via email to