mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
zink: move mem type detection up in file
no functional changes Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24775>
This commit is contained in:
parent
521800cf59
commit
f95134468a
1 changed files with 37 additions and 37 deletions
|
|
@ -3098,6 +3098,43 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
|
|||
goto fail;
|
||||
}
|
||||
|
||||
memset(&screen->heap_map, UINT8_MAX, sizeof(screen->heap_map));
|
||||
for (enum zink_heap i = 0; i < ZINK_HEAP_MAX; i++) {
|
||||
for (unsigned j = 0; j < screen->info.mem_props.memoryTypeCount; j++) {
|
||||
VkMemoryPropertyFlags domains = vk_domain_from_heap(i);
|
||||
if ((screen->info.mem_props.memoryTypes[j].propertyFlags & domains) == domains) {
|
||||
screen->heap_map[i][screen->heap_count[i]++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* iterate again to check for missing heaps */
|
||||
for (enum zink_heap i = 0; i < ZINK_HEAP_MAX; i++) {
|
||||
/* not found: use compatible heap */
|
||||
if (screen->heap_map[i][0] == UINT8_MAX) {
|
||||
/* only cached mem has a failure case for now */
|
||||
assert(i == ZINK_HEAP_HOST_VISIBLE_COHERENT_CACHED || i == ZINK_HEAP_DEVICE_LOCAL_LAZY ||
|
||||
i == ZINK_HEAP_DEVICE_LOCAL_VISIBLE);
|
||||
if (i == ZINK_HEAP_HOST_VISIBLE_COHERENT_CACHED) {
|
||||
memcpy(screen->heap_map[i], screen->heap_map[ZINK_HEAP_HOST_VISIBLE_COHERENT], screen->heap_count[ZINK_HEAP_HOST_VISIBLE_COHERENT]);
|
||||
screen->heap_count[i] = screen->heap_count[ZINK_HEAP_HOST_VISIBLE_COHERENT];
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
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[i].heapIndex].size);
|
||||
uint64_t biggest_vram = 0;
|
||||
for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]; i++)
|
||||
biggest_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size);
|
||||
/* determine if vis vram is roughly equal to total vram */
|
||||
if (biggest_vis_vram > biggest_vram * 0.9)
|
||||
screen->resizable_bar = true;
|
||||
}
|
||||
|
||||
setup_renderdoc(screen);
|
||||
if (screen->threaded_submit && !util_queue_init(&screen->flush_queue, "zfq", 8, 1, UTIL_QUEUE_INIT_RESIZE_IF_FULL, screen)) {
|
||||
mesa_loge("zink: Failed to create flush queue.\n");
|
||||
|
|
@ -3261,43 +3298,6 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
|
|||
goto fail;
|
||||
}
|
||||
|
||||
memset(&screen->heap_map, UINT8_MAX, sizeof(screen->heap_map));
|
||||
for (enum zink_heap i = 0; i < ZINK_HEAP_MAX; i++) {
|
||||
for (unsigned j = 0; j < screen->info.mem_props.memoryTypeCount; j++) {
|
||||
VkMemoryPropertyFlags domains = vk_domain_from_heap(i);
|
||||
if ((screen->info.mem_props.memoryTypes[j].propertyFlags & domains) == domains) {
|
||||
screen->heap_map[i][screen->heap_count[i]++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* iterate again to check for missing heaps */
|
||||
for (enum zink_heap i = 0; i < ZINK_HEAP_MAX; i++) {
|
||||
/* not found: use compatible heap */
|
||||
if (screen->heap_map[i][0] == UINT8_MAX) {
|
||||
/* only cached mem has a failure case for now */
|
||||
assert(i == ZINK_HEAP_HOST_VISIBLE_COHERENT_CACHED || i == ZINK_HEAP_DEVICE_LOCAL_LAZY ||
|
||||
i == ZINK_HEAP_DEVICE_LOCAL_VISIBLE);
|
||||
if (i == ZINK_HEAP_HOST_VISIBLE_COHERENT_CACHED) {
|
||||
memcpy(screen->heap_map[i], screen->heap_map[ZINK_HEAP_HOST_VISIBLE_COHERENT], screen->heap_count[ZINK_HEAP_HOST_VISIBLE_COHERENT]);
|
||||
screen->heap_count[i] = screen->heap_count[ZINK_HEAP_HOST_VISIBLE_COHERENT];
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
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[i].heapIndex].size);
|
||||
uint64_t biggest_vram = 0;
|
||||
for (unsigned i = 0; i < screen->heap_count[ZINK_HEAP_DEVICE_LOCAL]; i++)
|
||||
biggest_vram = MAX2(biggest_vis_vram, screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[i].heapIndex].size);
|
||||
/* determine if vis vram is roughly equal to total vram */
|
||||
if (biggest_vis_vram > biggest_vram * 0.9)
|
||||
screen->resizable_bar = true;
|
||||
}
|
||||
|
||||
bool can_db = true;
|
||||
{
|
||||
if (!screen->info.have_EXT_descriptor_buffer) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue