From 8d84a70ef2f696d9888a6cb8207eb995f542fedd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 15 May 2023 10:02:44 -0400 Subject: [PATCH] zink: destroy current batch state after all other batch states some resources may not be destroyed immediately and may instead be queued for deletion onto the current batch state, so ensure that the current state is the last one to be destroyed so that all deferred resources are also destroyed cc: mesa-stable Part-of: (cherry picked from commit 58532057c56bfecad38bf589ee17139ab5757306) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index bf62f69e267..2a3385d609e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2632,7 +2632,7 @@ "description": "zink: destroy current batch state after all other batch states", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index e26cb658ec5..5ff6b4a1e61 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -149,10 +149,6 @@ zink_context_destroy(struct pipe_context *pctx) zink_descriptors_deinit_bindless(ctx); - if (ctx->batch.state) { - zink_clear_batch_state(ctx, ctx->batch.state); - zink_batch_state_destroy(screen, ctx->batch.state); - } struct zink_batch_state *bs = ctx->batch_states; while (bs) { struct zink_batch_state *bs_next = bs->next; @@ -167,6 +163,10 @@ zink_context_destroy(struct pipe_context *pctx) zink_batch_state_destroy(screen, bs); bs = bs_next; } + if (ctx->batch.state) { + zink_clear_batch_state(ctx, ctx->batch.state); + zink_batch_state_destroy(screen, ctx->batch.state); + } for (unsigned i = 0; i < 2; i++) { util_idalloc_fini(&ctx->di.bindless[i].tex_slots);