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>
(cherry picked from commit 3064bfc312)
This commit is contained in:
Mike Blumenkrantz 2025-02-03 12:44:11 -05:00 committed by Eric Engestrom
parent 26ad2f9149
commit 1ea9e1e364
2 changed files with 6 additions and 2 deletions

View file

@ -224,7 +224,7 @@
"description": "zink: guard rebar check against fallback heap detection",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -3403,6 +3403,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 */
@ -3416,10 +3418,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);