zink: store and reuse memory heap flags for buffer placement

the flags in vk_domain_from_heap() are the MINIMUM required flags for
the heap, but there may be other flags present, so ensure those are picked
up as expected

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17093>
This commit is contained in:
Mike Blumenkrantz 2022-06-16 11:06:53 -04:00 committed by Marge Bot
parent ce5aa07db1
commit d63e04e583
3 changed files with 3 additions and 1 deletions

View file

@ -310,7 +310,7 @@ demote:
bo->base.alignment_log2 = util_logbase2(alignment);
bo->base.size = mai.allocationSize;
bo->base.vtbl = &bo_vtbl;
bo->base.placement = vk_domain_from_heap(heap);
bo->base.placement = screen->heap_flags[heap];
bo->base.usage = flags;
bo->unique_id = p_atomic_inc_return(&screen->pb.next_bo_unique_id);

View file

@ -2312,6 +2312,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
else
screen->heap_map[i] = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL];
}
screen->heap_flags[i] = screen->info.mem_props.memoryTypes[screen->heap_map[i]].propertyFlags;
}
{
unsigned vis_vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE];

View file

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