From: Chris Wilson Subject: Re: [PATCH 3/3] [v3] intel_error_decode: Fix ACTHD/HEAD mess with libdrm Date: Tue, 23 Apr 2013 09:30:33 +0100 Message-ID: <20130423083033.GH3889@cantiga.alporthouse.com> References: <1366657257-5017-1-git-send-email-ben@bwidawsk.net> <1366679472-7824-1-git-send-email-ben@bwidawsk.net> <1366679472-7824-3-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 mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id B3639E5ED3 for ; Tue, 23 Apr 2013 01:30:45 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1366679472-7824-3-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: Ben Widawsky Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, Apr 22, 2013 at 06:11:12PM -0700, Ben Widawsky wrote: > This patch is an enormous mess, and I'd be fine if people didn't want > it. However I have made the code do what we want at least on the two > error dumps I've tried. > > The way that it works is it attempts to identify which ACTHD belongs to > the ring, or batch, and add the appropriate offset as necessary so the > libdrm decoder can do the right thing. > > What I do is put each ACTHD in a fixed part of the array, and assume the > error dump will dump each ring in gtt ascending order (ie. RCS offset < > VCS offset < BCS offset). I know, its hacky. > > Signed-off-by: Ben Widawsky > --- > +static void emit_acthd(struct drm_intel_decode *decode_ctx, > + uint64_t gtt_offset, uint64_t size, int is_batch) > +{ > + /* XXX: This depends on always being in ascending gtt space order */ > + static int which_acthd = 0; You have ring_name available to sort on. I would prefer the use of RING_HEAD when decoding the ringbuffers, so that the current HEAD is always printed there - acting like a frame pointer in a stacktrace. Making that distinction between rings and batches should make this code simplier. -Chris -- Chris Wilson, Intel Open Source Technology Centre