From patchwork Mon Apr 22 19:00:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2473601 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id C1CACDF23A for ; Mon, 22 Apr 2013 19:02:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B2113E5DD7 for ; Mon, 22 Apr 2013 12:02:01 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id BB517E5DD7 for ; Mon, 22 Apr 2013 11:58:33 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 1005) id 870DA88625; Mon, 22 Apr 2013 18:58:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on shiva.chad-versace.us X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable version=3.3.2 Received: from lundgren.kumite (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by shiva.localdomain (Postfix) with ESMTPSA id E14FA88652; Mon, 22 Apr 2013 18:58:30 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Mon, 22 Apr 2013 12:00:56 -0700 Message-Id: <1366657257-5017-3-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1366657257-5017-1-git-send-email-ben@bwidawsk.net> References: <1366657257-5017-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 3/4] intel_error_decode: Fix ACTHD/HEAD mess with libdrm X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Easy to do with the stuff in place before this. Signed-off-by: Ben Widawsky Reviewed-by: Chris Wilson --- 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", ®); if (matched == 1) { head[i++] = print_head(reg); + raw_head = reg; } matched = sscanf(line, " ACTHD: 0x%08x\n", ®); - 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", ®); if (matched == 1 && reg)