[Mesa-dev] [PATCH 12/16] radeonsi: log draw and compute state into log context
Nicolai Hähnle
nhaehnle at gmail.com
Wed Aug 16 11:05:42 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Also add missing trace emits and CS logging for compute launches.
---
src/gallium/drivers/radeonsi/si_compute.c | 6 +++
src/gallium/drivers/radeonsi/si_debug.c | 72 +++++++++++++++-------------
src/gallium/drivers/radeonsi/si_pipe.h | 2 +
src/gallium/drivers/radeonsi/si_state_draw.c | 3 ++
4 files changed, 51 insertions(+), 32 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 8c016ba65ab..d0e481a3f15 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -801,6 +801,9 @@ static void si_launch_grid(
si_need_cs_space(sctx);
+ if (sctx->b.log)
+ si_log_compute_state(sctx, sctx->b.log);
+
if (!sctx->cs_shader_state.initialized)
si_initialize_compute(sctx);
@@ -847,6 +850,9 @@ static void si_launch_grid(
si_ce_post_draw_synchronization(sctx);
+ if (unlikely(sctx->current_saved_cs))
+ si_trace_emit(sctx);
+
sctx->compute_is_busy = true;
sctx->b.num_compute_calls++;
if (sctx->cs_shader_state.uses_scratch)
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index 9a7b0908199..8dd1e1329c3 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -1064,34 +1064,38 @@ static void si_dump_debug_state(struct pipe_context *ctx, FILE *f,
si_dump_command("Wave information", "umr -O bits -wa", f);
}
}
+}
- struct u_log_context log;
- u_log_context_init(&log);
-
- if (flags & PIPE_DUMP_CURRENT_STATES)
- si_dump_framebuffer(sctx, &log);
-
- if (flags & PIPE_DUMP_CURRENT_SHADERS) {
- si_dump_gfx_shader(sctx, &sctx->vs_shader, &log);
- si_dump_gfx_shader(sctx, &sctx->tcs_shader, &log);
- si_dump_gfx_shader(sctx, &sctx->tes_shader, &log);
- si_dump_gfx_shader(sctx, &sctx->gs_shader, &log);
- si_dump_gfx_shader(sctx, &sctx->ps_shader, &log);
- si_dump_compute_shader(&sctx->cs_shader_state, &log);
-
- si_dump_descriptor_list(&sctx->descriptors[SI_DESCS_RW_BUFFERS],
- "", "RW buffers", 4, SI_NUM_RW_BUFFERS,
- si_identity, &log);
- si_dump_gfx_descriptors(sctx, &sctx->vs_shader, &log);
- si_dump_gfx_descriptors(sctx, &sctx->tcs_shader, &log);
- si_dump_gfx_descriptors(sctx, &sctx->tes_shader, &log);
- si_dump_gfx_descriptors(sctx, &sctx->gs_shader, &log);
- si_dump_gfx_descriptors(sctx, &sctx->ps_shader, &log);
- si_dump_compute_descriptors(sctx, &log);
- }
+void si_log_draw_state(struct si_context *sctx, struct u_log_context *log)
+{
+ if (!log)
+ return;
- u_log_new_page_print(&log, f);
- u_log_context_destroy(&log);
+ si_dump_framebuffer(sctx, log);
+
+ si_dump_gfx_shader(sctx, &sctx->vs_shader, log);
+ si_dump_gfx_shader(sctx, &sctx->tcs_shader, log);
+ si_dump_gfx_shader(sctx, &sctx->tes_shader, log);
+ si_dump_gfx_shader(sctx, &sctx->gs_shader, log);
+ si_dump_gfx_shader(sctx, &sctx->ps_shader, log);
+
+ si_dump_descriptor_list(&sctx->descriptors[SI_DESCS_RW_BUFFERS],
+ "", "RW buffers", 4, SI_NUM_RW_BUFFERS,
+ si_identity, log);
+ si_dump_gfx_descriptors(sctx, &sctx->vs_shader, log);
+ si_dump_gfx_descriptors(sctx, &sctx->tcs_shader, log);
+ si_dump_gfx_descriptors(sctx, &sctx->tes_shader, log);
+ si_dump_gfx_descriptors(sctx, &sctx->gs_shader, log);
+ si_dump_gfx_descriptors(sctx, &sctx->ps_shader, log);
+}
+
+void si_log_compute_state(struct si_context *sctx, struct u_log_context *log)
+{
+ if (!log)
+ return;
+
+ si_dump_compute_shader(&sctx->cs_shader_state, log);
+ si_dump_compute_descriptors(sctx, log);
}
static void si_dump_dma(struct si_context *sctx,
@@ -1243,13 +1247,17 @@ void si_check_vm_faults(struct r600_common_context *ctx,
sctx->apitrace_call_number);
switch (ring) {
- case RING_GFX:
- si_dump_debug_state(&sctx->b.b, f,
- PIPE_DUMP_CURRENT_STATES |
- PIPE_DUMP_CURRENT_SHADERS |
- PIPE_DUMP_LAST_COMMAND_BUFFER);
- break;
+ case RING_GFX: {
+ struct u_log_context log;
+ u_log_context_init(&log);
+ si_log_draw_state(sctx, &log);
+ si_log_compute_state(sctx, &log);
+
+ u_log_new_page_print(&log, f);
+ u_log_context_destroy(&log);
+ break;
+ }
case RING_DMA:
si_dump_dma(sctx, saved, f);
break;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 4da7e833096..5529ec8f98a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -507,6 +507,8 @@ void si_init_cp_dma_functions(struct si_context *sctx);
/* si_debug.c */
void si_auto_log_cs(void *data, struct u_log_context *log);
void si_log_hw_flush(struct si_context *sctx);
+void si_log_draw_state(struct si_context *sctx, struct u_log_context *log);
+void si_log_compute_state(struct si_context *sctx, struct u_log_context *log);
void si_init_debug_functions(struct si_context *sctx);
void si_check_vm_faults(struct r600_common_context *ctx,
struct radeon_saved_cs *saved, enum ring_type ring);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 971906bb306..b0d2c127fa1 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -1362,6 +1362,9 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
si_need_cs_space(sctx);
+ if (unlikely(sctx->b.log))
+ si_log_draw_state(sctx, sctx->b.log);
+
/* Since we've called r600_context_add_resource_size for vertex buffers,
* this must be called after si_need_cs_space, because we must let
* need_cs_space flush before we add buffers to the buffer list.
--
2.11.0
More information about the mesa-dev
mailing list