[Intel-gfx] [PATCH v4 04/11] drm/i915: LVDS pixel clock check

Mika Kahola mika.kahola at intel.com
Fri Aug 14 03:03:24 PDT 2015


It is possible the we request to have a mode that has
higher pixel clock than our HW can support. This patch
checks if requested pixel clock is lower than the one
supported by the HW. The requested mode is discarded
if we cannot support the requested pixel clock.

This patch applies to LVDS.

V2:
- removed computation for max pixel clock

V3:
- cleanup by removing unnecessary lines

V4:
- moved supported dotclock check from mode_valid() to intel_lvds_init()

Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
 drivers/gpu/drm/i915/intel_lvds.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 881b5d1..06b9d1b 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1098,8 +1098,11 @@ void intel_lvds_init(struct drm_device *dev)
 			drm_mode_debug_printmodeline(scan);
 
 			fixed_mode = drm_mode_duplicate(dev, scan);
-			if (fixed_mode)
-				goto out;
+			if (fixed_mode) {
+				if (fixed_mode->clock <= dev_priv->max_dotclk_freq)
+					goto out;
+			}
+			fixed_mode = NULL;
 		}
 	}
 
@@ -1111,8 +1114,10 @@ void intel_lvds_init(struct drm_device *dev)
 		fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
 		if (fixed_mode) {
 			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
-			goto out;
+			if (fixed_mode->clock <= dev_priv->max_dotclk_freq)
+				goto out;
 		}
+		fixed_mode = NULL;
 	}
 
 	/*
@@ -1135,8 +1140,10 @@ void intel_lvds_init(struct drm_device *dev)
 			DRM_DEBUG_KMS("using current (BIOS) mode: ");
 			drm_mode_debug_printmodeline(fixed_mode);
 			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
-			goto out;
+			if (fixed_mode->clock <= dev_priv->max_dotclk_freq)
+				goto out;
 		}
+		fixed_mode = NULL;
 	}
 
 	/* If we still don't have a mode after all that, give up. */
-- 
1.9.1



More information about the Intel-gfx mailing list