Mesa (master): radeonsi: save the contents of indirect buffers for debug contexts

Marek Olšák mareko at kemper.freedesktop.org
Wed Aug 26 17:25:37 UTC 2015


Module: Mesa
Branch: master
Commit: be6dc8777662645958d4be6639ee2bb47c5054d8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be6dc8777662645958d4be6639ee2bb47c5054d8

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Aug 15 12:46:17 2015 +0200

radeonsi: save the contents of indirect buffers for debug contexts

This will be used by the IB parser.

Acked-by: Christian König <christian.koenig at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>

---

 src/gallium/drivers/radeonsi/si_hw_context.c |    8 ++++++++
 src/gallium/drivers/radeonsi/si_pipe.c       |    2 ++
 src/gallium/drivers/radeonsi/si_pipe.h       |    5 +++++
 3 files changed, 15 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 307dc39..f848c64 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -130,6 +130,14 @@ void si_context_gfx_flush(void *context, unsigned flags,
 	/* force to keep tiling flags */
 	flags |= RADEON_FLUSH_KEEP_TILING_FLAGS;
 
+	/* Save the IB for debug contexts. */
+	if (ctx->is_debug) {
+		free(ctx->last_ib);
+		ctx->last_ib_dw_size = cs->cdw;
+		ctx->last_ib = malloc(cs->cdw * 4);
+		memcpy(ctx->last_ib, cs->buf, cs->cdw * 4);
+	}
+
 	/* Flush the CS. */
 	ws->cs_flush(cs, flags, &ctx->last_gfx_fence,
 		     ctx->screen->b.cs_count++);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index f6d4a5a..e5900b7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -81,6 +81,7 @@ static void si_destroy_context(struct pipe_context *context)
 	LLVMDisposeTargetMachine(sctx->tm);
 #endif
 
+	free(sctx->last_ib);
 	FREE(sctx);
 }
 
@@ -112,6 +113,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
 	sctx->b.b.destroy = si_destroy_context;
 	sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;
 	sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
+	sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;
 
 	if (!r600_common_context_init(&sctx->b, &sscreen->b))
 		goto fail;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 3ab9538..3672fec 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -243,6 +243,11 @@ struct si_context {
 	struct si_shader_selector *last_tcs;
 	int			last_num_tcs_input_cp;
 	int			last_tes_sh_base;
+
+	/* Debug state. */
+	bool			is_debug;
+	uint32_t		*last_ib;
+	unsigned		last_ib_dw_size;
 };
 
 /* cik_sdma.c */




More information about the mesa-commit mailing list