From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> --- 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx