[Intel-gfx] [PATCH 3/4] intel_error_decode: Fix ACTHD/HEAD mess with libdrm

Ben Widawsky ben at bwidawsk.net
Mon Apr 22 21:00:56 CEST 2013


Easy to do with the stuff in place before this.

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

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)
-- 
1.8.2.1




More information about the Intel-gfx mailing list