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

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Oct 20 10:18:49 2023 -0400

zink: only increment image_rebind_counter on image export if binds exist

rebinding all images on all contexts is only relevant for images which
have bindings, otherwise it's just pointless churn

fixes #10016

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25829>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index d4e9b5e8096..c7f33c8b172 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1761,7 +1761,6 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
          whandle->handle = -1;
       } else {
          if (!res->obj->exportable) {
-            assert(!res->all_binds); //TODO handle if problematic
             assert(!zink_resource_usage_is_unflushed(res));
             if (!screen->info.have_EXT_image_drm_format_modifier) {
                static bool warned = false;
@@ -1776,7 +1775,8 @@ zink_resource_get_handle(struct pipe_screen *pscreen,
                zink_screen_unlock_context(screen);
                return false;
             }
-            p_atomic_inc(&screen->image_rebind_counter);
+            if (res->all_binds)
+               p_atomic_inc(&screen->image_rebind_counter);
             screen->copy_context->base.flush(&screen->copy_context->base, 
NULL, 0);
             zink_screen_unlock_context(screen);
             obj = res->obj;

Reply via email to