From patchwork Wed Dec 6 23:11:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott D Phillips X-Patchwork-Id: 10097395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCEB36056E for ; Wed, 6 Dec 2017 23:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFD6729ECE for ; Wed, 6 Dec 2017 23:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4BDF29ED3; Wed, 6 Dec 2017 23:12:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7578D29ECE for ; Wed, 6 Dec 2017 23:12:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 851A66E746; Wed, 6 Dec 2017 23:12:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 323FF89C6A for ; Wed, 6 Dec 2017 23:12:44 +0000 (UTC) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 15:12:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,369,1508828400"; d="scan'208";a="697969" Received: from dsp-dsk1.jf.intel.com ([10.7.199.59]) by orsmga008.jf.intel.com with ESMTP; 06 Dec 2017 15:12:42 -0800 From: Scott D Phillips To: intel-gfx@lists.freedesktop.org Date: Wed, 6 Dec 2017 15:11:21 -0800 Message-Id: <20171206231123.22380-2-scott.d.phillips@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171206231123.22380-1-scott.d.phillips@intel.com> References: <20171206231123.22380-1-scott.d.phillips@intel.com> Cc: Benjamin Widawsky Subject: [Intel-gfx] [PATCH i-g-t 2/4] tools/intel_aubdump: Set addr_bits before write_header X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP write_header() uses addr_bits, so do the initialization earlier. Also set the gen to a non-zero value in case of unknown device, for use by a later patch. Signed-off-by: Scott D Phillips Reviewed-by: Jordan Justen --- tools/aubdump.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/aubdump.c b/tools/aubdump.c index 6ba3cb66..5def6947 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -417,6 +417,15 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) } if (gen == 0) { gen = intel_gen(device); + + /* If we don't know the device gen, then it probably is a + * newer device. Set gen to some arbitrarily high number. + */ + if (gen == 0) + gen = 9999; + + addr_bits = gen >= 8 ? 48 : 32; + write_header(); if (verbose) @@ -425,11 +434,6 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) filename, device, gen); } - /* If we don't know the device gen, then it probably is a - * newer device which uses 48-bit addresses. - */ - addr_bits = (gen >= 8 || gen == 0) ? 48 : 32; - if (verbose) printf("Dumping execbuffer2:\n");