Mesa (main): iris: Destroy all batches with a new iris_destroy_batches() function

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 3 01:14:04 UTC 2021


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

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Fri Nov 19 15:40:16 2021 -0800

iris: Destroy all batches with a new iris_destroy_batches() function

Suggested-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12692>

---

 src/gallium/drivers/iris/iris_batch.c   | 9 ++++++++-
 src/gallium/drivers/iris/iris_batch.h   | 2 +-
 src/gallium/drivers/iris/iris_context.c | 3 +--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index aa9da2215e6..6b297a1dbe5 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -460,7 +460,7 @@ iris_batch_reset(struct iris_batch *batch)
    iris_batch_maybe_noop(batch);
 }
 
-void
+static void
 iris_batch_free(struct iris_batch *batch)
 {
    struct iris_screen *screen = batch->screen;
@@ -499,6 +499,13 @@ iris_batch_free(struct iris_batch *batch)
       intel_batch_decode_ctx_finish(&batch->decoder);
 }
 
+void
+iris_destroy_batches(struct iris_context *ice)
+{
+   for (int i = 0; i < IRIS_BATCH_COUNT; i++)
+      iris_batch_free(&ice->batches[i]);
+}
+
 /**
  * If we've chained to a secondary batch, or are getting near to the end,
  * then flush.  This should only be called between draws.
diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h
index b86e7aa9d5d..09691efe0f3 100644
--- a/src/gallium/drivers/iris/iris_batch.h
+++ b/src/gallium/drivers/iris/iris_batch.h
@@ -179,7 +179,7 @@ struct iris_batch {
 
 void iris_init_batches(struct iris_context *ice, int priority);
 void iris_chain_to_new_batch(struct iris_batch *batch);
-void iris_batch_free(struct iris_batch *batch);
+void iris_destroy_batches(struct iris_context *ice);
 void iris_batch_maybe_flush(struct iris_batch *batch, unsigned estimate);
 
 void _iris_batch_flush(struct iris_batch *batch, const char *file, int line);
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c
index 30fd7a2aada..1c791fc4836 100644
--- a/src/gallium/drivers/iris/iris_context.c
+++ b/src/gallium/drivers/iris/iris_context.c
@@ -240,8 +240,7 @@ iris_destroy_context(struct pipe_context *ctx)
    u_upload_destroy(ice->state.dynamic_uploader);
    u_upload_destroy(ice->query_buffer_uploader);
 
-   iris_batch_free(&ice->batches[IRIS_BATCH_RENDER]);
-   iris_batch_free(&ice->batches[IRIS_BATCH_COMPUTE]);
+   iris_destroy_batches(ice);
    iris_destroy_binder(&ice->state.binder);
 
    slab_destroy_child(&ice->transfer_pool);



More information about the mesa-commit mailing list