All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: use crtc_htotal in watermark calculations to match fastboot v2
@ 2013-11-27 19:10 Jesse Barnes
  2013-11-27 19:12 ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Barnes @ 2013-11-27 19:10 UTC (permalink / raw)
  To: intel-gfx

This value is more correct, and matches what we read out in the fastboot
code.  Without this, the watermark code will panic after the first mode
setting activity after a fastboot.

v2: fix up HSW ->clock usage too (Ville)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_pm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 69cad60..9180562 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1182,7 +1182,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
 
 	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
 	clock = adjusted_mode->crtc_clock;
-	htotal = adjusted_mode->htotal;
+	htotal = adjusted_mode->crtc_htotal;
 	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
 	pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -1269,7 +1269,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
 	crtc = intel_get_crtc_for_plane(dev, plane);
 	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
 	clock = adjusted_mode->crtc_clock;
-	htotal = adjusted_mode->htotal;
+	htotal = adjusted_mode->crtc_htotal;
 	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
 	pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -1500,7 +1500,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
 		const struct drm_display_mode *adjusted_mode =
 			&to_intel_crtc(crtc)->config.adjusted_mode;
 		int clock = adjusted_mode->crtc_clock;
-		int htotal = adjusted_mode->htotal;
+		int htotal = adjusted_mode->crtc_htotal;
 		int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
 		int pixel_size = crtc->fb->bits_per_pixel / 8;
 		unsigned long line_time_us;
@@ -1626,7 +1626,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
 		const struct drm_display_mode *adjusted_mode =
 			&to_intel_crtc(enabled)->config.adjusted_mode;
 		int clock = adjusted_mode->crtc_clock;
-		int htotal = adjusted_mode->htotal;
+		int htotal = adjusted_mode->crtc_htotal;
 		int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w;
 		int pixel_size = enabled->fb->bits_per_pixel / 8;
 		unsigned long line_time_us;
@@ -1778,7 +1778,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane,
 	crtc = intel_get_crtc_for_plane(dev, plane);
 	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
 	clock = adjusted_mode->crtc_clock;
-	htotal = adjusted_mode->htotal;
+	htotal = adjusted_mode->crtc_htotal;
 	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
 	pixel_size = crtc->fb->bits_per_pixel / 8;
 
@@ -2471,8 +2471,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	/* The WM are computed with base on how long it takes to fill a single
 	 * row at the given clock rate, multiplied by 8.
 	 * */
-	linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock);
-	ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
+	linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
+				     mode->crtc_clock);
+	ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
 					 intel_ddi_get_cdclk_freq(dev_priv));
 
 	return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: use crtc_htotal in watermark calculations to match fastboot v2
  2013-11-27 19:10 [PATCH] drm/i915: use crtc_htotal in watermark calculations to match fastboot v2 Jesse Barnes
@ 2013-11-27 19:12 ` Ville Syrjälä
  2013-11-27 19:36   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2013-11-27 19:12 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx

On Wed, Nov 27, 2013 at 11:10:26AM -0800, Jesse Barnes wrote:
> This value is more correct, and matches what we read out in the fastboot
> code.  Without this, the watermark code will panic after the first mode
> setting activity after a fastboot.
> 
> v2: fix up HSW ->clock usage too (Ville)
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

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

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 69cad60..9180562 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -1182,7 +1182,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
>  
>  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
>  	clock = adjusted_mode->crtc_clock;
> -	htotal = adjusted_mode->htotal;
> +	htotal = adjusted_mode->crtc_htotal;
>  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
>  	pixel_size = crtc->fb->bits_per_pixel / 8;
>  
> @@ -1269,7 +1269,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
>  	crtc = intel_get_crtc_for_plane(dev, plane);
>  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
>  	clock = adjusted_mode->crtc_clock;
> -	htotal = adjusted_mode->htotal;
> +	htotal = adjusted_mode->crtc_htotal;
>  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
>  	pixel_size = crtc->fb->bits_per_pixel / 8;
>  
> @@ -1500,7 +1500,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
>  		const struct drm_display_mode *adjusted_mode =
>  			&to_intel_crtc(crtc)->config.adjusted_mode;
>  		int clock = adjusted_mode->crtc_clock;
> -		int htotal = adjusted_mode->htotal;
> +		int htotal = adjusted_mode->crtc_htotal;
>  		int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
>  		int pixel_size = crtc->fb->bits_per_pixel / 8;
>  		unsigned long line_time_us;
> @@ -1626,7 +1626,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
>  		const struct drm_display_mode *adjusted_mode =
>  			&to_intel_crtc(enabled)->config.adjusted_mode;
>  		int clock = adjusted_mode->crtc_clock;
> -		int htotal = adjusted_mode->htotal;
> +		int htotal = adjusted_mode->crtc_htotal;
>  		int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w;
>  		int pixel_size = enabled->fb->bits_per_pixel / 8;
>  		unsigned long line_time_us;
> @@ -1778,7 +1778,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane,
>  	crtc = intel_get_crtc_for_plane(dev, plane);
>  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
>  	clock = adjusted_mode->crtc_clock;
> -	htotal = adjusted_mode->htotal;
> +	htotal = adjusted_mode->crtc_htotal;
>  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
>  	pixel_size = crtc->fb->bits_per_pixel / 8;
>  
> @@ -2471,8 +2471,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
>  	/* The WM are computed with base on how long it takes to fill a single
>  	 * row at the given clock rate, multiplied by 8.
>  	 * */
> -	linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock);
> -	ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
> +	linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
> +				     mode->crtc_clock);
> +	ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
>  					 intel_ddi_get_cdclk_freq(dev_priv));
>  
>  	return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
> -- 
> 1.8.4.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: use crtc_htotal in watermark calculations to match fastboot v2
  2013-11-27 19:12 ` Ville Syrjälä
