From f0bec1dd1ed1f91106742ecbd589a7850837a496 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 19 Nov 2021 15:40:16 -0800 Subject: [PATCH] iris: Destroy all batches with a new iris_destroy_batches() function Suggested-by: Paulo Zanoni Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke Reviewed-by: Paulo Zanoni Part-of: --- 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 aa9da22..6b297a1 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 b86e7aa..09691ef 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 30fd7a2..1c791fc 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); -- 2.7.4