Mesa (staging/21.3): zink: fail context creation more gracefully
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 19:01:42 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: dacb05c497beab036f97bde16174983d4104a404
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dacb05c497beab036f97bde16174983d4104a404
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Nov 16 17:45:58 2021 -0500
zink: fail context creation more gracefully
handle some cases where context creation fails earlier than expected
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13844>
(cherry picked from commit a3be30665f1f8bb140069728fd8e17ce6fcdbaa4)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_context.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 8545a6b132f..bf653724bf2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -193,7 +193,7 @@
"description": "zink: fail context creation more gracefully",
"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 49a4755d45e..db5a3580647 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -100,11 +100,14 @@ zink_context_destroy(struct pipe_context *pctx)
pipe_surface_release(&ctx->base, &ctx->dummy_surface[i]);
zink_buffer_view_reference(screen, &ctx->dummy_bufferview, NULL);
- zink_descriptors_deinit_bindless(ctx);
+ if (ctx->dd)
+ zink_descriptors_deinit_bindless(ctx);
simple_mtx_destroy(&ctx->batch_mtx);
- zink_clear_batch_state(ctx, ctx->batch.state);
- zink_batch_state_destroy(screen, ctx->batch.state);
+ 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;
@@ -149,7 +152,8 @@ zink_context_destroy(struct pipe_context *pctx)
_mesa_hash_table_destroy(ctx->render_pass_cache, NULL);
slab_destroy_child(&ctx->transfer_pool_unsync);
- screen->descriptors_deinit(ctx);
+ if (ctx->dd)
+ screen->descriptors_deinit(ctx);
zink_descriptor_layouts_deinit(ctx);
@@ -595,8 +599,10 @@ zink_delete_sampler_state(struct pipe_context *pctx,
struct zink_sampler_state *sampler = sampler_state;
struct zink_batch *batch = &zink_context(pctx)->batch;
zink_descriptor_set_refs_clear(&sampler->desc_set_refs, sampler_state);
- util_dynarray_append(&batch->state->zombie_samplers, VkSampler,
- sampler->sampler);
+ /* may be called if context_create fails */
+ if (batch->state)
+ util_dynarray_append(&batch->state->zombie_samplers, VkSampler,
+ sampler->sampler);
if (sampler->custom_border_color)
p_atomic_dec(&zink_screen(pctx->screen)->cur_custom_border_color_samplers);
FREE(sampler);
More information about the mesa-commit
mailing list