diff mbox

[3/4] intel_error_decode: Fix ACTHD/HEAD mess with libdrm

Message ID 1366657257-5017-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky April 22, 2013, 7 p.m. UTC
Easy to do with the stuff in place before this.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 tools/intel_error_decode.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

Comments

Chris Wilson April 22, 2013, 7:14 p.m. UTC | #1
On Mon, Apr 22, 2013 at 12:00:56PM -0700, Ben Widawsky wrote:
> Easy to do with the stuff in place before this.

This looks like it will make me happier, thanks.
With just a couple of minor changes,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Ben Widawsky April 22, 2013, 8 p.m. UTC | #2
On Mon, Apr 22, 2013 at 12:00:56PM -0700, Ben Widawsky wrote:
> Easy to do with the stuff in place before this.
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>


My assumptions on ordering of the error dump were incorrect. Ie. this
patch is no good. Working on a fix when I have some time.

[snip]
diff mbox

Patch

diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index e29ee1e..96aaf72 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -295,7 +295,7 @@  read_data_file(FILE *file)
 	const char *buffer_type[2] = {  "ringbuffer", "batchbuffer" };
 	char *ring_name = NULL;
 	int is_batch = 1;
-	uint32_t head[3] = {-1, -1, -1};
+	uint32_t raw_head = -1, head[3] = {-1, -1, -1}, acthd[3] = {-1,-1,-1};
 	int i = 0, num_rings = -1;
 
 	while (getline(&line, &line_size, file) > 0) {
@@ -319,6 +319,9 @@  read_data_file(FILE *file)
 							buffer_type[is_batch],
 							ring_name,
 							gtt_offset);
+					drm_intel_decode_set_head_tail(decode_ctx,
+							acthd[i++ % num_rings] + gtt_offset,
+							0xffffffff);
 					drm_intel_decode_set_batch_pointer(decode_ctx,
 							data, gtt_offset,
 							count);
@@ -341,6 +344,9 @@  read_data_file(FILE *file)
 							ring_name,
 							gtt_offset,
 							head[i++ % num_rings] + gtt_offset);
+					drm_intel_decode_set_head_tail(decode_ctx,
+							acthd[i++ % num_rings] + gtt_offset,
+							0xffffffff);
 					drm_intel_decode_set_batch_pointer(decode_ctx,
 							data, gtt_offset,
 							count);
@@ -393,11 +399,17 @@  read_data_file(FILE *file)
 			matched = sscanf(line, "  HEAD: 0x%08x\n", &reg);
 			if (matched == 1) {
 				head[i++] = print_head(reg);
+				raw_head = reg;
 			}
 
 			matched = sscanf(line, "  ACTHD: 0x%08x\n", &reg);
-			if (matched == 1)
-				drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff);
+			if (matched == 1) {
+				assert(raw_head != -1);
+				if (reg == raw_head)
+					acthd[i] = print_head(reg);
+				else
+					acthd[i] = reg;
+			}
 
 			matched = sscanf(line, "  PGTBL_ER: 0x%08x\n", &reg);
 			if (matched == 1 && reg)