summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_debug.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-09-26 03:14:43 +0200
committerMarek Olšák <[email protected]>2015-10-03 22:06:07 +0200
commit4502d0bf8857d5900882466a69ca8cae2ee5d90e (patch)
tree6e4627fac38526d32395564988fd3ea3846605d5 /src/gallium/drivers/radeonsi/si_debug.c
parent89f73827d03e28af548cc11247ebd6e2825789af (diff)
radeonsi: move dumping the last IB into its own function
v2: indentation fix Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_debug.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_debug.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index d3fd201ae26..ccdc6921896 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -392,6 +392,33 @@ static void si_dump_debug_registers(struct si_context *sctx, FILE *f)
fprintf(f, "\n");
}
+static void si_dump_last_ib(struct si_context *sctx, FILE *f)
+{
+ int last_trace_id = -1;
+
+ if (!sctx->last_ib)
+ return;
+
+ if (sctx->last_trace_buf) {
+ /* We are expecting that the ddebug pipe has already
+ * waited for the context, so this buffer should be idle.
+ * If the GPU is hung, there is no point in waiting for it.
+ */
+ uint32_t *map = sctx->b.ws->buffer_map(sctx->last_trace_buf->cs_buf,
+ NULL,
+ PIPE_TRANSFER_UNSYNCHRONIZED |
+ PIPE_TRANSFER_READ);
+ if (map)
+ last_trace_id = *map;
+ }
+
+ si_parse_ib(f, sctx->last_ib, sctx->last_ib_dw_size,
+ last_trace_id);
+ free(sctx->last_ib); /* dump only once */
+ sctx->last_ib = NULL;
+ r600_resource_reference(&sctx->last_trace_buf, NULL);
+}
+
static void si_dump_debug_state(struct pipe_context *ctx, FILE *f,
unsigned flags)
{
@@ -406,29 +433,7 @@ static void si_dump_debug_state(struct pipe_context *ctx, FILE *f,
si_dump_shader(sctx->gs_shader, "Geometry", f);
si_dump_shader(sctx->ps_shader, "Fragment", f);
- if (sctx->last_ib) {
- int last_trace_id = -1;
-
- if (sctx->last_trace_buf) {
- /* We are expecting that the ddebug pipe has already
- * waited for the context, so this buffer should be idle.
- * If the GPU is hung, there is no point in waiting for it.
- */
- uint32_t *map =
- sctx->b.ws->buffer_map(sctx->last_trace_buf->cs_buf,
- NULL,
- PIPE_TRANSFER_UNSYNCHRONIZED |
- PIPE_TRANSFER_READ);
- if (map)
- last_trace_id = *map;
- }
-
- si_parse_ib(f, sctx->last_ib, sctx->last_ib_dw_size,
- last_trace_id);
- free(sctx->last_ib); /* dump only once */
- sctx->last_ib = NULL;
- r600_resource_reference(&sctx->last_trace_buf, NULL);
- }
+ si_dump_last_ib(sctx, f);
fprintf(f, "Done.\n");
}