Commit 84e845c9 authored by Tapani Pälli's avatar Tapani Pälli
Browse files

mesa/st: release variants for active programs before unref



Programs can be shared among many contexts and each program holds a
variant list which has context specific variants. When context gets
destroyed it must make sure it relases all variants, otherwise remaining
context that utilizes same program will attempt to save a zombie shader
for already deleted context when releasing program and its variants.

Fixes:
   dEQP-EGL.functional.sharing.gles2.program.render

and other flaky multihread dEQP-EGL failures.

v2: pass program pointer via & (Marek)
Signed-off-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
Reviewed-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Tested-by: Marge Bot <mesa/mesa!4386>
Part-of: <mesa/mesa!4386>
parent 4822cc97
...@@ -1070,12 +1070,12 @@ st_destroy_context(struct st_context *st) ...@@ -1070,12 +1070,12 @@ st_destroy_context(struct st_context *st)
simple_mtx_destroy(&st->zombie_sampler_views.mutex); simple_mtx_destroy(&st->zombie_sampler_views.mutex);
simple_mtx_destroy(&st->zombie_shaders.mutex); simple_mtx_destroy(&st->zombie_shaders.mutex);
st_reference_prog(st, &st->fp, NULL); st_release_program(st, &st->fp);
st_reference_prog(st, &st->gp, NULL); st_release_program(st, &st->gp);
st_reference_prog(st, &st->vp, NULL); st_release_program(st, &st->vp);
st_reference_prog(st, &st->tcp, NULL); st_release_program(st, &st->tcp);
st_reference_prog(st, &st->tep, NULL); st_release_program(st, &st->tep);
st_reference_prog(st, &st->cp, NULL); st_release_program(st, &st->cp);
/* release framebuffer in the winsys buffers list */ /* release framebuffer in the winsys buffers list */
LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) { LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) {
......
...@@ -334,6 +334,19 @@ st_release_variants(struct st_context *st, struct st_program *p) ...@@ -334,6 +334,19 @@ st_release_variants(struct st_context *st, struct st_program *p)
*/ */
} }
/**
* Free all basic program variants and unref program.
*/
void
st_release_program(struct st_context *st, struct st_program **p)
{
if (!*p)
return;
st_release_variants(st, *p);
st_reference_prog(st, p, NULL);
}
void void
st_finalize_nir_before_variants(struct nir_shader *nir) st_finalize_nir_before_variants(struct nir_shader *nir)
{ {
......
...@@ -317,6 +317,9 @@ st_get_common_variant(struct st_context *st, ...@@ -317,6 +317,9 @@ st_get_common_variant(struct st_context *st,
extern void extern void
st_release_variants(struct st_context *st, struct st_program *p); st_release_variants(struct st_context *st, struct st_program *p);
extern void
st_release_program(struct st_context *st, struct st_program **p);
extern void extern void
st_destroy_program_variants(struct st_context *st); st_destroy_program_variants(struct st_context *st);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment