Mesa (main): zink: check for pending memory barrier before trying to flush it

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 23 12:24:20 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Sep 17 09:06:49 2021 -0400

zink: check for pending memory barrier before trying to flush it

this function is surprisingly heavy to call unnecessarily

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

---

 src/gallium/drivers/zink/zink_draw.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp
index fde03630cb0..2725fa4fdf0 100644
--- a/src/gallium/drivers/zink/zink_draw.cpp
+++ b/src/gallium/drivers/zink/zink_draw.cpp
@@ -482,7 +482,8 @@ zink_draw_vbo(struct pipe_context *pctx,
          return;
    }
 
-   zink_flush_memory_barrier(ctx, false);
+   if (ctx->memory_barrier)
+      zink_flush_memory_barrier(ctx, false);
    update_barriers(ctx, false);
 
    if (unlikely(ctx->buffer_rebind_counter < screen->buffer_rebind_counter)) {
@@ -843,7 +844,8 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
    struct zink_batch *batch = &ctx->batch;
 
    update_barriers(ctx, true);
-   zink_flush_memory_barrier(ctx, true);
+   if (ctx->memory_barrier)
+      zink_flush_memory_barrier(ctx, true);
 
    if (zink_program_has_descriptors(&ctx->curr_compute->base))
       screen->descriptors_update(ctx, true);



More information about the mesa-commit mailing list