Mesa (main): zink: always set matching resource export type for dmabuf creation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 17 19:47:46 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Nov 11 12:23:29 2021 -0500

zink: always set matching resource export type for dmabuf creation

both of these need to be set if one is

cc: mesa-stable

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13799>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 817881070ac..237e0cfd2bc 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -450,21 +450,20 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
    VkMemoryRequirements reqs;
    VkMemoryPropertyFlags flags;
    bool need_dedicated = false;
+   bool shared = templ->bind & PIPE_BIND_SHARED;
    VkExternalMemoryHandleTypeFlags export_types = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
 
    VkExternalMemoryHandleTypeFlags external = 0;
    if (whandle) {
-      if (whandle->type == WINSYS_HANDLE_TYPE_FD)
+      if (whandle->type == WINSYS_HANDLE_TYPE_FD) {
          external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
-      else
+         export_types |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
+      } else
          unreachable("unknown handle type");
    }
 
    /* TODO: remove linear for wsi */
    bool scanout = templ->bind & PIPE_BIND_SCANOUT;
-   bool shared = templ->bind & PIPE_BIND_SHARED;
-   if (shared && screen->info.have_EXT_external_memory_dma_buf)
-      export_types |= VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
 
    pipe_reference_init(&obj->reference, 1);
    util_dynarray_init(&obj->tmp, NULL);



More information about the mesa-commit mailing list