diff options
author | Marek Olšák <marek.olsak@amd.com> | 2016-07-22 23:40:45 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2016-07-26 23:06:46 +0200 |
commit | 1e5f00f9d5f412526d025f8f4762160ce7b5f2ba (patch) | |
tree | dd95c6ab356afabac296dfa377801cdd5282edda /src/gallium/drivers/radeonsi/si_state_shaders.c | |
parent | 18475aab6d484d4eb49b1cc9124c9aabc79f8527 (diff) | |
download | external_mesa3d-1e5f00f9d5f412526d025f8f4762160ce7b5f2ba.zip external_mesa3d-1e5f00f9d5f412526d025f8f4762160ce7b5f2ba.tar.gz external_mesa3d-1e5f00f9d5f412526d025f8f4762160ce7b5f2ba.tar.bz2 |
radeonsi: pre-generate shader logs for ddebug
This cuts down the overhead of si_dump_shader when ddebug is capturing
shader logs, which is done for every draw call unconditionally (that's
quite a lot of work for a draw call).
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_shaders.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index fd3ba9d..47cf496 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -992,7 +992,8 @@ static int si_shader_select_with_key(struct si_screen *sscreen, union si_shader_key *key, LLVMTargetMachineRef tm, struct pipe_debug_callback *debug, - bool wait) + bool wait, + bool is_debug_context) { struct si_shader_selector *sel = state->cso; struct si_shader *current = state->current; @@ -1043,6 +1044,16 @@ static int si_shader_select_with_key(struct si_screen *sscreen, pipe_mutex_unlock(sel->mutex); return r; } + + if (is_debug_context) { + FILE *f = open_memstream(&shader->shader_log, + &shader->shader_log_size); + if (f) { + si_shader_dump(sscreen, shader, NULL, sel->type, f); + fclose(f); + } + } + si_shader_init_pm4_state(sscreen, shader); if (!sel->last_variant) { @@ -1065,7 +1076,8 @@ static int si_shader_select(struct pipe_context *ctx, si_shader_selector_key(ctx, state->cso, &key); return si_shader_select_with_key(sctx->screen, state, &key, - sctx->tm, &sctx->b.debug, true); + sctx->tm, &sctx->b.debug, true, + sctx->is_debug); } static void si_parse_next_shader_property(const struct tgsi_shader_info *info, @@ -1190,7 +1202,7 @@ void si_init_shader_selector_async(void *job, int thread_index) } if (si_shader_select_with_key(sscreen, &state, &key, tm, debug, - false)) + false, sel->is_debug_context)) fprintf(stderr, "radeonsi: can't create a monolithic shader\n"); } } @@ -1209,6 +1221,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, sel->screen = sscreen; sel->tm = sctx->tm; sel->debug = sctx->b.debug; + sel->is_debug_context = sctx->is_debug; sel->tokens = tgsi_dup_tokens(state->tokens); if (!sel->tokens) { FREE(sel); @@ -1325,6 +1338,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, util_queue_fence_init(&sel->ready); if ((sctx->b.debug.debug_message && !sctx->b.debug.async) || + sctx->is_debug || r600_can_dump_shader(&sscreen->b, sel->info.processor) || !util_queue_is_initialized(&sscreen->shader_compiler_queue)) si_init_shader_selector_async(sel, -1); |