mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-31 02:40:25 +01:00
zink: tighten up export paths that require true dmabuf support
The users of exportable might have different expectations for what can be exported, and some are more tight. So we need a new exportable_dmabuf flag to track where dmabuf is actually needed. If the underlying driver does not advertise dmabuf extension, requesting dmabuf export violates the spec VU: > VUID-VkMemoryGetFdInfoKHR-handleType-00671 > > handleType must have been included in > VkExportMemoryAllocateInfo::handleTypes when memory was created Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38439>
This commit is contained in:
parent
60dd9d797e
commit
4f53828aa6
5 changed files with 10 additions and 4 deletions
|
|
@ -811,8 +811,10 @@ submit_queue(void *data, void *gdata, int thread_index)
|
|||
VkSemaphore *sem = bs->signal_semaphores.data;
|
||||
set_foreach(&bs->dmabuf_exports, entry) {
|
||||
struct zink_resource *res = (void*)entry->key;
|
||||
for (; res; res = zink_resource(res->base.b.next))
|
||||
zink_screen_import_dmabuf_semaphore(screen, res, sem[i++]);
|
||||
if (res->obj->exportable_dmabuf) {
|
||||
for (; res; res = zink_resource(res->base.b.next))
|
||||
zink_screen_import_dmabuf_semaphore(screen, res, sem[i++]);
|
||||
}
|
||||
|
||||
struct pipe_resource *pres = (void*)entry->key;
|
||||
pipe_resource_reference(&pres, NULL);
|
||||
|
|
|
|||
|
|
@ -1131,9 +1131,11 @@ rebind_buffer_as_image(struct pipe_context *pctx, struct pipe_resource *pres, en
|
|||
whandle.modifier = 0;
|
||||
|
||||
struct pipe_resource *import = pctx->screen->resource_from_handle(pctx->screen, &tmpl, &whandle, 0);
|
||||
if (import)
|
||||
if (import) {
|
||||
/* this isn't actually used cross-process, so don't emit extra sync */
|
||||
zink_resource(import)->obj->exportable = false;
|
||||
zink_resource(import)->obj->exportable_dmabuf = false;
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
close(whandle.handle);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -980,6 +980,7 @@ allocate_bo(struct zink_screen *screen, const struct pipe_resource *templ,
|
|||
emai.pNext = mai.pNext;
|
||||
mai.pNext = &emai;
|
||||
obj->exportable = true;
|
||||
obj->exportable_dmabuf = !!(alloc_info->export_types & VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
|
||||
}
|
||||
|
||||
#ifdef ZINK_USE_DMABUF
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_resource *res,
|
|||
cdt->swapchain->images[res->obj->dt_idx].layout = res->layout;
|
||||
}
|
||||
}
|
||||
if (res->obj->exportable && queue_import) {
|
||||
if (res->obj->exportable_dmabuf && queue_import) {
|
||||
simple_mtx_lock(&ctx->bs->exportable_lock);
|
||||
for (struct zink_resource *r = res; r; r = zink_resource(r->base.b.next)) {
|
||||
VkSemaphore sem = zink_screen_export_dmabuf_semaphore(zink_screen(ctx->base.screen), r);
|
||||
|
|
|
|||
|
|
@ -1237,6 +1237,7 @@ struct zink_resource_object {
|
|||
bool render_target;
|
||||
bool is_buffer;
|
||||
bool exportable;
|
||||
bool exportable_dmabuf;
|
||||
|
||||
/* TODO: this should be a union */
|
||||
int handle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue