[PATCH 08/12] intel: Remove direct usage of IS_915()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <damien.lespiau@xxxxxxxxx>
---
 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__ */
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux