Mesa (master): zink: add util function for returning previous batch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 25 02:32:12 UTC 2021


Module: Mesa
Branch: master
Commit: c271ac0066a637c18cb6db2278676c2f3bd46f33
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c271ac0066a637c18cb6db2278676c2f3bd46f33

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Sep 30 12:54:10 2020 -0400

zink: add util function for returning previous batch

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

---

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

diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 77ae3953cb3..141bfc33e0f 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -204,6 +204,18 @@ zink_curr_batch(struct zink_context *ctx)
    return ctx->batches + ctx->curr_batch;
 }
 
+static inline struct zink_batch *
+zink_prev_batch(struct zink_context *ctx)
+{
+   unsigned curr_batch = ctx->curr_batch;
+   if (!curr_batch)
+      curr_batch = ZINK_NUM_GFX_BATCHES - 1;
+   else
+      curr_batch--;
+   assert(curr_batch < ARRAY_SIZE(ctx->batches));
+   return ctx->batches + curr_batch;
+}
+
 struct zink_batch *
 zink_batch_rp(struct zink_context *ctx);
 



More information about the mesa-commit mailing list