zink: determine whether the gpu has a resizable BAR at startup

this can be used to make different allocation and mapping decisions

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12579>
This commit is contained in:
Mike Blumenkrantz 2021-07-30 09:18:54 -04:00 committed by Marge Bot
parent 1c9b0b853e
commit 9a8960de53
2 changed files with 9 additions and 0 deletions

View File

@ -1907,6 +1907,14 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->heap_map[i] = screen->heap_map[ZINK_HEAP_HOST_VISIBLE_ANY];
}
}
{
unsigned vis_vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE];
unsigned vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL];
/* determine if vis vram is roughly equal to total vram */
if (screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[vis_vram].heapIndex].size >
screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[vram].heapIndex].size * 0.9)
screen->resizable_bar = true;
}
simple_mtx_init(&screen->surface_mtx, mtx_plain);
simple_mtx_init(&screen->bufferview_mtx, mtx_plain);

View File

@ -109,6 +109,7 @@ struct zink_screen {
uint32_t next_bo_unique_id;
} pb;
uint8_t heap_map[VK_MAX_MEMORY_TYPES];
bool resizable_bar;
uint64_t total_video_mem;
uint64_t clamp_video_mem;