[Intel-gfx] [PATCH] Output a hex dump of each instruction

Ben Gamari bgamari at gmail.com
Thu Jan 15 04:11:50 CET 2009


Output a hex dump of each instruction we dump from the ring buffer to
aid more complex debugging situations.
---
 drivers/gpu/drm/i915/i915_gem_debugfs.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c
index 1386605..65eecdf 100644
--- a/drivers/gpu/drm/i915/i915_gem_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c
@@ -569,11 +569,13 @@ static int valid_command(uint32_t cmd)
 	return count;
 }
 
-static int dump_cmd(struct seq_file *m, uint32_t cmd, int count)
+static int dump_cmd(struct seq_file *m, volatile uint32_t *ptr, int count)
 {
+	uint32_t  cmd = *ptr;
 	uint32_t  type = (cmd >> 29) & 0x7;
 	uint32_t  opcode, subopcode;
 	uint32_t  pipeline_type;
+	int i;
 	int ret = 1;
 
 	seq_printf(m, "\t");
@@ -582,9 +584,9 @@ static int dump_cmd(struct seq_file *m, uint32_t cmd, int count)
 		case 0:
 			opcode = (cmd >> 23) & 0x3f;
 			if (mi_cmds[opcode])
-				seq_printf(m, "%-40.40s %d\n", mi_cmds[opcode], count);
+				seq_printf(m, "%-40.40s %d", mi_cmds[opcode], count);
 			else
-				seq_printf(m, "Memory Interface Reserved\n");
+				seq_printf(m, "Memory Interface Reserved");
 			break;
 
 		case 1:
@@ -594,9 +596,9 @@ static int dump_cmd(struct seq_file *m, uint32_t cmd, int count)
 		case 2:
 			opcode = (cmd >> 22) & 0x7f;
 			if (_2d_cmds[opcode])
-				seq_printf(m, "%-40.40s %d\n", _2d_cmds[opcode], count);
+				seq_printf(m, "%-40.40s %d", _2d_cmds[opcode], count);
 			else
-				seq_printf(m, "2D Reserved\n");
+				seq_printf(m, "2D Reserved");
 			break;
 
 			/* 3D */
@@ -605,19 +607,24 @@ static int dump_cmd(struct seq_file *m, uint32_t cmd, int count)
 			opcode = (cmd >> 24) & 0x7;
 			subopcode = (cmd >> 16) & 0xff;
 			if (_3d_cmds[pipeline_type][opcode][subopcode].name) {
-				seq_printf(m, "%-40.40s %d\n",
+				seq_printf(m, "%-40.40s %d",
 						_3d_cmds[pipeline_type][opcode][subopcode].name,
 						count);
 			} else {
-				seq_printf(m, "3D/Media Reserved (pipe %d op %d sub %d)\n",
+				seq_printf(m, "3D/Media Reserved (pipe %d op %d sub %d)",
 						pipeline_type, opcode, subopcode);
 			}
 			break;
 
 		default:
-			seq_printf(m, "Reserved\n");
+			seq_printf(m, "Reserved");
 			break;
 	}
+
+	seq_printf(m, "     [");
+	for (i=0; i < count; i++)
+		seq_printf(m, " %04x %04x ", ptr[i] & 0xff00, ptr[i] & 0x00ff);
+	seq_printf(m, "]\n");
 	return ret;
 }
 
@@ -679,7 +686,7 @@ static void dump_cmds (struct seq_file	*m,
 			ptr = (volatile uint32_t *) (virt + ring);
 			data = *ptr;
 			count = valid_command(data);
-			dump_cmd(m, data, count);
+			dump_cmd(m, ptr, count);
 
 			/* check for MI_BATCH_BUFFER_END */
 			if (data == (0x0a << 23))
-- 
1.6.0.6




More information about the Intel-gfx mailing list