All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations
@ 2015-12-21 15:31 Matt Roper
  2015-12-21 17:20 ` ✗ warning: Fi.CI.BAT Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matt Roper @ 2015-12-21 15:31 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ville Syrjälä, Kondapally, Kalyan

In commit

        commit 024c9045221fe45482863c47c4b4c47d37f97cbf
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Thu Sep 24 15:53:11 2015 -0700

            drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM (v4)

I fumbled while converting the dimensions stored in the plane_parameters
structure to the values stored in plane state and accidentally replaced
the plane dimensions with the pipe dimensions in both the DDB allocation
function and the WM calculation function.  On the DDB side this is
harmless since we effectively treat all of our non-cursor planes as
full-screen which may not be optimal, but generally won't cause any
problems either (and in 99% of the cases where there's no sprite plane
usage or primary plane windowing, there's no effect at all).  On the WM
calculation side there's more potential for this fumble to cause actual
problems since cursors also get miscalculated.

Cc: Ville Syrjälä <ville.syrjala@intel.com>
Cc: "Kondapally, Kalyan" <kalyan.kondapally@intel.com>
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 8d0d6f5..f4d4cc7 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2845,25 +2845,22 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
 			     const struct drm_plane_state *pstate,
 			     int y)
 {
-	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
+	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
 	struct drm_framebuffer *fb = pstate->fb;
+	unsigned w = drm_rect_width(&intel_pstate->dst);
+	unsigned h = drm_rect_height(&intel_pstate->dst);
 
 	/* for planar format */
 	if (fb->pixel_format == DRM_FORMAT_NV12) {
 		if (y)  /* y-plane data rate */
-			return intel_crtc->config->pipe_src_w *
-				intel_crtc->config->pipe_src_h *
-				drm_format_plane_cpp(fb->pixel_format, 0);
+			return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
 		else    /* uv-plane data rate */
-			return (intel_crtc->config->pipe_src_w/2) *
-				(intel_crtc->config->pipe_src_h/2) *
+			return (w/2) * (h/2) *
 				drm_format_plane_cpp(fb->pixel_format, 1);
 	}
 
 	/* for packed formats */
-	return intel_crtc->config->pipe_src_w *
-		intel_crtc->config->pipe_src_h *
-		drm_format_plane_cpp(fb->pixel_format, 0);
+	return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
 }
 
 /*
@@ -2960,6 +2957,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
 	 * FIXME: we may not allocate every single block here.
 	 */
 	total_data_rate = skl_get_total_relative_data_rate(cstate);
+	if (!total_data_rate)
+		return;
 
 	start = alloc->start;
 	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
@@ -3093,12 +3092,15 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 {
 	struct drm_plane *plane = &intel_plane->base;
 	struct drm_framebuffer *fb = plane->state->fb;
+	struct intel_plane_state *intel_pstate =
+		to_intel_plane_state(plane->state);
 	uint32_t latency = dev_priv->wm.skl_latency[level];
 	uint32_t method1, method2;
 	uint32_t plane_bytes_per_line, plane_blocks_per_line;
 	uint32_t res_blocks, res_lines;
 	uint32_t selected_result;
 	uint8_t bytes_per_pixel;
+	unsigned w = drm_rect_width(&intel_pstate->dst);
 
 	if (latency == 0 || !cstate->base.active || !fb)
 		return false;
@@ -3109,12 +3111,12 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 				 latency);
 	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
 				 cstate->base.adjusted_mode.crtc_htotal,
-				 cstate->pipe_src_w,
+				 w,
 				 bytes_per_pixel,
 				 fb->modifier[0],
 				 latency);
 
-	plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
+	plane_bytes_per_line = w * bytes_per_pixel;
 	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
 
 	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ warning: Fi.CI.BAT
  2015-12-21 15:31 [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
@ 2015-12-21 17:20 ` Patchwork
  2016-01-09  2:09 ` [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
  2016-01-11 19:31 ` Ville Syrjälä
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2015-12-21 17:20 UTC (permalink / raw)
  To: Matt Roper; +Cc: intel-gfx

