[Intel-gfx] [RFC 18/28] drm/i915: Use Gen Kconfig items in IS_GEN macro

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 14 11:50:18 UTC 2021


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4f140e95207e..0e65e0bc3d09 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2557,13 +2557,42 @@ intel_info(const struct drm_i915_private *dev_priv)
 		(s) != GEN_FOREVER ? (s) - 1 : 0) \
 )
 
+#define __gen_test_mask(s, e) \
+({ \
+	u16 m__ = (u16)INTEL_GEN_MASK((s), (e)); \
+\
+	m__ &= ~BIT(0); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN2)) \
+		m__ &= ~BIT(1); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN3)) \
+		m__ &= ~BIT(2); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN4)) \
+		m__ &= ~BIT(3); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN5)) \
+		m__ &= ~BIT(4); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN6)) \
+		m__ &= ~BIT(5); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN7)) \
+		m__ &= ~BIT(6); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN8)) \
+		m__ &= ~BIT(7); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN9)) \
+		m__ &= ~BIT(8); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN10)) \
+		m__ &= ~BIT(9); \
+	if (!IS_ENABLED(CONFIG_DRM_I915_GEN11)) \
+		m__ &= ~BIT(10); \
+\
+	m__; \
+})
+
 /*
  * Returns true if Gen is in inclusive range [Start, End].
  *
  * Use GEN_FOREVER for unbound start and or end.
  */
 #define IS_GEN(dev_priv, s, e) \
-	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
+	(!!(__gen_test_mask((s), (e)) & (dev_priv)->info.gen_mask))
 
 /*
  * Return true if revision is in range [since,until] inclusive.
-- 
2.27.0



More information about the Intel-gfx mailing list