From: Nicolai Hähnle Date: Sun, 22 Oct 2017 15:38:39 +0000 (+0200) Subject: radeonsi: move pipe debug callback to si_context X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd7c273e873f20474e2af1959ab2928292020941;p=mesa.git radeonsi: move pipe debug callback to si_context Reviewed-by: Marek Olšák --- diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index aa72187c570..c9502182a7e 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -589,17 +589,6 @@ static enum pipe_reset_status r600_get_reset_status(struct pipe_context *ctx) return PIPE_UNKNOWN_CONTEXT_RESET; } -static void r600_set_debug_callback(struct pipe_context *ctx, - const struct pipe_debug_callback *cb) -{ - struct r600_common_context *rctx = (struct r600_common_context *)ctx; - - if (cb) - rctx->debug = *cb; - else - memset(&rctx->debug, 0, sizeof(rctx->debug)); -} - static void r600_set_device_reset_callback(struct pipe_context *ctx, const struct pipe_device_reset_callback *cb) { @@ -694,7 +683,6 @@ bool si_common_context_init(struct r600_common_context *rctx, rctx->b.texture_subdata = u_default_texture_subdata; rctx->b.memory_barrier = r600_memory_barrier; rctx->b.flush = r600_flush_from_st; - rctx->b.set_debug_callback = r600_set_debug_callback; rctx->b.create_fence_fd = r600_create_fence_fd; rctx->b.fence_server_sync = r600_fence_server_sync; rctx->dma_clear_buffer = r600_dma_clear_buffer_fallback; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index f803ee46339..0ef5a282026 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -596,7 +596,6 @@ struct r600_common_context { bool query_active; } dcc_stats[5]; - struct pipe_debug_callback debug; struct pipe_device_reset_callback device_reset_callback; struct u_log_context *log; diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 942750b2256..e55988af4cc 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -168,12 +168,12 @@ static void *si_create_compute_state( } program->compiler_ctx_state.tm = sctx->tm; - program->compiler_ctx_state.debug = sctx->b.debug; + 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->b.debug.debug_message && !sctx->b.debug.async) || + 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); @@ -196,7 +196,7 @@ static void *si_create_compute_state( si_shader_binary_read_config(&program->shader.binary, &program->shader.config, 0); } - si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug, + si_shader_dump(sctx->screen, &program->shader, &sctx->debug, PIPE_SHADER_COMPUTE, stderr, true); if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) { fprintf(stderr, "LLVM failed to upload shader\n"); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 391997db842..7940fc8d5b2 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -154,6 +154,17 @@ si_create_llvm_target_machine(struct si_screen *sscreen) return ac_create_target_machine(sscreen->b.family, tm_options); } +static void si_set_debug_callback(struct pipe_context *ctx, + const struct pipe_debug_callback *cb) +{ + struct si_context *sctx = (struct si_context *)ctx; + + if (cb) + sctx->debug = *cb; + else + memset(&sctx->debug, 0, sizeof(sctx->debug)); +} + static void si_set_log_context(struct pipe_context *ctx, struct u_log_context *log) { @@ -182,6 +193,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, sctx->b.b.priv = NULL; sctx->b.b.destroy = si_destroy_context; sctx->b.b.emit_string_marker = si_emit_string_marker; + sctx->b.b.set_debug_callback = si_set_debug_callback; sctx->b.b.set_log_context = si_set_log_context; sctx->b.set_atom_dirty = (void *)si_set_atom_dirty; sctx->screen = sscreen; /* Easy accessing of screen/winsys. */ diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 6be51bb3ec9..6b42a54f00e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -361,6 +361,7 @@ struct si_context { void *vs_blit_color_layered; void *vs_blit_texcoord; struct si_screen *screen; + struct pipe_debug_callback debug; LLVMTargetMachineRef tm; /* only non-threaded compilation */ struct si_shader_ctx_state fixed_func_tcs_shader; struct r600_resource *wait_mem_scratch; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 75b16487480..757e889c3b7 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -2043,7 +2043,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, pipe_reference_init(&sel->reference, 1); sel->screen = sscreen; sel->compiler_ctx_state.tm = sctx->tm; - sel->compiler_ctx_state.debug = sctx->b.debug; + sel->compiler_ctx_state.debug = sctx->debug; sel->compiler_ctx_state.is_debug_context = sctx->is_debug; sel->so = state->stream_output; @@ -2272,7 +2272,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx, (void) mtx_init(&sel->mutex, mtx_plain); util_queue_fence_init(&sel->ready); - if ((sctx->b.debug.debug_message && !sctx->b.debug.async) || + if ((sctx->debug.debug_message && !sctx->debug.async) || sctx->is_debug || si_can_dump_shader(&sscreen->b, sel->info.processor)) si_init_shader_selector_async(sel, -1); @@ -3237,7 +3237,7 @@ bool si_update_shaders(struct si_context *sctx) int r; compiler_state.tm = sctx->tm; - compiler_state.debug = sctx->b.debug; + compiler_state.debug = sctx->debug; compiler_state.is_debug_context = sctx->is_debug; /* Update stages before GS. */