aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2020-04-01 12:08:41 +0300
committerTapani Pälli <[email protected]>2020-04-06 08:00:00 +0300
commit84e845c9696ab673f1d95fda47843028ed0c71a7 (patch)
treeda5e37896d2eada77d6035f17f90790c608c869f /src/mesa/state_tracker
parent4822cc97007b0dae4d095c507efc182628510434 (diff)
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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Cc: [email protected] Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4386> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4386>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_context.c12
-rw-r--r--src/mesa/state_tracker/st_program.c13
-rw-r--r--src/mesa/state_tracker/st_program.h3
3 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index fa309436408..645c02f3dfd 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -1070,12 +1070,12 @@ st_destroy_context(struct st_context *st)
simple_mtx_destroy(&st->zombie_sampler_views.mutex);
simple_mtx_destroy(&st->zombie_shaders.mutex);
- st_reference_prog(st, &st->fp, NULL);
- st_reference_prog(st, &st->gp, NULL);
- st_reference_prog(st, &st->vp, NULL);
- st_reference_prog(st, &st->tcp, NULL);
- st_reference_prog(st, &st->tep, NULL);
- st_reference_prog(st, &st->cp, NULL);
+ st_release_program(st, &st->fp);
+ st_release_program(st, &st->gp);
+ st_release_program(st, &st->vp);
+ st_release_program(st, &st->tcp);
+ st_release_program(st, &st->tep);
+ st_release_program(st, &st->cp);
/* release framebuffer in the winsys buffers list */
LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 466c3f1a29e..c0e63b8a98c 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -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
st_finalize_nir_before_variants(struct nir_shader *nir)
{
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 87ac3388d72..286fabc0117 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -318,6 +318,9 @@ extern void
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
st_destroy_program_variants(struct st_context *st);
extern void