Skip to contentSkip to conversation

Add more detail and colour to the ring decoder

PATCH New Tom St Denis 1 participant 1 message Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add more detail and colour to the ring decoder

Now you can use '-O use_colour' to spruce up the ring/ib
decoder. You can previously use '-O bits' to decode
register writes which has also been cleaned up.

Assumes a wide display which for a graphics company is probably safe to assume you're not on an 80x25 MDA display.

---
 src/app/ring_read.c   |   6 +-
 src/lib/dump_ib.c     |  19 +++-
 src/lib/ring_decode.c | 304 ++++++++++++++++++++++++++++----------------------
 src/umr.h             |  10 +-
 4 files changed, 202 insertions(+), 137 deletions(-)
src/app/ring_read.c +5 -1
index 1e569875f779..424e44288f8c 100644
@@ -118,7 +118,10 @@ void umr_read_ring(struct umr_asic *asic, char *ringpath)
 
 	do {
 		value = ring_data[(start+12)>>2];
-		printf("%s.%s.ring[%4lu] == 0x%08lx   ", asic->asicname, ringname, (unsigned long)start >> 2, (unsigned long)value);
+		printf("%s.%s.ring[%s%4lu%s] == %s0x%08lx%s   ",
+			asic->asicname, ringname,
+			BLUE, (unsigned long)start >> 2, RST,
+			YELLOW, (unsigned long)value, RST);
 		if (enable_decoder && start == rptr && start != wptr) {
 			use_decoder = 1;
 			decoder.pm4.cur_opcode = 0xFFFFFFFF;
@@ -127,6 +130,7 @@ void umr_read_ring(struct umr_asic *asic, char *ringpath)
 			(start == rptr) ? 'r' : '.',
 			(start == wptr) ? 'w' : '.',
 			(start == drv_wptr) ? 'D' : '.');
+		decoder.next_ib_info.addr = start / 4;
 		if (use_decoder)
 			umr_print_decode(asic, &decoder, value);
 		printf("\n");
src/lib/dump_ib.c +16 -3
index cba497373fe2..18600fbc8010 100644
@@ -30,19 +30,32 @@ void umr_dump_ib(struct umr_asic *asic, struct umr_ring_decoder *decoder)
 	uint32_t *data = NULL, x;
 	static const char *hubs[] = { "gfxhub", "mmhub" };
 
-	printf("Dumping IB at (%s) VMID:%u 0x%llx of %u words\n",
-		hubs[decoder->next_ib_info.vmid >> 8],
+	printf("Dumping IB at (%s%s%s) VMID:%u 0x%llx of %u words from ",
+		GREEN, hubs[decoder->next_ib_info.vmid >> 8], RST,
 		(unsigned)decoder->next_ib_info.vmid & 0xFF,
 		(unsigned long long)decoder->next_ib_info.ib_addr,
 		(unsigned)decoder->next_ib_info.size/4);
 
+	if (decoder->src.ib_addr == 0)
+		printf("ring[%s%u%s]", BLUE, (unsigned)decoder->src.addr, RST);
+	else
+		printf("IB[%s%u%s] at %s%d%s:%s0x%llx%s",
+			BLUE, (unsigned)decoder->src.addr, RST,
+			YELLOW, decoder->src.vmid, RST,
+			YELLOW, (unsigned long long)decoder->src.ib_addr, RST);
+
+	printf("\n");
+
 	// read IB
 	data = calloc(sizeof(*data), decoder->next_ib_info.size/sizeof(*data));
 	if (data && !umr_read_vram(asic, decoder->next_ib_info.vmid, decoder->next_ib_info.ib_addr, decoder->next_ib_info.size, data)) {
 	// dump IB
 		decoder->pm4.cur_opcode = 0xFFFFFFFF;
 		for (x = 0; x < decoder->next_ib_info.size/4; x++) {
-			printf("IB[%5u] = 0x%08lx ... ", (unsigned)x, (unsigned long)data[x]);
+			decoder->next_ib_info.addr = x;
+			printf("IB[%s%5u%s] = %s0x%08lx%s ... ",
+			BLUE, (unsigned)x, RST,
+			YELLOW, (unsigned long)data[x], RST);
 			umr_print_decode(asic, decoder, data[x]);
 			printf("\n");
 		}
src/lib/ring_decode.c +172 -132

551 lines not on this page · raw message

src/umr.h +9 -1
index 6efe3a468253..c0821f2d2c03 100644
@@ -352,6 +352,13 @@ struct umr_ring_decoder {
 		pm;
 
 	struct {
+		uint64_t
+			addr,
+			vmid,
+			ib_addr;
+	} src; 
+
+	struct {
 		uint32_t
 			cur_opcode,
 			pkt_type,
@@ -382,7 +389,8 @@ struct umr_ring_decoder {
 		uint64_t ib_addr,
 			 vm_base_addr; // not used yet (will be used by IB parser...)
 		uint32_t vmid,
-			 size;
+			 size,
+			 addr;
 	} next_ib_info;
 };
 
Signature · 6 lines
2.12.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx