diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 9f8f85a235a..2d682e0c57a 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -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); diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 7c9a84db79c..fa7268ad0f5 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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 diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 9dfe28de61f..789003651d6 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -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 diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp b/src/gallium/drivers/zink/zink_synchronization.cpp index 90c205d6e98..0b6ffc126ef 100644 --- a/src/gallium/drivers/zink/zink_synchronization.cpp +++ b/src/gallium/drivers/zink/zink_synchronization.cpp @@ -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); diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index fe6116bf5af..7723f65a597 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -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;