zink: invoke descriptor_program_deinit for programs on context destroy

this should make multi-context shutdown more stable

affects:
glx@glx-visuals-depth -pixmap
glx@glx-visuals-stencil

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17658>
This commit is contained in:
Mike Blumenkrantz 2022-07-20 11:44:16 -04:00 committed by Marge Bot
parent f075376823
commit 4123ee3c71
3 changed files with 14 additions and 2 deletions

View File

@ -143,9 +143,7 @@ glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Crash
glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil,Crash
glx@glx-visuals-stencil -pixmap,Crash
glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail
# X error 167 (GLXBadFBConfig (9)) was generated, but X error 8 was expected.
glx@glx_arb_create_context_no_error@no error,Crash

View File

@ -101,6 +101,17 @@ zink_context_destroy(struct pipe_context *pctx)
if (ctx->batch.state && !screen->device_lost && VKSCR(QueueWaitIdle)(screen->queue) != VK_SUCCESS)
mesa_loge("ZINK: vkQueueWaitIdle failed");
for (unsigned i = 0; i < ARRAY_SIZE(ctx->program_cache); i++) {
hash_table_foreach(&ctx->program_cache[i], entry) {
struct zink_program *pg = entry->data;
screen->descriptor_program_deinit(ctx, pg);
}
}
hash_table_foreach(&ctx->compute_program_cache, entry) {
struct zink_program *pg = entry->data;
screen->descriptor_program_deinit(ctx, pg);
}
if (ctx->blitter)
util_blitter_destroy(ctx->blitter);
for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++)

View File

@ -354,6 +354,8 @@ void
zink_descriptor_program_deinit_lazy(struct zink_context *ctx, struct zink_program *pg)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
if (!pg->dd)
return;
for (unsigned i = 0; pg->num_dsl && i < ZINK_DESCRIPTOR_TYPES; i++) {
if (pg->dd->pool_key[i])
pg->dd->pool_key[i]->use_count--;
@ -363,6 +365,7 @@ zink_descriptor_program_deinit_lazy(struct zink_context *ctx, struct zink_progra
VKSCR(DestroyDescriptorUpdateTemplate)(screen->dev, pg->dd->templates[i], NULL);
}
ralloc_free(pg->dd);
pg->dd = NULL;
}
static VkDescriptorPool