From: Ben Widawsky Subject: [PATCH 2/4] intel_error_decode: HEAD stuff Date: Mon, 22 Apr 2013 12:00:55 -0700 Message-ID: <1366657257-5017-2-git-send-email-ben@bwidawsk.net> References: <1366657257-5017-1-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id E10C7E5F20 for ; Mon, 22 Apr 2013 11:58:32 -0700 (PDT) In-Reply-To: <1366657257-5017-1-git-send-email-ben@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org Show the decoded HEAD value, as well as print the calculated head offset per ringbuffer. This will be superceded in the next commit, but I think more info is better. Signed-off-by: Ben Widawsky --- tools/intel_error_decode.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c index f554d57..e29ee1e 100644 --- a/tools/intel_error_decode.c +++ b/tools/intel_error_decode.c @@ -55,6 +55,13 @@ #include "intel_gpu_tools.h" #include "instdone.h" +static uint32_t +print_head(unsigned int reg) +{ + printf(" head = 0x%08x, wraps = %d\n", reg & (0x7ffff<<2), reg >> 21); + return reg & (0x7ffff<<2); +} + static void print_instdone(uint32_t devid, unsigned int instdone, unsigned int instdone1) { @@ -288,6 +295,8 @@ 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}; + int i = 0, num_rings = -1; while (getline(&line, &line_size, file) > 0) { char *dashes; @@ -299,6 +308,9 @@ read_data_file(FILE *file) strncpy(new_ring_name, line, dashes - line); new_ring_name[dashes - line - 1] = '\0'; + if (num_rings == -1) + num_rings = i; + matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n", &new_gtt_offset); if (matched == 1) { @@ -324,10 +336,11 @@ read_data_file(FILE *file) &new_gtt_offset); if (matched == 1) { if (count) { - printf("%s (%s) at 0x%08x:\n", + printf("%s (%s) at 0x%08x; HEAD points to 0x%08x:\n", buffer_type[is_batch], ring_name, - gtt_offset); + gtt_offset, + head[i++ % num_rings] + gtt_offset); drm_intel_decode_set_batch_pointer(decode_ctx, data, gtt_offset, count); @@ -377,6 +390,11 @@ read_data_file(FILE *file) decode_ctx = drm_intel_decode_context_alloc(devid); } + matched = sscanf(line, " HEAD: 0x%08x\n", ®); + if (matched == 1) { + head[i++] = print_head(reg); + } + matched = sscanf(line, " ACTHD: 0x%08x\n", ®); if (matched == 1) drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff); -- 1.8.2.1