From 3064bfc3125699b8dcf106dd628e0472cd561da4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 3 Feb 2025 12:44:11 -0500 Subject: [PATCH] zink: guard rebar check against fallback heap detection if there is no heap with device-local and host-visible, then rebar cannot exist. the previous detection did not account for the rebar heap using the device-local fallback, which of course would have the same size as the device-local heap and pass the threshold check cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_screen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 2e62671e06b..e42355b70b8 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -3412,6 +3412,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev } } } + + bool maybe_has_rebar = true; /* iterate again to check for missing heaps */ for (enum zink_heap i = 0; i < ZINK_HEAP_MAX; i++) { /* not found: use compatible heap */ @@ -3425,10 +3427,12 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev } else { memcpy(screen->heap_map[i], screen->heap_map[ZINK_HEAP_DEVICE_LOCAL], screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]); screen->heap_count[i] = screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]; + if (i == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) + maybe_has_rebar = false; } } } - { + if (maybe_has_rebar) { uint64_t biggest_vis_vram = 0; for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL_VISIBLE]; i++) biggest_vis_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE][i]].heapIndex].size);