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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33359>
This commit is contained in:
Mike Blumenkrantz 2025-02-03 12:44:11 -05:00 committed by Marge Bot
parent 8aae760144
commit 3064bfc312

View file

@ -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);