summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2024-04-24 11:14:58 -0400
committerEric Engestrom <eric@engestrom.ch>2024-04-30 18:43:10 +0200
commit0a174bb629a54adf8f99a8740ec1bf297df05d3f (patch)
treebed813bde7ebda7ecae4a5cac8e227041f4d1840
parent4af94a8214d9f75491b72181ace89c553a330a81 (diff)
zink: fully wait on all program fences during ctx destroy
optimized pipeline compile jobs may still be ongoing during ctx destroy, and these must complete too or else crashes will occur fixes shutdown crash with dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.teximage2d_render cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28900> (cherry picked from commit bd1a3921d135a99ae8098aa8eb7be90cc2c9eaab)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/zink/zink_context.c2
-rw-r--r--src/gallium/drivers/zink/zink_program.c17
-rw-r--r--src/gallium/drivers/zink/zink_program.h2
4 files changed, 21 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 321381f2ac9..0ee808f2c61 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1744,7 +1744,7 @@
"description": "zink: fully wait on all program fences during ctx destroy",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index d58293109ac..d759045b873 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -137,7 +137,7 @@ zink_context_destroy(struct pipe_context *pctx)
simple_mtx_lock((&ctx->program_lock[i]));
hash_table_foreach(&ctx->program_cache[i], entry) {
struct zink_program *pg = entry->data;
- util_queue_fence_wait(&pg->cache_fence);
+ zink_program_finish(ctx, pg);
pg->removed = true;
}
simple_mtx_unlock((&ctx->program_lock[i]));
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 58f480e8774..cb6cdbfb753 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -830,6 +830,23 @@ zink_gfx_program_compile_queue(struct zink_context *ctx, struct zink_gfx_pipelin
}
}
+void
+zink_program_finish(struct zink_context *ctx, struct zink_program *pg)
+{
+ util_queue_fence_wait(&pg->cache_fence);
+ if (pg->is_compute)
+ return;
+ struct zink_gfx_program *prog = (struct zink_gfx_program*)pg;
+ for (int r = 0; r < ARRAY_SIZE(prog->pipelines); ++r) {
+ for (int i = 0; i < ARRAY_SIZE(prog->pipelines[0]); ++i) {
+ hash_table_foreach(&prog->pipelines[r][i], entry) {
+ struct zink_gfx_pipeline_cache_entry *pc_entry = entry->data;
+ util_queue_fence_wait(&pc_entry->fence);
+ }
+ }
+ }
+}
+
static void
update_cs_shader_module(struct zink_context *ctx, struct zink_compute_program *comp)
{
diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h
index c5ecf99d8b3..6f372923135 100644
--- a/src/gallium/drivers/zink/zink_program.h
+++ b/src/gallium/drivers/zink/zink_program.h
@@ -133,6 +133,8 @@ uint32_t hash_gfx_input_dynamic(const void *key);
void
zink_gfx_program_compile_queue(struct zink_context *ctx, struct zink_gfx_pipeline_cache_entry *pc_entry);
+void
+zink_program_finish(struct zink_context *ctx, struct zink_program *pg);
static inline unsigned
get_primtype_idx(enum mesa_prim mode)