== Summary ==

Built on 78deeec98b10627fe2050ce8ebfa2ea2d5b9e6c7 drm-intel-nightly: 2015y-12m-21d-16h-03m-57s UTC integration manifest

Test gem_mmap_gtt:
        Subgroup basic-small-bo:
                dmesg-warn -> PASS       (bdw-nuci7)
Test gem_storedw_loop:
        Subgroup basic-render:
                dmesg-warn -> PASS       (skl-i7k-2)
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                pass       -> DMESG-WARN (skl-i5k-2)
                pass       -> DMESG-WARN (hsw-xps12)
                dmesg-warn -> PASS       (hsw-brixbox)
                skip       -> PASS       (bdw-nuci7)
                pass       -> DMESG-WARN (ilk-hp8440p)
        Subgroup basic-plain-flip:
                skip       -> PASS       (bdw-nuci7)
                pass       -> DMESG-WARN (byt-nuc)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-a:
                pass       -> DMESG-WARN (snb-x220t)
                skip       -> PASS       (bdw-nuci7)
                dmesg-warn -> PASS       (byt-nuc)
        Subgroup read-crc-pipe-a-frame-sequence:
                skip       -> PASS       (bdw-nuci7)
                pass       -> DMESG-WARN (byt-nuc)
        Subgroup read-crc-pipe-b:
                dmesg-warn -> PASS       (skl-i5k-2)
                dmesg-warn -> PASS       (hsw-xps12)
                pass       -> DMESG-WARN (snb-dellxps)
                skip       -> PASS       (bdw-nuci7)
        Subgroup read-crc-pipe-b-frame-sequence:
                pass       -> DMESG-WARN (bdw-ultra)
                skip       -> PASS       (bdw-nuci7)
                pass       -> DMESG-WARN (byt-nuc)
        Subgroup read-crc-pipe-c:
                skip       -> PASS       (bdw-nuci7)
Test kms_setmode:
        Subgroup basic-clone-single-crtc:
                dmesg-warn -> PASS       (snb-dellxps)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                skip       -> PASS       (bdw-nuci7)
        Subgroup basic-rte:
                skip       -> PASS       (bdw-nuci7)
                dmesg-warn -> PASS       (bdw-ultra)

bdw-nuci7        total:132  pass:122  dwarn:1   dfail:0   fail:0   skip:9  
bdw-ultra        total:132  pass:124  dwarn:2   dfail:0   fail:0   skip:6  
byt-nuc          total:135  pass:117  dwarn:5   dfail:0   fail:0   skip:13 
hsw-brixbox      total:135  pass:127  dwarn:1   dfail:0   fail:0   skip:7  
hsw-gt2          total:135  pass:130  dwarn:1   dfail:0   fail:0   skip:4  
hsw-xps12        total:132  pass:125  dwarn:3   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:135  pass:99   dwarn:1   dfail:0   fail:0   skip:35 
ivb-t430s        total:135  pass:127  dwarn:2   dfail:0   fail:0   skip:6  
skl-i5k-2        total:135  pass:122  dwarn:5   dfail:0   fail:0   skip:8  
skl-i7k-2        total:135  pass:123  dwarn:4   dfail:0   fail:0   skip:8  
snb-dellxps      total:135  pass:121  dwarn:2   dfail:0   fail:0   skip:12 
snb-x220t        total:135  pass:121  dwarn:2   dfail:0   fail:1   skip:11 

