diff mbox

drm/i915: Reject modeset if the dotclock is too high

Message ID 1464114859-15610-1-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä May 24, 2016, 6:34 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reject the modeset if the requested dotclock exceeds the maximum allowed
by the hardware. So far we've only checked this on gen2/3 while also
handling the double wide vs. single wide pipe selection. Extend the
check to all platforms since we have the max dotclock correctly
populated now across the board.

Testcase: igt/kms_invalid_dotclock
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Jani Nikula May 25, 2016, 8:15 a.m. UTC | #1
On Tue, 24 May 2016, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reject the modeset if the requested dotclock exceeds the maximum allowed
> by the hardware. So far we've only checked this on gen2/3 while also
> handling the double wide vs. single wide pipe selection. Extend the
> check to all platforms since we have the max dotclock correctly
> populated now across the board.
>
> Testcase: igt/kms_invalid_dotclock
> Cc: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Seems good. Maybe we have bugs open about this?

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 1e5138497e6a..adb489508f25 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6510,10 +6510,10 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
>  	struct drm_device *dev = crtc->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> +	int clock_limit = dev_priv->max_dotclk_freq;
>  
> -	/* FIXME should check pixel clock limits on all platforms */
>  	if (INTEL_INFO(dev)->gen < 4) {
> -		int clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
> +		clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
>  
>  		/*
>  		 * Enable double wide mode when the dot clock
> @@ -6521,16 +6521,16 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
>  		 */
>  		if (intel_crtc_supports_double_wide(crtc) &&
>  		    adjusted_mode->crtc_clock > clock_limit) {
> -			clock_limit *= 2;
> +			clock_limit = dev_priv->max_dotclk_freq;
>  			pipe_config->double_wide = true;
>  		}
> +	}
>  
> -		if (adjusted_mode->crtc_clock > clock_limit) {
> -			DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> -				      adjusted_mode->crtc_clock, clock_limit,
> -				      yesno(pipe_config->double_wide));
> -			return -EINVAL;
> -		}
> +	if (adjusted_mode->crtc_clock > clock_limit) {
> +		DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> +			      adjusted_mode->crtc_clock, clock_limit,
> +			      yesno(pipe_config->double_wide));
> +		return -EINVAL;
>  	}
>  
>  	/*
Ville Syrjälä May 27, 2016, 11:53 a.m. UTC | #2
On Wed, May 25, 2016 at 05:22:21AM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Reject modeset if the dotclock is too high
> URL   : https://patchwork.freedesktop.org/series/7653/
> State : warning
> 
> == Summary ==
> 
> Series 7653v1 drm/i915: Reject modeset if the dotclock is too high
> http://patchwork.freedesktop.org/api/1.0/series/7653/revisions/1/mbox
> 
> Test drv_module_reload_basic:
>                 skip       -> PASS       (ro-ivb-i7-3770)
>                 pass       -> DMESG-WARN (ro-skl-i7-6700hq)

[  143.693314] [drm:intel_pipe_update_start [i915]] *ERROR* Potential atomic update failure on pipe A

https://bugs.freedesktop.org/show_bug.cgi?id=95632

> Test gem_exec_flush:
>         Subgroup basic-batch-kernel-default-cmd:
>                 fail       -> PASS       (fi-byt-n2820)
> Test kms_flip:
>         Subgroup basic-flip-vs-wf_vblank:
>                 pass       -> SKIP       (fi-skl-i5-6260u)

(kms_flip:9621) igt-kms-WARNING: connector 37 has no modes
(kms_flip:9621) igt-kms-WARNING: connector 37 has no modes
(kms_flip:9621) igt-kms-WARNING: connector 37 has no modes

[  426.641160] [drm:intel_get_hpd_pins] hotplug event received, stat 0x00200000, dig 0x10101012, pins 0x00000020
[  426.641169] [drm:intel_hpd_irq_storm_detect] Received HPD interrupt on PIN 5 - cnt: 0
[  426.641243] [drm:i915_hotplug_work_func] running encoder hotplug functions
[  426.641259] [drm:i915_hotplug_work_func] Connector HDMI-A-1 (pin 5) received hotplug event.
[  426.641268] [drm:intel_hdmi_detect] [CONNECTOR:37:HDMI-A-1]
[  426.730833] [drm:intel_hdmi_detect] HDMI live status down
[  426.730845] [drm:intel_hpd_irq_event] [CONNECTOR:37:HDMI-A-1] status updated from connected to disconnected
[  426.730935] [drm:drm_fb_helper_hotplug_event] 
[  426.730938] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:37:HDMI-A-1]
[  426.730941] [drm:intel_hdmi_detect] [CONNECTOR:37:HDMI-A-1]
[  426.746265] kms_flip: executing
[  426.746392] [drm:i915_gem_open] 
[  426.746583] [drm:i915_gem_open] 
[  426.746747] [drm:i915_gem_open] 
[  426.818966] [drm:intel_hdmi_detect] HDMI live status down
[  426.818976] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:37:HDMI-A-1] disconnected
...
[  426.942081] [drm:i915_hotplug_work_func] Connector HDMI-A-1 (pin 5) received hotplug event.
[  426.942088] [drm:intel_hdmi_detect] [CONNECTOR:37:HDMI-A-1]
[  426.942099] [drm:intel_power_well_enable] enabling always-on
[  426.971071] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK for addr: 0040 w(1)
[  426.971076] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK on first message, retry
[  426.971702] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK for addr: 0040 w(1)
[  426.971712] [drm:drm_detect_monitor_audio] Monitor has basic audio support
[  426.971716] [drm:intel_power_well_disable] disabling always-on
[  426.971720] [drm:intel_hpd_irq_event] [CONNECTOR:37:HDMI-A-1] status updated from disconnected to connected
[  426.972567] kms_flip: starting subtest basic-flip-vs-wf_vblank
[  426.980243] kms_flip: exiting, ret=77
[  426.991305] [drm:drm_fb_helper_hotplug_event] 
[  426.991309] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:37:HDMI-A-1]
[  426.991312] [drm:intel_hdmi_detect] [CONNECTOR:37:HDMI-A-1]
[  426.991315] [drm:intel_power_well_enable] enabling always-on
[  427.020106] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK for addr: 0040 w(1)
[  427.020108] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK on first message, retry
[  427.020731] [drm:do_gmbus_xfer] GMBUS [i915 gmbus dpb] NAK for addr: 0040 w(1)
[  427.020736] [drm:drm_detect_monitor_audio] Monitor has basic audio support
[  427.020737] [drm:intel_power_well_disable] disabling always-on
[  427.021039] [drm:drm_edid_to_eld] ELD monitor G246HYL
[  427.021042] [drm:parse_hdmi_vsdb] HDMI: DVI dual 0, max TMDS clock 0, latency present 0 0, video latency 0 0, audio latency 0 0
[  427.021043] [drm:drm_edid_to_eld] ELD size 32, SAD count 1
[  427.021100] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:37:HDMI-A-1] probed modes :
[  427.021103] [drm:drm_mode_debug_printmodeline] Modeline 48:"1920x1080" 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x48 0x5
[  427.021105] [drm:drm_mode_debug_printmodeline] Modeline 73:"1920x1080" 60 148352 1920 2008 2052 2200 1080 1084 1089 1125 0x40 0x5

So looks like some kind of spurious hpd issue once again.

> Test kms_setmode:
>         Subgroup basic-clone-single-crtc:
>                 dmesg-warn -> PASS       (ro-skl-i7-6700hq)
> 
> fi-bdw-i7-5557u  total:209  pass:197  dwarn:0   dfail:0   fail:0   skip:12 
> fi-byt-n2820     total:209  pass:169  dwarn:0   dfail:0   fail:2   skip:38 
> fi-hsw-i7-4770r  total:209  pass:186  dwarn:0   dfail:0   fail:0   skip:23 
> fi-skl-i5-6260u  total:209  pass:197  dwarn:0   dfail:0   fail:0   skip:12 
> fi-skl-i7-6700k  total:209  pass:184  dwarn:0   dfail:0   fail:0   skip:25 
> fi-snb-i7-2600   total:209  pass:170  dwarn:0   dfail:0   fail:0   skip:39 
> ro-bdw-i5-5250u  total:209  pass:172  dwarn:0   dfail:0   fail:0   skip:37 
> ro-bdw-i7-5557U  total:209  pass:197  dwarn:0   dfail:0   fail:0   skip:12 
> ro-bdw-i7-5600u  total:209  pass:180  dwarn:0   dfail:0   fail:1   skip:28 
> ro-bsw-n3050     total:209  pass:167  dwarn:0   dfail:0   fail:2   skip:40 
> ro-byt-n2820     total:209  pass:169  dwarn:0   dfail:0   fail:3   skip:37 
> ro-hsw-i3-4010u  total:209  pass:186  dwarn:0   dfail:0   fail:0   skip:23 
> ro-hsw-i7-4770r  total:209  pass:186  dwarn:0   dfail:0   fail:0   skip:23 
> ro-ilk-i7-620lm  total:209  pass:146  dwarn:0   dfail:0   fail:1   skip:62 
> ro-ilk1-i5-650   total:204  pass:146  dwarn:0   dfail:0   fail:1   skip:57 
> ro-ivb-i7-3770   total:209  pass:177  dwarn:0   dfail:0   fail:0   skip:32 
> ro-ivb2-i7-3770  total:209  pass:181  dwarn:0   dfail:0   fail:0   skip:28 
> ro-skl-i7-6700hq total:204  pass:181  dwarn:2   dfail:0   fail:0   skip:21 
> ro-snb-i7-2620M  total:209  pass:170  dwarn:0   dfail:0   fail:1   skip:38 
> fi-bsw-n3050 failed to connect after reboot
> fi-hsw-i7-4770k failed to connect after reboot
> 
> Results at /archive/results/CI_IGT_test/RO_Patchwork_998/
> 
> 3a7ef25 drm-intel-nightly: 2016y-05m-24d-12h-43m-51s UTC integration manifest
> c2f3c3d drm/i915: Reject modeset if the dotclock is too high
Ville Syrjälä May 27, 2016, 11:54 a.m. UTC | #3
On Wed, May 25, 2016 at 11:15:35AM +0300, Jani Nikula wrote:
> On Tue, 24 May 2016, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Reject the modeset if the requested dotclock exceeds the maximum allowed
> > by the hardware. So far we've only checked this on gen2/3 while also
> > handling the double wide vs. single wide pipe selection. Extend the
> > check to all platforms since we have the max dotclock correctly
> > populated now across the board.
> >
> > Testcase: igt/kms_invalid_dotclock
> > Cc: Mika Kahola <mika.kahola@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Seems good. Maybe we have bugs open about this?

I hope all of those got sorted by the SKL cdclk programming patches. But
I should go through the list anyways...

> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 1e5138497e6a..adb489508f25 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -6510,10 +6510,10 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
> >  	struct drm_device *dev = crtc->base.dev;
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> > +	int clock_limit = dev_priv->max_dotclk_freq;
> >  
> > -	/* FIXME should check pixel clock limits on all platforms */
> >  	if (INTEL_INFO(dev)->gen < 4) {
> > -		int clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
> > +		clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
> >  
> >  		/*
> >  		 * Enable double wide mode when the dot clock
> > @@ -6521,16 +6521,16 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
> >  		 */
> >  		if (intel_crtc_supports_double_wide(crtc) &&
> >  		    adjusted_mode->crtc_clock > clock_limit) {
> > -			clock_limit *= 2;
> > +			clock_limit = dev_priv->max_dotclk_freq;
> >  			pipe_config->double_wide = true;
> >  		}
> > +	}
> >  
> > -		if (adjusted_mode->crtc_clock > clock_limit) {
> > -			DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> > -				      adjusted_mode->crtc_clock, clock_limit,
> > -				      yesno(pipe_config->double_wide));
> > -			return -EINVAL;
> > -		}
> > +	if (adjusted_mode->crtc_clock > clock_limit) {
> > +		DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> > +			      adjusted_mode->crtc_clock, clock_limit,
> > +			      yesno(pipe_config->double_wide));
> > +		return -EINVAL;
> >  	}
> >  
> >  	/*
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
Ville Syrjälä May 27, 2016, 12:35 p.m. UTC | #4
On Wed, May 25, 2016 at 11:15:35AM +0300, Jani Nikula wrote:
> On Tue, 24 May 2016, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Reject the modeset if the requested dotclock exceeds the maximum allowed
> > by the hardware. So far we've only checked this on gen2/3 while also
> > handling the double wide vs. single wide pipe selection. Extend the
> > check to all platforms since we have the max dotclock correctly
> > populated now across the board.
> >
> > Testcase: igt/kms_invalid_dotclock
> > Cc: Mika Kahola <mika.kahola@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Seems good. Maybe we have bugs open about this?
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Pushed to dinq. Thanks for the review.

> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 1e5138497e6a..adb489508f25 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -6510,10 +6510,10 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
> >  	struct drm_device *dev = crtc->base.dev;
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> > +	int clock_limit = dev_priv->max_dotclk_freq;
> >  
> > -	/* FIXME should check pixel clock limits on all platforms */
> >  	if (INTEL_INFO(dev)->gen < 4) {
> > -		int clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
> > +		clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
> >  
> >  		/*
> >  		 * Enable double wide mode when the dot clock
> > @@ -6521,16 +6521,16 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
> >  		 */
> >  		if (intel_crtc_supports_double_wide(crtc) &&
> >  		    adjusted_mode->crtc_clock > clock_limit) {
> > -			clock_limit *= 2;
> > +			clock_limit = dev_priv->max_dotclk_freq;
> >  			pipe_config->double_wide = true;
> >  		}
> > +	}
> >  
> > -		if (adjusted_mode->crtc_clock > clock_limit) {
> > -			DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> > -				      adjusted_mode->crtc_clock, clock_limit,
> > -				      yesno(pipe_config->double_wide));
> > -			return -EINVAL;
> > -		}
> > +	if (adjusted_mode->crtc_clock > clock_limit) {
> > +		DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
> > +			      adjusted_mode->crtc_clock, clock_limit,
> > +			      yesno(pipe_config->double_wide));
> > +		return -EINVAL;
> >  	}
> >  
> >  	/*
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1e5138497e6a..adb489508f25 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6510,10 +6510,10 @@  static int intel_crtc_compute_config(struct intel_crtc *crtc,
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
+	int clock_limit = dev_priv->max_dotclk_freq;
 
-	/* FIXME should check pixel clock limits on all platforms */
 	if (INTEL_INFO(dev)->gen < 4) {
-		int clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
+		clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
 
 		/*
 		 * Enable double wide mode when the dot clock
@@ -6521,16 +6521,16 @@  static int intel_crtc_compute_config(struct intel_crtc *crtc,
 		 */
 		if (intel_crtc_supports_double_wide(crtc) &&
 		    adjusted_mode->crtc_clock > clock_limit) {
-			clock_limit *= 2;
+			clock_limit = dev_priv->max_dotclk_freq;
 			pipe_config->double_wide = true;
 		}
+	}
 
-		if (adjusted_mode->crtc_clock > clock_limit) {
-			DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
-				      adjusted_mode->crtc_clock, clock_limit,
-				      yesno(pipe_config->double_wide));
-			return -EINVAL;
-		}
+	if (adjusted_mode->crtc_clock > clock_limit) {
+		DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
+			      adjusted_mode->crtc_clock, clock_limit,
+			      yesno(pipe_config->double_wide));
+		return -EINVAL;
 	}
 
 	/*