Mesa (main): zink: set dma-buf bit for shared resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 4 20:11:51 UTC 2022


Module: Mesa
Branch: main
Commit: 66e6e8afe6f4df60a7c20022e380669735c5374b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=66e6e8afe6f4df60a7c20022e380669735c5374b

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Thu Feb  3 23:55:23 2022 -0800

zink: set dma-buf bit for shared resources

Set the dma-buf bit when supported.  This is done because
zink_resource_get_handle exports dma-bufs when WINSYS_HANDLE_TYPE_FD is
requested.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14872>

---

 src/gallium/drivers/zink/zink_resource.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 5cfbe785983..279d60a4b0a 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -503,6 +503,10 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       }
    }
 
+   /* we may export WINSYS_HANDLE_TYPE_FD handle which is dma-buf */
+   if (shared && screen->info.have_EXT_external_memory_dma_buf)
+      export_types |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
+
    /* TODO: remove linear for wsi */
    bool scanout = templ->bind & PIPE_BIND_SCANOUT;
 



More information about the mesa-commit mailing list