@ 2013-11-27 19:36   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2013-11-27 19:36 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Wed, Nov 27, 2013 at 09:12:52PM +0200, Ville Syrjälä wrote:
> On Wed, Nov 27, 2013 at 11:10:26AM -0800, Jesse Barnes wrote:
> > This value is more correct, and matches what we read out in the fastboot
> > code.  Without this, the watermark code will panic after the first mode
> > setting activity after a fastboot.
> > 
> > v2: fix up HSW ->clock usage too (Ville)
> > 
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I wonder whether we should clear out the entire pipe config after checking
and replace it with the one we've read from the hw state. That would allow
us to catch such fallout with a simple dpms on/off cycle instead of just
fastboot ...

Anyway picked up for -fixes, thanks for the patch (since ugly conflict
otherwise).
-Daniel

> 
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 69cad60..9180562 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -1182,7 +1182,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
> >  
> >  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
> >  	clock = adjusted_mode->crtc_clock;
> > -	htotal = adjusted_mode->htotal;
> > +	htotal = adjusted_mode->crtc_htotal;
> >  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
> >  	pixel_size = crtc->fb->bits_per_pixel / 8;
> >  
> > @@ -1269,7 +1269,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
> >  	crtc = intel_get_crtc_for_plane(dev, plane);
> >  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
> >  	clock = adjusted_mode->crtc_clock;
> > -	htotal = adjusted_mode->htotal;
> > +	htotal = adjusted_mode->crtc_htotal;
> >  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
> >  	pixel_size = crtc->fb->bits_per_pixel / 8;
> >  
> > @@ -1500,7 +1500,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
> >  		const struct drm_display_mode *adjusted_mode =
> >  			&to_intel_crtc(crtc)->config.adjusted_mode;
> >  		int clock = adjusted_mode->crtc_clock;
> > -		int htotal = adjusted_mode->htotal;
> > +		int htotal = adjusted_mode->crtc_htotal;
> >  		int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
> >  		int pixel_size = crtc->fb->bits_per_pixel / 8;
> >  		unsigned long line_time_us;
> > @@ -1626,7 +1626,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
> >  		const struct drm_display_mode *adjusted_mode =
> >  			&to_intel_crtc(enabled)->config.adjusted_mode;
> >  		int clock = adjusted_mode->crtc_clock;
> > -		int htotal = adjusted_mode->htotal;
> > +		int htotal = adjusted_mode->crtc_htotal;
> >  		int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w;
> >  		int pixel_size = enabled->fb->bits_per_pixel / 8;
> >  		unsigned long line_time_us;
> > @@ -1778,7 +1778,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane,
> >  	crtc = intel_get_crtc_for_plane(dev, plane);
> >  	adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
> >  	clock = adjusted_mode->crtc_clock;
> > -	htotal = adjusted_mode->htotal;
> > +	htotal = adjusted_mode->crtc_htotal;
> >  	hdisplay = to_intel_crtc(crtc)->config.pipe_src_w;
> >  	pixel_size = crtc->fb->bits_per_pixel / 8;
> >  
> > @@ -2471,8 +2471,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
> >  	/* The WM are computed with base on how long it takes to fill a single
> >  	 * row at the given clock rate, multiplied by 8.
> >  	 * */
> > -	linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock);
> > -	ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
> > +	linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
> > +				     mode->crtc_clock);
> > +	ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
> >  					 intel_ddi_get_cdclk_freq(dev_priv));
> >  
> >  	return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
> > -- 
> > 1.8.4.2
> > 
> > _______________________________________________
> > 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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-27 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27 19:10 [PATCH] drm/i915: use crtc_htotal in watermark calculations to match fastboot v2 Jesse Barnes
2013-11-27 19:12 ` Ville Syrjälä
2013-11-27 19:36   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.