Mesa (master): radeonsi: drop unfinished shader compilations when destroying shaders

Marek Olšák mareko at kemper.freedesktop.org
Wed Jun 7 16:43:55 UTC 2017


Module: Mesa
Branch: master
Commit: 38bd468a78b149c2cb1d105715231e7241d1dc5c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38bd468a78b149c2cb1d105715231e7241d1dc5c

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed May 31 18:02:54 2017 +0200

radeonsi: drop unfinished shader compilations when destroying shaders

If we enqueue too many jobs and destroy the GL context, it may take
several seconds before the jobs finish. Just drop them instead.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/drivers/radeonsi/si_compute.c       | 3 ++-
 src/gallium/drivers/radeonsi/si_state_shaders.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 4c980668d3..0338b8a123 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -860,7 +860,8 @@ static void si_delete_compute_state(struct pipe_context *ctx, void* state){
 	}
 
 	if (program->ir_type == PIPE_SHADER_IR_TGSI) {
-		util_queue_fence_wait(&program->ready);
+		util_queue_drop_job(&sctx->screen->shader_compiler_queue,
+				    &program->ready);
 		util_queue_fence_destroy(&program->ready);
 	}
 
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 8ac430975d..62bb221211 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2258,7 +2258,8 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 static void si_delete_shader(struct si_context *sctx, struct si_shader *shader)
 {
 	if (shader->is_optimized) {
-		util_queue_fence_wait(&shader->optimized_ready);
+		util_queue_drop_job(&sctx->screen->shader_compiler_queue,
+				    &shader->optimized_ready);
 		util_queue_fence_destroy(&shader->optimized_ready);
 	}
 
@@ -2315,7 +2316,7 @@ static void si_destroy_shader_selector(struct si_context *sctx,
 		[PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
 	};
 
-	util_queue_fence_wait(&sel->ready);
+	util_queue_drop_job(&sctx->screen->shader_compiler_queue, &sel->ready);
 
 	if (current_shader[sel->type]->cso == sel) {
 		current_shader[sel->type]->cso = NULL;




More information about the mesa-commit mailing list