Mesa (main): zink: only add necessary binds during dmabuf export

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 19:34:38 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Jun  9 16:20:44 2022 -0400

zink: only add necessary binds during dmabuf export

SHARED might only be present, so add it conditionally

Fixes: 4eeabb59f59 ("zink: rebind resources for export as needed")

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17010>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index cd748d9c467..5e56e48677f 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1350,7 +1350,10 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
          if (!res->obj->exportable) {
             assert(!res->all_binds); //TODO handle if problematic
             assert(!zink_resource_usage_is_unflushed(res));
-            if (!add_resource_bind(screen->copy_context, res, ZINK_BIND_DMABUF | PIPE_BIND_SHARED))
+            unsigned bind = ZINK_BIND_DMABUF;
+            if (!(res->base.b.bind & PIPE_BIND_SHARED))
+               bind |= PIPE_BIND_SHARED;
+            if (!add_resource_bind(screen->copy_context, res, bind))
                return false;
             p_atomic_inc(&screen->image_rebind_counter);
             screen->copy_context->base.flush(&screen->copy_context->base, NULL, 0);



More information about the mesa-commit mailing list