From patchwork Thu Mar 5 16:20:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 5947501 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B42D4BF440 for ; Thu, 5 Mar 2015 16:20:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDD7D202BE for ; Thu, 5 Mar 2015 16:20:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4D4EE2038D for ; Thu, 5 Mar 2015 16:20:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB18A6E7F7; Thu, 5 Mar 2015 08:20:28 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 00EE36E7F3; Thu, 5 Mar 2015 08:20:26 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 05 Mar 2015 08:20:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,347,1422950400"; d="scan'208";a="462980651" Received: from rmoore5-mobl1.amr.corp.intel.com (HELO strange.ger.corp.intel.com) ([10.252.11.84]) by FMSMGA003.fm.intel.com with ESMTP; 05 Mar 2015 08:14:05 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Thu, 5 Mar 2015 16:20:12 +0000 Message-Id: <1425572420-10067-5-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1425572420-10067-1-git-send-email-damien.lespiau@intel.com> References: <1425572420-10067-1-git-send-email-damien.lespiau@intel.com> Cc: dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 04/12] intel: Make drm_intel_decode use a drm_intel_device 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Damien Lespiau --- intel/intel_decode.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 7d5cbe5..9ada2fa 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -35,6 +35,7 @@ #include "libdrm.h" #include "xf86drm.h" +#include "intel_device.h" #include "intel_chipset.h" #include "intel_bufmgr.h" @@ -43,6 +44,9 @@ struct drm_intel_decode { /** stdio file where the output should land. Defaults to stdout. */ FILE *out; + /** Description of the GPU */ + struct drm_intel_device *dev; + /** PCI device ID. */ uint32_t devid; @@ -3826,27 +3830,15 @@ drm_intel_decode_context_alloc(uint32_t devid) if (!ctx) return NULL; + ctx->dev = drm_intel_device_new_from_devid(devid); + if (!ctx->dev) { + free(ctx); + return NULL; + } + ctx->devid = devid; ctx->out = stdout; - - if (IS_GEN9(devid)) - ctx->gen = 9; - else if (IS_GEN8(devid)) - ctx->gen = 8; - else if (IS_GEN7(devid)) - ctx->gen = 7; - else if (IS_GEN6(devid)) - ctx->gen = 6; - else if (IS_GEN5(devid)) - ctx->gen = 5; - else if (IS_GEN4(devid)) - ctx->gen = 4; - else if (IS_9XX(devid)) - ctx->gen = 3; - else { - assert(IS_GEN2(devid)); - ctx->gen = 2; - } + ctx->gen = ctx->dev->gen; return ctx; } @@ -3854,6 +3846,7 @@ drm_intel_decode_context_alloc(uint32_t devid) drm_public void drm_intel_decode_context_free(struct drm_intel_decode *ctx) { + drm_intel_device_free(ctx->dev); free(ctx); }