[Intel-gfx] [PATCH 2/9] drm/i915: Check pixel clock when setting mode for HDMI
Mika Kahola
mika.kahola at intel.com
Fri Jul 3 04:35:50 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 HDMI.
Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
drivers/gpu/drm/i915/intel_hdmi.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 00c4b40..1886cd4c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1163,14 +1163,40 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit)
return 225000;
}
+static int
+intel_hdmi_max_pixclk(struct intel_hdmi *hdmi)
+{
+ struct intel_encoder *encoder = &hdmi_to_dig_port(hdmi)->base;
+ struct drm_device *dev = intel_hdmi_to_dev(hdmi);
+ struct drm_i915_private *dev_priv = to_i915(dev);
+ struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
+
+ if (IS_CHERRYVIEW(dev))
+ return DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 95);
+ else if (IS_VALLEYVIEW(dev))
+ return DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 90);
+ else if (IS_BROADWELL(dev) && intel_crtc->config->ips_enabled)
+ return DIV_ROUND_UP(dev_priv->max_cdclk_freq * 100, 95);
+ else
+ return dev_priv->max_cdclk_freq;
+}
+
static enum drm_mode_status
intel_hdmi_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
+ struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+
int clock = mode->clock;
+ int max_pixclk = intel_hdmi_max_pixclk(intel_hdmi);
- if (mode->flags & DRM_MODE_FLAG_DBLCLK)
+ if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
clock *= 2;
+ max_pixclk *= 2;
+ }
+
+ if (clock > max_pixclk)
+ return MODE_CLOCK_HIGH;
if (clock > hdmi_portclock_limit(intel_attached_hdmi(connector),
true))
--
1.9.1
More information about the Intel-gfx
mailing list