iris: Destroy all batches with a new iris_destroy_batches() function
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 19 Nov 2021 23:40:16 +0000 (15:40 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Fri, 3 Dec 2021 00:34:42 +0000 (16:34 -0800)
Suggested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12692>

src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_context.c

index aa9da22..6b297a1 100644 (file)
@@ -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.
index b86e7aa..09691ef 100644 (file)
@@ -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);
index 30fd7a2..1c791fc 100644 (file)
@@ -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);