radeonsi: drop unfinished shader compilations when destroying shaders
authorMarek Olšák <marek.olsak@amd.com>
Wed, 31 May 2017 16:02:54 +0000 (18:02 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Jun 2017 16:43:42 +0000 (18:43 +0200)
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@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 4c980668d350531631d1a24819b58f85037a2e98..0338b8a1234ca142de3a101b955955de5f2649de 100644 (file)
@@ -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);
        }
 
index 8ac430975d7f736ccf4e2ac166fd255b2f9e211c..62bb2212110a6ca8d648167e3c7f8c9f42f786fe 100644 (file)
@@ -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;