From patchwork Thu Mar 5 16:20:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 5947511 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3FB739F373 for ; Thu, 5 Mar 2015 16:20:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54EB12038F for ; Thu, 5 Mar 2015 16:20:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6BC59202E9 for ; Thu, 5 Mar 2015 16:20:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E03A96E80A; Thu, 5 Mar 2015 08:20:32 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D95B86E7FA; Thu, 5 Mar 2015 08:20:30 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 05 Mar 2015 08:20:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,347,1422950400"; d="scan'208";a="462980843" 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:09 -0800 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Subject: [PATCH 08/12] intel: Remove direct usage of IS_915() Date: Thu, 5 Mar 2015 16:20:16 +0000 Message-Id: <1425572420-10067-9-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> MIME-Version: 1.0 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 One more step towards getting rid of intel_chipset.h. The slightly tricky bit here is that I don't want to leave defines like IS_CHIP() or IS_GEN4() is a file that can potentially become a public header. intel_device_priv.h was introduced then. Signed-off-by: Damien Lespiau --- intel/Makefile.sources | 1 + intel/intel_bufmgr_gem.c | 6 +++--- intel/intel_device_priv.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 intel/intel_device_priv.h diff --git a/intel/Makefile.sources b/intel/Makefile.sources index 0077a17..2f8398b 100644 --- a/intel/Makefile.sources +++ b/intel/Makefile.sources @@ -7,6 +7,7 @@ LIBDRM_INTEL_FILES := \ intel_decode.c \ intel_device.c \ intel_device.h \ + intel_device_priv.h \ intel_chipset.h \ mm.c \ mm.h diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 8570a30..58543a2 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -60,7 +60,7 @@ #include "libdrm_lists.h" #include "intel_bufmgr.h" #include "intel_bufmgr_priv.h" -#include "intel_device.h" +#include "intel_device_priv.h" #include "intel_chipset.h" #include "intel_aub.h" #include "string.h" @@ -338,7 +338,7 @@ drm_intel_gem_bo_tile_pitch(drm_intel_bufmgr_gem *bufmgr_gem, return ALIGN(pitch, 64); if (*tiling_mode == I915_TILING_X - || (IS_915(bufmgr_gem->pci_device) + || (IS_CHIP(bufmgr_gem->dev, I915) && *tiling_mode == I915_TILING_Y)) tile_width = 512; else @@ -843,7 +843,7 @@ drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name, if ((bufmgr_gem->gen == 2) && tiling != I915_TILING_NONE) height_alignment = 16; else if (tiling == I915_TILING_X - || (IS_915(bufmgr_gem->pci_device) + || (IS_CHIP(bufmgr_gem->dev, I915) && tiling == I915_TILING_Y)) height_alignment = 8; else if (tiling == I915_TILING_Y) diff --git a/intel/intel_device_priv.h b/intel/intel_device_priv.h new file mode 100644 index 0000000..87dc1dc --- /dev/null +++ b/intel/intel_device_priv.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2015 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef __INTEL_DEVICE_PRIV_H__ +#define __INTEL_DEVICE_PRIV_H__ + +#include "intel_device.h" + +/* + * Shorthand defines. These are not namespaced and shouldn't be in a public + * header, hence a _priv.h one for internal use. + */ +#define IS_CHIP(dev, id) ((dev)->chip == DRM_INTEL_CHIP_ ## id) + +#endif /* __INTEL_DEVICE_PRIV_H__ */