diff mbox

[v3,08/11] drm/i915: TV pixel clock check

Message ID 1438344840-3490-9-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola July 31, 2015, 12:13 p.m. UTC
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 TV.

V2:
- removed computation for max pixel clock

V3:
- cleanup by removing unnecessary lines

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

Comments

Ville Syrjälä Aug. 12, 2015, 6:24 p.m. UTC | #1
On Fri, Jul 31, 2015 at 03:13:57PM +0300, Mika Kahola wrote:
> 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 TV.
> 
> V2:
> - removed computation for max pixel clock
> 
> V3:
> - cleanup by removing unnecessary lines
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_tv.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 8b9d325..beeed25 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -897,6 +897,10 @@ intel_tv_mode_valid(struct drm_connector *connector,
>  {
>  	struct intel_tv *intel_tv = intel_attached_tv(connector);
>  	const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
> +	int max_pixclk = to_i915(connector->dev)->max_dotclk;
> +
> +	if (mode->clock > max_pixclk)
> +		return MODE_CLOCK_HIGH;

The mode handling in intel_tv.c seems to be a mess. But I suppose this
should be OK.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  
>  	/* Ensure TV refresh is close to desired refresh */
>  	if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Aug. 14, 2015, 8:33 a.m. UTC | #2
On Wed, Aug 12, 2015 at 09:24:01PM +0300, Ville Syrjälä wrote:
> On Fri, Jul 31, 2015 at 03:13:57PM +0300, Mika Kahola wrote:
> > 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 TV.
> > 
> > V2:
> > - removed computation for max pixel clock
> > 
> > V3:
> > - cleanup by removing unnecessary lines
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_tv.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> > index 8b9d325..beeed25 100644
> > --- a/drivers/gpu/drm/i915/intel_tv.c
> > +++ b/drivers/gpu/drm/i915/intel_tv.c
> > @@ -897,6 +897,10 @@ intel_tv_mode_valid(struct drm_connector *connector,
> >  {
> >  	struct intel_tv *intel_tv = intel_attached_tv(connector);
> >  	const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
> > +	int max_pixclk = to_i915(connector->dev)->max_dotclk;
> > +
> > +	if (mode->clock > max_pixclk)
> > +		return MODE_CLOCK_HIGH;
> 
> The mode handling in intel_tv.c seems to be a mess. But I suppose this
> should be OK.

We set a fake mode (which is the one userspace asks for) and the hw
internally munges it to the actual tv mode with a scaler. Except that the
frame-start/dotclock are fed from the actual TV mode (which is why
kms_flip has a check for TV modes since the timings are all wrong).

Yup, giant hairball indeed ;-)
-Daniel

> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> >  
> >  	/* Ensure TV refresh is close to desired refresh */
> >  	if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 8b9d325..beeed25 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -897,6 +897,10 @@  intel_tv_mode_valid(struct drm_connector *connector,
 {
 	struct intel_tv *intel_tv = intel_attached_tv(connector);
 	const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv);
+	int max_pixclk = to_i915(connector->dev)->max_dotclk;
+
+	if (mode->clock > max_pixclk)
+		return MODE_CLOCK_HIGH;
 
 	/* Ensure TV refresh is close to desired refresh */
 	if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)