Mesa (main): zink: export fd info for all 2d images

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 29 00:44:41 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Apr 28 16:30:43 2022 -0400

zink: export fd info for all 2d images

there's no way to add this later, so here we go

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16226>

---

 src/gallium/drivers/zink/zink_resource.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 7fdbb4e52c4..983a7bcb795 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -495,7 +495,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       VK_IMAGE_ASPECT_PLANE_2_BIT,
    };
    VkExternalMemoryHandleTypeFlags external = 0;
-   bool needs_export = (templ->bind & ZINK_BIND_VIDEO) != 0;
+   bool needs_export = templ->target == PIPE_TEXTURE_2D;
    if (whandle) {
       if (whandle->type == WINSYS_HANDLE_TYPE_FD || whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE)
          needs_export |= true;
@@ -503,7 +503,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
          unreachable("unknown handle type");
    }
    if (needs_export) {
-      if (whandle && whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE) {
+      if (!whandle || whandle->type == ZINK_EXTERNAL_MEMORY_HANDLE) {
          external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
       } else {
          external = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
@@ -775,7 +775,7 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
    }
 
    VkExportMemoryAllocateInfo emai;
-   if ((templ->bind & ZINK_BIND_VIDEO) || ((templ->bind & PIPE_BIND_SHARED) && shared)) {
+   if (needs_export) {
       emai.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO;
       emai.handleTypes = export_types;
 



More information about the mesa-commit mailing list