From patchwork Wed Aug 29 00:35:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 10579311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E8B7174A for ; Wed, 29 Aug 2018 00:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F7572ABC4 for ; Wed, 29 Aug 2018 00:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DC8E2ADDF; Wed, 29 Aug 2018 00:36:15 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 324132ADF1 for ; Wed, 29 Aug 2018 00:36:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03AA56E45A; Wed, 29 Aug 2018 00:36:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1B746E456 for ; Wed, 29 Aug 2018 00:36:06 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2018 17:36:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,300,1531810800"; d="scan'208";a="228449851" Received: from ldmartin-desk.jf.intel.com ([10.24.10.59]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2018 17:35:37 -0700 From: Lucas De Marchi To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Aug 2018 17:35:32 -0700 Message-Id: <20180829003532.22878-6-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180829003532.22878-1-lucas.demarchi@intel.com> References: <20180829003532.22878-1-lucas.demarchi@intel.com> Subject: [Intel-gfx] [PATCH libdrm v2 5/5] intel: get gen once for gen >= 9 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paulo Zanoni , dri-devel@freedesktop.org, Rodrigo Vivi MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We don't need to call IS_GEN() for each gen >= 9: we can rather use the new intel_is_genx() helper to iterate the pciids array once. Signed-off-by: Lucas De Marchi --- intel/intel_bufmgr_gem.c | 8 +------- intel/intel_decode.c | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 8c3a4b20..d6587b76 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -3656,13 +3656,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->gen = 7; else if (IS_GEN8(bufmgr_gem->pci_device)) bufmgr_gem->gen = 8; - else if (IS_GEN9(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 9; - else if (IS_GEN10(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 10; - else if (IS_GEN11(bufmgr_gem->pci_device)) - bufmgr_gem->gen = 11; - else { + else if (!intel_get_genx(bufmgr_gem->pci_device, &bufmgr_gem->gen)) { free(bufmgr_gem); bufmgr_gem = NULL; goto exit; diff --git a/intel/intel_decode.c b/intel/intel_decode.c index b24861b1..0ff095bc 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -3823,12 +3823,8 @@ drm_intel_decode_context_alloc(uint32_t devid) ctx->devid = devid; ctx->out = stdout; - if (IS_GEN11(devid)) - ctx->gen = 11; - else if (IS_GEN10(devid)) - ctx->gen = 10; - else if (IS_GEN9(devid)) - ctx->gen = 9; + if (intel_get_genx(devid, &ctx->gen)) + ; else if (IS_GEN8(devid)) ctx->gen = 8; else if (IS_GEN7(devid))