public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/16] drm/i915/skl+: Use plane size for relative data rate calculation
Date: Wed, 06 Apr 2016 18:09:00 +0300	[thread overview]
Message-ID: <1459955340.28930.29.camel@intel.com> (raw)
In-Reply-To: <1459475198-30094-5-git-send-email-matthew.d.roper@intel.com>

On to, 2016-03-31 at 18:46 -0700, Matt Roper wrote:
> From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>
> 
> Use plane size for relative data rate calculation. don't always use
> pipe source width & height.
> adjust height & width according to rotation.
> use plane size for watermark calculations also.
> 
> v2: Address Matt's comments.
>     Use intel_plane_state->visible to avoid divide-by-zero error.
>     Where FB was present but not visible so causing total data rate
> to
>     be zero, hence divide-by-zero.
> 
> Cc: matthew.d.roper@intel.com
> Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=93917
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=94044

This patch fixed a screen corruption problem for me with an eDP + DP
config. It somehow made worse by moving the cursor around and I can get
rid of it by switching of the cursor plane.

Matt any chance of getting this merged separately from the rest?

--Imre

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 41 ++++++++++++++++++++++++++++---
> ----------
>  1 file changed, 28 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c
> index c970c4e..1c3f772 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -2937,24 +2937,28 @@ 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;
> +	uint32_t width = 0, height = 0;
> +
> +	width = drm_rect_width(&intel_pstate->src) >> 16;
> +	height = drm_rect_height(&intel_pstate->src) >> 16;
> +
> +	if (intel_rotation_90_or_270(pstate->rotation))
> +		swap(width, height);
>  
>  	/* 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 *
> +			return width * height *
>  				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 (width / 2) * (height / 2) *
>  				drm_format_plane_cpp(fb-
> >pixel_format, 1);
>  	}
>  
>  	/* for packed formats */
> -	return cstate->pipe_src_w * cstate->pipe_src_h *
> -		drm_format_plane_cpp(fb->pixel_format, 0);
> +	return width * height * drm_format_plane_cpp(fb-
> >pixel_format, 0);
>  }
>  
>  /*
> @@ -3033,8 +3037,9 @@ skl_allocate_pipe_ddb(struct intel_crtc_state
> *cstate,
>  		struct drm_framebuffer *fb = plane->state->fb;
>  		int id = skl_wm_plane_id(intel_plane);
>  
> -		if (fb == NULL)
> +		if (!to_intel_plane_state(plane->state)->visible)
>  			continue;
> +
>  		if (plane->type == DRM_PLANE_TYPE_CURSOR)
>  			continue;
>  
> @@ -3060,7 +3065,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state
> *cstate,
>  		uint16_t plane_blocks, y_plane_blocks = 0;
>  		int id = skl_wm_plane_id(intel_plane);
>  
> -		if (pstate->fb == NULL)
> +		if (!to_intel_plane_state(pstate)->visible)
>  			continue;
>  		if (plane->type == DRM_PLANE_TYPE_CURSOR)
>  			continue;
> @@ -3183,26 +3188,36 @@ 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 cpp;
> +	uint32_t width = 0, height = 0;
>  
> -	if (latency == 0 || !cstate->base.active || !fb)
> +	if (latency == 0 || !cstate->base.active || !intel_pstate-
> >visible)
>  		return false;
>  
> +	width = drm_rect_width(&intel_pstate->src) >> 16;
> +	height = drm_rect_height(&intel_pstate->src) >> 16;
> +
> +	if (intel_rotation_90_or_270(plane->state->rotation))
> +		swap(width, height);
> +
>  	cpp = drm_format_plane_cpp(fb->pixel_format, 0);
>  	method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate),
>  				 cpp, latency);
>  	method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
>  				 cstate-
> >base.adjusted_mode.crtc_htotal,
> -				 cstate->pipe_src_w,
> -				 cpp, fb->modifier[0],
> +				 width,
> +				 cpp,
> +				 fb->modifier[0],
>  				 latency);
>  
> -	plane_bytes_per_line = cstate->pipe_src_w * cpp;
> +	plane_bytes_per_line = width * cpp;
>  	plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line,
> 512);
>  
>  	if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-06 15:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01  1:46 [PATCH 00/16] Pre-calculate SKL-style atomic watermarks Matt Roper
2016-04-01  1:46 ` [PATCH 01/16] drm/i915: Reorganize WM structs/unions in CRTC state Matt Roper
2016-04-01  1:46 ` [PATCH 02/16] drm/i915: Make skl_plane_relative_data_rate use passed " Matt Roper
2016-04-01  1:46 ` [PATCH 03/16] drm/i915: Rename s/skl_compute_pipe_wm/skl_build_pipe_wm/ Matt Roper
2016-04-01  1:46 ` [PATCH 04/16] drm/i915/skl+: Use plane size for relative data rate calculation Matt Roper
2016-04-06 15:09   ` Imre Deak [this message]
2016-04-06 18:05     ` Matt Roper
2016-04-01  1:46 ` [PATCH 05/16] drm/i915/gen9: Allow calculation of data rate for in-flight state Matt Roper
2016-04-01  1:46 ` [PATCH 06/16] drm/i915: Ensure intel_state->active_crtcs is always set Matt Roper
2016-04-05  9:29   ` Maarten Lankhorst
2016-04-01  1:46 ` [PATCH 07/16] drm/i915/gen9: Allow skl_allocate_pipe_ddb() to operate on in-flight state Matt Roper
2016-04-05  9:35   ` Maarten Lankhorst
2016-04-14  1:58     ` Matt Roper
2016-04-18 12:56       ` Maarten Lankhorst
2016-04-01  1:46 ` [PATCH 08/16] drm/i915/gen9: Compute DDB allocation at atomic check time Matt Roper
2016-04-05  9:45   ` Maarten Lankhorst
2016-04-01  1:46 ` [PATCH 09/16] drm/i915/gen9: Drop re-allocation of DDB at atomic commit Matt Roper
2016-04-01  1:46 ` [PATCH 10/16] drm/i915/gen9: Calculate plane WM's from state Matt Roper
2016-04-01  1:46 ` [PATCH 11/16] drm/i915/gen9: Allow watermark calculation on in-flight atomic state Matt Roper
2016-04-05  9:52   ` Maarten Lankhorst
2016-04-01  1:46 ` [PATCH 12/16] drm/i915/gen9: Use a bitmask to track dirty pipe watermarks Matt Roper
2016-04-01  1:46 ` [PATCH 13/16] drm/i915/gen9: Propagate watermark calculation failures up the call chain Matt Roper
2016-04-01  1:46 ` [PATCH 14/16] drm/i915/gen9: Calculate watermarks during atomic 'check' Matt Roper
2016-04-05 13:01   ` Patrik Jakobsson
2016-04-01  1:46 ` [PATCH 15/16] drm/i915/gen9: Reject display updates that exceed wm limitations Matt Roper
2016-04-01  1:46 ` [PATCH 16/16] drm/i915: Remove wm_config from dev_priv/intel_atomic_state Matt Roper
2016-04-05 10:14   ` Maarten Lankhorst
2016-04-01  9:36 ` ✗ Fi.CI.BAT: warning for Pre-calculate SKL-style atomic watermarks Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459955340.28930.29.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox