Module: Mesa Branch: main Commit: fd297ecf98ee14f3eba08c0e1e2aa0f277e2aaac URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd297ecf98ee14f3eba08c0e1e2aa0f277e2aaac
Author: Mike Blumenkrantz <michael.blumenkra...@gmail.com> Date: Wed Sep 6 15:46:23 2023 -0400 zink: always add a per-prog ref for gpl libs previously non-separable progs had their libs owned exclusively by the shaders, which meant it was possible for a background compile job to crash while the context was being destroyed when accessing libs which no longer had active shaders fixes #9234 cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25088> --- src/gallium/drivers/zink/zink_program.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 669f4474044..5f1ed105476 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -1121,6 +1121,8 @@ zink_create_gfx_program(struct zink_context *ctx, if (screen->optimal_keys) prog->libs = find_or_create_lib_cache(screen, prog); + if (prog->libs) + p_atomic_inc(&prog->libs->refcount); struct mesa_sha1 sctx; _mesa_sha1_init(&sctx); @@ -1547,7 +1549,7 @@ zink_destroy_gfx_program(struct zink_screen *screen, blob_finish(&prog->blobs[i]); } } - if (prog->is_separable && prog->libs) + if (prog->libs) zink_gfx_lib_cache_unref(screen, prog->libs); ralloc_free(prog);