Results at /archive/results/CI_IGT_test/Patchwork_781/

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations
  2015-12-21 15:31 [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
  2015-12-21 17:20 ` ✗ warning: Fi.CI.BAT Patchwork
@ 2016-01-09  2:09 ` Matt Roper
  2016-01-11 19:31 ` Ville Syrjälä
  2 siblings, 0 replies; 6+ messages in thread
From: Matt Roper @ 2016-01-09  2:09 UTC (permalink / raw)
  To: intel-gfx; +Cc: Kondapally, Kalyan, Ville Syrjälä

On Mon, Dec 21, 2015 at 07:31:17AM -0800, Matt Roper wrote:
> In commit
> 
>         commit 024c9045221fe45482863c47c4b4c47d37f97cbf
>         Author: Matt Roper <matthew.d.roper@intel.com>
>         Date:   Thu Sep 24 15:53:11 2015 -0700
> 
>             drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM (v4)
> 
> I fumbled while converting the dimensions stored in the plane_parameters
> structure to the values stored in plane state and accidentally replaced
> the plane dimensions with the pipe dimensions in both the DDB allocation
> function and the WM calculation function.  On the DDB side this is
> harmless since we effectively treat all of our non-cursor planes as
> full-screen which may not be optimal, but generally won't cause any
> problems either (and in 99% of the cases where there's no sprite plane
> usage or primary plane windowing, there's no effect at all).  On the WM
> calculation side there's more potential for this fumble to cause actual
> problems since cursors also get miscalculated.
> 
> Cc: Ville Syrjälä <ville.syrjala@intel.com>
> Cc: "Kondapally, Kalyan" <kalyan.kondapally@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

Bump; I think this patch got lost in the mix while most people were out
over the holiday break.


Matt

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 8d0d6f5..f4d4cc7 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -2845,25 +2845,22 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
>  			     const struct drm_plane_state *pstate,
>  			     int y)
>  {
> -	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
> +	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
>  	struct drm_framebuffer *fb = pstate->fb;
> +	unsigned w = drm_rect_width(&intel_pstate->dst);
> +	unsigned h = drm_rect_height(&intel_pstate->dst);
>  
>  	/* for planar format */
>  	if (fb->pixel_format == DRM_FORMAT_NV12) {
>  		if (y)  /* y-plane data rate */
> -			return intel_crtc->config->pipe_src_w *
> -				intel_crtc->config->pipe_src_h *
> -				drm_format_plane_cpp(fb->pixel_format, 0);
> +			return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
>  		else    /* uv-plane data rate */
> -			return (intel_crtc->config->pipe_src_w/2) *
> -				(intel_crtc->config->pipe_src_h/2) *
> +			return (w/2) * (h/2) *
>  				drm_format_plane_cpp(fb->pixel_format, 1);
>  	}
>  
>  	/* for packed formats */
> -	return intel_crtc->config->pipe_src_w *
> -		intel_crtc->config->pipe_src_h *
> -		drm_format_plane_cpp(fb->pixel_format, 0);
> +	return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
>  }
>  
>  /*
> @@ -2960,6 +2957,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
>  	 * FIXME: we may not allocate every single block here.
>  	 */
>  	total_data_rate = skl_get_total_relative_data_rate(cstate);
> +	if (!total_data_rate)
> +		return;
>  
>  	start = alloc->start;
>  	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
> @@ -3093,12 +3092,15 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  {
>  	struct drm_plane *plane = &intel_plane->base;
>  	struct drm_framebuffer *fb = plane->state->fb;
> +	struct intel_plane_state *intel_pstate =
> +		to_intel_plane_state(plane->state);
>  	uint32_t latency = dev_priv->wm.skl_latency[level];
>  	uint32_t method1, method2;
>  	uint32_t plane_bytes_per_line, plane_blocks_per_line;
>  	uint32_t res_blocks, res_lines;
>  	uint32_t selected_result;
>  	uint8_t bytes_per_pixel;
> +	unsigned w = drm_rect_width(&intel_pstate->dst);
>  
>  	if (latency == 0 || !cstate->base.active || !fb)
>  		return false;
> @@ -3109,12 +3111,12 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  				 latency);
>  	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
>  				 cstate->base.adjusted_mode.crtc_htotal,
> -				 cstate->pipe_src_w,
> +				 w,
>  				 bytes_per_pixel,
>  				 fb->modifier[0],
>  				 latency);
>  
> -	plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
> +	plane_bytes_per_line = w * bytes_per_pixel;
>  	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
>  
>  	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
> -- 
> 2.1.4
> 

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations
  2015-12-21 15:31 [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
  2015-12-21 17:20 ` ✗ warning: Fi.CI.BAT Patchwork
  2016-01-09  2:09 ` [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
@ 2016-01-11 19:31 ` Ville Syrjälä
  2016-01-11 22:13   ` Matt Roper
  2 siblings, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2016-01-11 19:31 UTC (permalink / raw)
  To: Matt Roper; +Cc: Kondapally, Kalyan, intel-gfx, Ville Syrjälä

On Mon, Dec 21, 2015 at 07:31:17AM -0800, Matt Roper wrote:
> In commit
> 
>         commit 024c9045221fe45482863c47c4b4c47d37f97cbf
>         Author: Matt Roper <matthew.d.roper@intel.com>
>         Date:   Thu Sep 24 15:53:11 2015 -0700
> 
>             drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM (v4)
> 
> I fumbled while converting the dimensions stored in the plane_parameters
> structure to the values stored in plane state and accidentally replaced
> the plane dimensions with the pipe dimensions in both the DDB allocation
> function and the WM calculation function.  On the DDB side this is
> harmless since we effectively treat all of our non-cursor planes as
> full-screen which may not be optimal, but generally won't cause any
> problems either (and in 99% of the cases where there's no sprite plane
> usage or primary plane windowing, there's no effect at all).  On the WM
> calculation side there's more potential for this fumble to cause actual
> problems since cursors also get miscalculated.
> 
> Cc: Ville Syrjälä <ville.syrjala@intel.com>
> Cc: "Kondapally, Kalyan" <kalyan.kondapally@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 8d0d6f5..f4d4cc7 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -2845,25 +2845,22 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
>  			     const struct drm_plane_state *pstate,
>  			     int y)
>  {
> -	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
> +	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
>  	struct drm_framebuffer *fb = pstate->fb;
> +	unsigned w = drm_rect_width(&intel_pstate->dst);
> +	unsigned h = drm_rect_height(&intel_pstate->dst);

I think you're supposed to use the src dimensions in most places.

>  
>  	/* for planar format */
>  	if (fb->pixel_format == DRM_FORMAT_NV12) {
>  		if (y)  /* y-plane data rate */
> -			return intel_crtc->config->pipe_src_w *
> -				intel_crtc->config->pipe_src_h *
> -				drm_format_plane_cpp(fb->pixel_format, 0);
> +			return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
>  		else    /* uv-plane data rate */
> -			return (intel_crtc->config->pipe_src_w/2) *
> -				(intel_crtc->config->pipe_src_h/2) *
> +			return (w/2) * (h/2) *
>  				drm_format_plane_cpp(fb->pixel_format, 1);
>  	}
>  
>  	/* for packed formats */
> -	return intel_crtc->config->pipe_src_w *
> -		intel_crtc->config->pipe_src_h *
> -		drm_format_plane_cpp(fb->pixel_format, 0);
> +	return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
>  }
>  
>  /*
> @@ -2960,6 +2957,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
>  	 * FIXME: we may not allocate every single block here.
>  	 */
>  	total_data_rate = skl_get_total_relative_data_rate(cstate);
> +	if (!total_data_rate)
> +		return;
>  
>  	start = alloc->start;
>  	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
> @@ -3093,12 +3092,15 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  {
>  	struct drm_plane *plane = &intel_plane->base;
>  	struct drm_framebuffer *fb = plane->state->fb;
> +	struct intel_plane_state *intel_pstate =
> +		to_intel_plane_state(plane->state);
>  	uint32_t latency = dev_priv->wm.skl_latency[level];
>  	uint32_t method1, method2;
>  	uint32_t plane_bytes_per_line, plane_blocks_per_line;
>  	uint32_t res_blocks, res_lines;
>  	uint32_t selected_result;
>  	uint8_t bytes_per_pixel;
> +	unsigned w = drm_rect_width(&intel_pstate->dst);
>  
>  	if (latency == 0 || !cstate->base.active || !fb)
>  		return false;
> @@ -3109,12 +3111,12 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  				 latency);
>  	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
>  				 cstate->base.adjusted_mode.crtc_htotal,
> -				 cstate->pipe_src_w,
> +				 w,
>  				 bytes_per_pixel,
>  				 fb->modifier[0],
>  				 latency);
>  
> -	plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
> +	plane_bytes_per_line = w * bytes_per_pixel;
>  	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
>  
>  	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
> -- 
> 2.1.4
> 
> _______________________________________________
> 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

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

* Re: [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations
  2016-01-11 19:31 ` Ville Syrjälä
@ 2016-01-11 22:13   ` Matt Roper
  2016-01-12 12:07     ` Ville Syrjälä
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Roper @ 2016-01-11 22:13 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Kondapally, Kalyan, intel-gfx, Ville Syrjälä

On Mon, Jan 11, 2016 at 09:31:03PM +0200, Ville Syrjälä wrote:
> On Mon, Dec 21, 2015 at 07:31:17AM -0800, Matt Roper wrote:
> > In commit
> > 
> >         commit 024c9045221fe45482863c47c4b4c47d37f97cbf
> >         Author: Matt Roper <matthew.d.roper@intel.com>
> >         Date:   Thu Sep 24 15:53:11 2015 -0700
> > 
> >             drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM (v4)
> > 
> > I fumbled while converting the dimensions stored in the plane_parameters
> > structure to the values stored in plane state and accidentally replaced
> > the plane dimensions with the pipe dimensions in both the DDB allocation
> > function and the WM calculation function.  On the DDB side this is
> > harmless since we effectively treat all of our non-cursor planes as
> > full-screen which may not be optimal, but generally won't cause any
> > problems either (and in 99% of the cases where there's no sprite plane
> > usage or primary plane windowing, there's no effect at all).  On the WM
> > calculation side there's more potential for this fumble to cause actual
> > problems since cursors also get miscalculated.
> > 
> > Cc: Ville Syrjälä <ville.syrjala@intel.com>
> > Cc: "Kondapally, Kalyan" <kalyan.kondapally@intel.com>
> > Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 8d0d6f5..f4d4cc7 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -2845,25 +2845,22 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
> >  			     const struct drm_plane_state *pstate,
> >  			     int y)
> >  {
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
> > +	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
> >  	struct drm_framebuffer *fb = pstate->fb;
> > +	unsigned w = drm_rect_width(&intel_pstate->dst);
> > +	unsigned h = drm_rect_height(&intel_pstate->dst);
> 
> I think you're supposed to use the src dimensions in most places.

Hmm, just went back to double check the bpsec and if I'm interpreting it
correctly, it looks like we actually need to use the larger of the two:
"Down scaling effectively increases the pixel rate. Up scaling does not
reduce the pixel rate."

Thanks for pointing that out; I'll send an updated patch.



Matt

> 
> >  
> >  	/* for planar format */
> >  	if (fb->pixel_format == DRM_FORMAT_NV12) {
> >  		if (y)  /* y-plane data rate */
> > -			return intel_crtc->config->pipe_src_w *
> > -				intel_crtc->config->pipe_src_h *
> > -				drm_format_plane_cpp(fb->pixel_format, 0);
> > +			return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
> >  		else    /* uv-plane data rate */
> > -			return (intel_crtc->config->pipe_src_w/2) *
> > -				(intel_crtc->config->pipe_src_h/2) *
> > +			return (w/2) * (h/2) *
> >  				drm_format_plane_cpp(fb->pixel_format, 1);
> >  	}
> >  
> >  	/* for packed formats */
> > -	return intel_crtc->config->pipe_src_w *
> > -		intel_crtc->config->pipe_src_h *
> > -		drm_format_plane_cpp(fb->pixel_format, 0);
> > +	return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
> >  }
> >  
> >  /*
> > @@ -2960,6 +2957,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
> >  	 * FIXME: we may not allocate every single block here.
> >  	 */
> >  	total_data_rate = skl_get_total_relative_data_rate(cstate);
> > +	if (!total_data_rate)
> > +		return;
> >  
> >  	start = alloc->start;
> >  	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
> > @@ -3093,12 +3092,15 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
> >  {
> >  	struct drm_plane *plane = &intel_plane->base;
> >  	struct drm_framebuffer *fb = plane->state->fb;
> > +	struct intel_plane_state *intel_pstate =
> > +		to_intel_plane_state(plane->state);
> >  	uint32_t latency = dev_priv->wm.skl_latency[level];
> >  	uint32_t method1, method2;
> >  	uint32_t plane_bytes_per_line, plane_blocks_per_line;
> >  	uint32_t res_blocks, res_lines;
> >  	uint32_t selected_result;
> >  	uint8_t bytes_per_pixel;
> > +	unsigned w = drm_rect_width(&intel_pstate->dst);
> >  
> >  	if (latency == 0 || !cstate->base.active || !fb)
> >  		return false;
> > @@ -3109,12 +3111,12 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
> >  				 latency);
> >  	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
> >  				 cstate->base.adjusted_mode.crtc_htotal,
> > -				 cstate->pipe_src_w,
> > +				 w,
> >  				 bytes_per_pixel,
> >  				 fb->modifier[0],
> >  				 latency);
> >  
> > -	plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
> > +	plane_bytes_per_line = w * bytes_per_pixel;
> >  	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
> >  
> >  	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations
  2016-01-11 22:13   ` Matt Roper
@ 2016-01-12 12:07     ` Ville Syrjälä
  0 siblings, 0 replies; 6+ messages in thread
