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>
This commit is contained in:
Mike Blumenkrantz 2023-09-06 15:46:23 -04:00 committed by Marge Bot
parent 4303ea7b9a
commit fd297ecf98

View file

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