zink: set handle type also for user memory

Fixes the validation error
  VUID-vkBindBufferMemory-memory-02985
reported, e.g. by running piglit
  spec@amd_pinned_memory@map-buffer decrement-offset

v2: move setting the export type for user_mem get_export_flags and
    also set alloc_info->external for user_mem to avoid adding
    a conditional when finning the external buffer create info (Mike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28244>
This commit is contained in:
Gert Wollny 2024-03-13 13:00:17 +01:00 committed by Marge Bot
parent 995727e575
commit 5464feed73

View file

@ -922,7 +922,11 @@ get_export_flags(struct zink_screen *screen, const struct pipe_resource *templ,
return false;
}
}
if (alloc_info->user_mem) {
assert(!alloc_info->whandle);
alloc_info->external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
alloc_info->export_types = VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT;
}
/* we may export WINSYS_HANDLE_TYPE_FD handle which is dma-buf */
if (templ->bind & PIPE_BIND_SHARED && screen->info.have_EXT_external_memory_dma_buf)
alloc_info->export_types |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
@ -1482,8 +1486,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
struct mem_alloc_info alloc_info = {
.whandle = whandle,
.need_dedicated = false,
.external = 0,
.export_types = user_mem ? VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT : ZINK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_BIT,
.export_types = ZINK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_BIT,
.shared = templ->bind & PIPE_BIND_SHARED,
.user_mem = user_mem
};