Mesa (main): zink: add resource refs after last descriptor unbind

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 2 01:48:11 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May 11 09:17:28 2021 -0400

zink: add resource refs after last descriptor unbind

redundant at this point; no functional changes

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

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 324681f997e..a939933b8c3 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -69,6 +69,13 @@ debug_describe_zink_buffer_view(char *buf, const struct zink_buffer_view *ptr)
    sprintf(buf, "zink_buffer_view");
 }
 
+ALWAYS_INLINE static void
+check_resource_for_batch_ref(struct zink_context *ctx, struct zink_resource *res)
+{
+   if (!res->bind_count[0] && !res->bind_count[1])
+      zink_batch_reference_resource(&ctx->batch, res);
+}
+
 static void
 zink_context_destroy(struct pipe_context *pctx)
 {
@@ -878,6 +885,7 @@ update_res_bind_count(struct zink_context *ctx, struct zink_resource *res, bool
       assert(res->bind_count[is_compute]);
       if (!--res->bind_count[is_compute])
          _mesa_set_remove_key(ctx->need_barriers[is_compute], res);
+      check_resource_for_batch_ref(ctx, res);
    } else
       res->bind_count[is_compute]++;
 }



More information about the mesa-commit mailing list