drm/i915: replace IS_GEN<N> with IS_GEN(..., N)
Define IS_GEN() similarly to our IS_GEN_RANGE(). but use gen instead of gen_mask to do the comparison. Now callers can pass then gen as a parameter, so we don't require one macro for each gen. The following spatch was used to convert the users of these macros: @@ expression e; @@ ( - IS_GEN2(e) + IS_GEN(e, 2) | - IS_GEN3(e) + IS_GEN(e, 3) | - IS_GEN4(e) + IS_GEN(e, 4) | - IS_GEN5(e) + IS_GEN(e, 5) | - IS_GEN6(e) + IS_GEN(e, 6) | - IS_GEN7(e) + IS_GEN(e, 7) | - IS_GEN8(e) + IS_GEN(e, 8) | - IS_GEN9(e) + IS_GEN(e, 9) | - IS_GEN10(e) + IS_GEN(e, 10) | - IS_GEN11(e) + IS_GEN(e, 11) ) v2: use IS_GEN rather than GT_GEN and compare to info.gen rather than using the bitmask Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181212181044.15886-2-lucas.demarchi@intel.com
This commit is contained in:

committed by
Rodrigo Vivi

parent
0069000877
commit
cf819eff90
@@ -950,7 +950,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
|
||||
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
|
||||
vtotal /= 2;
|
||||
|
||||
if (IS_GEN2(dev_priv))
|
||||
if (IS_GEN(dev_priv, 2))
|
||||
position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN2;
|
||||
else
|
||||
position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
|
||||
@@ -1030,7 +1030,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
|
||||
if (stime)
|
||||
*stime = ktime_get();
|
||||
|
||||
if (IS_GEN2(dev_priv) || IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
if (IS_GEN(dev_priv, 2) || IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
/* No obvious pixelcount register. Only query vertical
|
||||
* scanout position from Display scan line register.
|
||||
*/
|
||||
@@ -1090,7 +1090,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
|
||||
else
|
||||
position += vtotal - vbl_end;
|
||||
|
||||
if (IS_GEN2(dev_priv) || IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
if (IS_GEN(dev_priv, 2) || IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
*vpos = position;
|
||||
*hpos = 0;
|
||||
} else {
|
||||
@@ -2547,7 +2547,7 @@ static void ilk_display_irq_handler(struct drm_i915_private *dev_priv,
|
||||
I915_WRITE(SDEIIR, pch_iir);
|
||||
}
|
||||
|
||||
if (IS_GEN5(dev_priv) && de_iir & DE_PCU_EVENT)
|
||||
if (IS_GEN(dev_priv, 5) && de_iir & DE_PCU_EVENT)
|
||||
ironlake_rps_change_irq_handler(dev_priv);
|
||||
}
|
||||
|
||||
@@ -3243,7 +3243,7 @@ void i915_clear_error_registers(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
u32 eir;
|
||||
|
||||
if (!IS_GEN2(dev_priv))
|
||||
if (!IS_GEN(dev_priv, 2))
|
||||
I915_WRITE(PGTBL_ER, I915_READ(PGTBL_ER));
|
||||
|
||||
if (INTEL_GEN(dev_priv) < 4)
|
||||
@@ -3586,11 +3586,11 @@ static void ironlake_irq_reset(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
if (IS_GEN5(dev_priv))
|
||||
if (IS_GEN(dev_priv, 5))
|
||||
I915_WRITE(HWSTAM, 0xffffffff);
|
||||
|
||||
GEN3_IRQ_RESET(DE);
|
||||
if (IS_GEN7(dev_priv))
|
||||
if (IS_GEN(dev_priv, 7))
|
||||
I915_WRITE(GEN7_ERR_INT, 0xffffffff);
|
||||
|
||||
if (IS_HASWELL(dev_priv)) {
|
||||
@@ -4045,7 +4045,7 @@ static void gen5_gt_irq_postinstall(struct drm_device *dev)
|
||||
}
|
||||
|
||||
gt_irqs |= GT_RENDER_USER_INTERRUPT;
|
||||
if (IS_GEN5(dev_priv)) {
|
||||
if (IS_GEN(dev_priv, 5)) {
|
||||
gt_irqs |= ILK_BSD_USER_INTERRUPT;
|
||||
} else {
|
||||
gt_irqs |= GT_BLT_USER_INTERRUPT | GT_BSD_USER_INTERRUPT;
|
||||
@@ -4836,7 +4836,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
|
||||
if (INTEL_GEN(dev_priv) >= 8)
|
||||
rps->pm_intrmsk_mbz |= GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC;
|
||||
|
||||
if (IS_GEN2(dev_priv)) {
|
||||
if (IS_GEN(dev_priv, 2)) {
|
||||
/* Gen2 doesn't have a hardware frame counter */
|
||||
dev->max_vblank_count = 0;
|
||||
} else if (IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5) {
|
||||
@@ -4852,7 +4852,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
|
||||
* Gen2 doesn't have a hardware frame counter and so depends on
|
||||
* vblank interrupts to produce sane vblank seuquence numbers.
|
||||
*/
|
||||
if (!IS_GEN2(dev_priv))
|
||||
if (!IS_GEN(dev_priv, 2))
|
||||
dev->vblank_disable_immediate = true;
|
||||
|
||||
/* Most platforms treat the display irq block as an always-on
|
||||
@@ -4924,14 +4924,14 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
|
||||
dev->driver->disable_vblank = ironlake_disable_vblank;
|
||||
dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
|
||||
} else {
|
||||
if (IS_GEN2(dev_priv)) {
|
||||
if (IS_GEN(dev_priv, 2)) {
|
||||
dev->driver->irq_preinstall = i8xx_irq_reset;
|
||||
dev->driver->irq_postinstall = i8xx_irq_postinstall;
|
||||
dev->driver->irq_handler = i8xx_irq_handler;
|
||||
dev->driver->irq_uninstall = i8xx_irq_reset;
|
||||
dev->driver->enable_vblank = i8xx_enable_vblank;
|
||||
dev->driver->disable_vblank = i8xx_disable_vblank;
|
||||
} else if (IS_GEN3(dev_priv)) {
|
||||
} else if (IS_GEN(dev_priv, 3)) {
|
||||
dev->driver->irq_preinstall = i915_irq_reset;
|
||||
dev->driver->irq_postinstall = i915_irq_postinstall;
|
||||
dev->driver->irq_uninstall = i915_irq_reset;
|
||||
|
Reference in New Issue
Block a user