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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23033>
(cherry picked from commit 58532057c5)
This commit is contained in:
Mike Blumenkrantz 2023-05-15 10:02:44 -04:00 committed by Eric Engestrom
parent 22672fb62f
commit 8d84a70ef2
2 changed files with 5 additions and 5 deletions

View file

@ -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
},

View file

@ -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);