diff options
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_compute.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_compute.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index e55988af4cc..3eee907d44b 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -23,6 +23,7 @@ */ #include "tgsi/tgsi_parse.h" +#include "util/u_async_debug.h" #include "util/u_memory.h" #include "util/u_upload_mgr.h" @@ -84,14 +85,10 @@ static void si_create_compute_state_async(void *job, int thread_index) LLVMTargetMachineRef tm; struct pipe_debug_callback *debug = &program->compiler_ctx_state.debug; - if (thread_index >= 0) { - assert(thread_index < ARRAY_SIZE(program->screen->tm)); - tm = program->screen->tm[thread_index]; - if (!debug->async) - debug = NULL; - } else { - tm = program->compiler_ctx_state.tm; - } + assert(!debug->debug_message || debug->async); + assert(thread_index >= 0); + assert(thread_index < ARRAY_SIZE(program->screen->tm)); + tm = program->screen->tm[thread_index]; memset(&sel, 0, sizeof(sel)); @@ -167,20 +164,31 @@ static void *si_create_compute_state( return NULL; } - program->compiler_ctx_state.tm = sctx->tm; program->compiler_ctx_state.debug = sctx->debug; program->compiler_ctx_state.is_debug_context = sctx->is_debug; p_atomic_inc(&sscreen->b.num_shaders_created); util_queue_fence_init(&program->ready); - if ((sctx->debug.debug_message && !sctx->debug.async) || - sctx->is_debug || - si_can_dump_shader(&sscreen->b, PIPE_SHADER_COMPUTE)) - si_create_compute_state_async(program, -1); - else - util_queue_add_job(&sscreen->shader_compiler_queue, - program, &program->ready, - si_create_compute_state_async, NULL); + struct util_async_debug_callback async_debug; + bool wait = + (sctx->debug.debug_message && !sctx->debug.async) || + sctx->is_debug || + si_can_dump_shader(&sscreen->b, PIPE_SHADER_COMPUTE); + + if (wait) { + u_async_debug_init(&async_debug); + program->compiler_ctx_state.debug = async_debug.base; + } + + util_queue_add_job(&sscreen->shader_compiler_queue, + program, &program->ready, + si_create_compute_state_async, NULL); + + if (wait) { + util_queue_fence_wait(&program->ready); + u_async_debug_drain(&async_debug, &sctx->debug); + u_async_debug_cleanup(&async_debug); + } } else { const struct pipe_llvm_program_header *header; const char *code; |