From: Ville Syrjälä <[email protected]>

Check for the zero length front porch already in intel_mode_valid()
so that we get the same validation for both get_modes() and setcrtc()/etc.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 9ede0c5fbc44..2b76ec6ad5d2 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4208,13 +4208,6 @@ static int intel_crtc_compute_config(struct intel_crtc 
*crtc,
                }
        }
 
-       /* Cantiga+ cannot handle modes with a hsync front porch of 0.
-        * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw.
-        */
-       if ((DISPLAY_VER(dev_priv) > 4 || IS_G4X(dev_priv)) &&
-           pipe_mode->crtc_hsync_start == pipe_mode->crtc_hdisplay)
-               return -EINVAL;
-
        intel_crtc_compute_pixel_rate(pipe_config);
 
        if (pipe_config->has_pch_encoder)
@@ -11323,6 +11316,14 @@ intel_mode_valid(struct drm_device *dev,
                        return MODE_V_ILLEGAL;
        }
 
+       /*
+        * Cantiga+ cannot handle modes with a hsync front porch of 0.
+        * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw.
+        */
+       if ((DISPLAY_VER(dev_priv) > 4 || IS_G4X(dev_priv)) &&
+           mode->hsync_start == mode->hdisplay)
+               return MODE_H_ILLEGAL;
+
        return MODE_OK;
 }
 
-- 
2.32.0

Reply via email to