From: Ville Syrjälä @ 2016-01-12 12:07 UTC (permalink / raw)
  To: Matt Roper; +Cc: Kondapally, Kalyan, intel-gfx, Ville Syrjälä

On Mon, Jan 11, 2016 at 02:13:06PM -0800, Matt Roper wrote:
> On Mon, Jan 11, 2016 at 09:31:03PM +0200, Ville Syrjälä wrote:
> > On Mon, Dec 21, 2015 at 07:31:17AM -0800, Matt Roper wrote:
> > > In commit
> > > 
> > >         commit 024c9045221fe45482863c47c4b4c47d37f97cbf
> > >         Author: Matt Roper <matthew.d.roper@intel.com>
> > >         Date:   Thu Sep 24 15:53:11 2015 -0700
> > > 
> > >             drm/i915/skl: Eliminate usage of pipe_wm_parameters from SKL-style WM (v4)
> > > 
> > > I fumbled while converting the dimensions stored in the plane_parameters
> > > structure to the values stored in plane state and accidentally replaced
> > > the plane dimensions with the pipe dimensions in both the DDB allocation
> > > function and the WM calculation function.  On the DDB side this is
> > > harmless since we effectively treat all of our non-cursor planes as
> > > full-screen which may not be optimal, but generally won't cause any
> > > problems either (and in 99% of the cases where there's no sprite plane
> > > usage or primary plane windowing, there's no effect at all).  On the WM
> > > calculation side there's more potential for this fumble to cause actual
> > > problems since cursors also get miscalculated.
> > > 
> > > Cc: Ville Syrjälä <ville.syrjala@intel.com>
> > > Cc: "Kondapally, Kalyan" <kalyan.kondapally@intel.com>
> > > Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++++-----------
> > >  1 file changed, 13 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > > index 8d0d6f5..f4d4cc7 100644
> > > --- a/drivers/gpu/drm/i915/intel_pm.c
> > > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > > @@ -2845,25 +2845,22 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
> > >  			     const struct drm_plane_state *pstate,
> > >  			     int y)
> > >  {
> > > -	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
> > > +	struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
> > >  	struct drm_framebuffer *fb = pstate->fb;
> > > +	unsigned w = drm_rect_width(&intel_pstate->dst);
> > > +	unsigned h = drm_rect_height(&intel_pstate->dst);
> > 
> > I think you're supposed to use the src dimensions in most places.
> 
> Hmm, just went back to double check the bpsec and if I'm interpreting it
> correctly, it looks like we actually need to use the larger of the two:
> "Down scaling effectively increases the pixel rate. Up scaling does not
> reduce the pixel rate."

The pixel rate is "downscale factor * pixel clock"

> 
> Thanks for pointing that out; I'll send an updated patch.
> 
> 
> 
> Matt
> 
> > 
> > >  
> > >  	/* for planar format */
> > >  	if (fb->pixel_format == DRM_FORMAT_NV12) {
> > >  		if (y)  /* y-plane data rate */
> > > -			return intel_crtc->config->pipe_src_w *
> > > -				intel_crtc->config->pipe_src_h *
> > > -				drm_format_plane_cpp(fb->pixel_format, 0);
> > > +			return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
> > >  		else    /* uv-plane data rate */
> > > -			return (intel_crtc->config->pipe_src_w/2) *
> > > -				(intel_crtc->config->pipe_src_h/2) *
> > > +			return (w/2) * (h/2) *
> > >  				drm_format_plane_cpp(fb->pixel_format, 1);
> > >  	}
> > >  
> > >  	/* for packed formats */
> > > -	return intel_crtc->config->pipe_src_w *
> > > -		intel_crtc->config->pipe_src_h *
> > > -		drm_format_plane_cpp(fb->pixel_format, 0);
> > > +	return w * h * drm_format_plane_cpp(fb->pixel_format, 0);
> > >  }
> > >  
> > >  /*
> > > @@ -2960,6 +2957,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
> > >  	 * FIXME: we may not allocate every single block here.
> > >  	 */
> > >  	total_data_rate = skl_get_total_relative_data_rate(cstate);
> > > +	if (!total_data_rate)
> > > +		return;
> > >  
> > >  	start = alloc->start;
> > >  	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
> > > @@ -3093,12 +3092,15 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
> > >  {
> > >  	struct drm_plane *plane = &intel_plane->base;
> > >  	struct drm_framebuffer *fb = plane->state->fb;
> > > +	struct intel_plane_state *intel_pstate =
> > > +		to_intel_plane_state(plane->state);
> > >  	uint32_t latency = dev_priv->wm.skl_latency[level];
> > >  	uint32_t method1, method2;
> > >  	uint32_t plane_bytes_per_line, plane_blocks_per_line;
> > >  	uint32_t res_blocks, res_lines;
> > >  	uint32_t selected_result;
> > >  	uint8_t bytes_per_pixel;
> > > +	unsigned w = drm_rect_width(&intel_pstate->dst);
> > >  
> > >  	if (latency == 0 || !cstate->base.active || !fb)
> > >  		return false;
> > > @@ -3109,12 +3111,12 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
> > >  				 latency);
> > >  	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
> > >  				 cstate->base.adjusted_mode.crtc_htotal,
> > > -				 cstate->pipe_src_w,
> > > +				 w,
> > >  				 bytes_per_pixel,
> > >  				 fb->modifier[0],
> > >  				 latency);
> > >  
> > > -	plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
> > > +	plane_bytes_per_line = w * bytes_per_pixel;
> > >  	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
> > >  
> > >  	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
> > > -- 
> > > 2.1.4
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
> > -- 
> > Ville Syrjälä
> > Intel OTC
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-01-12 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 15:31 [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
2015-12-21 17:20 ` ✗ warning: Fi.CI.BAT Patchwork
2016-01-09  2:09 ` [PATCH] drm/i915/skl: Use proper plane dimensions for DDB and WM calculations Matt Roper
2016-01-11 19:31 ` Ville Syrjälä
2016-01-11 22:13   ` Matt Roper
2016-01-12 12:07     ` Ville Syrjälä

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.