All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mahesh Kumar <mahesh1.kumar@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/i915/skl+: calculate plane pixel rate (v4)
Date: Mon, 30 May 2016 10:58:09 +0530	[thread overview]
Message-ID: <574BCF69.20004@intel.com> (raw)
In-Reply-To: <1463439121-28974-4-git-send-email-matthew.d.roper@intel.com>

Reviewed-by: Kumar Mahesh <mahesh1.kumar@intel.com>

On Tuesday 17 May 2016 04:22 AM, Matt Roper wrote:
> From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>
>
> Don't use pipe pixel rate for plane pixel rate. Calculate plane pixel according
> to formula
>
> adjusted plane_pixel_rate = adjusted pipe_pixel_rate * downscale ammount
>
> downscale amount = max[1, src_h/dst_h] * max[1, src_w/dst_w]
> if 90/270 rotation use rotated width & height
>
> v2: use intel_plane_state->visible instead of (fb == NULL) as per Matt's
>      comment.
>
> v3 (by Matt):
>   - Keep downscale amount in 16.16 fixed point rather than converting to
>     decimal fixed point.
>   - Store adjusted plane pixel rate in plane state instead of the plane
>     parameters structure that we no longer use.
>
> v4 (by Matt):
>   - Significant rebasing onto latest atomic watermark work
>   - Don't bother storing plane pixel rate in state; just calculate it
>     right before the calls that make use of it.
>   - Fix downscale calculations to actually use width values when
>     computing downscale_w rather than copy/pasted height values.
>
> Cc: matthew.d.roper@intel.com
> Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_pm.c | 73 +++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 70 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index d7165b5..5bd885b 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -26,6 +26,7 @@
>    */
>   
>   #include <linux/cpufreq.h>
> +#include <drm/drm_plane_helper.h>
>   #include "i915_drv.h"
>   #include "intel_drv.h"
>   #include "../../../platform/x86/intel_ips.h"
> @@ -2945,6 +2946,46 @@ void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
>   	}
>   }
>   
> +/*
> + * Determines the downscale amount of a plane for the purposes of watermark calculations.
> + * The bspec defines downscale amount as:
> + *
> + * """
> + * Horizontal down scale amount = maximum[1, Horizontal source size /
> + *                                           Horizontal destination size]
> + * Vertical down scale amount = maximum[1, Vertical source size /
> + *                                         Vertical destination size]
> + * Total down scale amount = Horizontal down scale amount *
> + *                           Vertical down scale amount
> + * """
> + *
> + * Return value is provided in 16.16 fixed point form to retain fractional part.
> + * Caller should take care of dividing & rounding off the value.
> + */
> +static uint32_t
> +skl_plane_downscale_amount(const struct intel_plane_state *pstate)
> +{
> +	uint32_t downscale_h, downscale_w;
> +	uint32_t src_w, src_h, dst_w, dst_h;
> +
> +	if (WARN_ON(!pstate->visible))
> +		return DRM_PLANE_HELPER_NO_SCALING;
> +
> +	/* n.b., src is 16.16 fixed point, dst is whole integer */
> +	src_w = drm_rect_width(&pstate->src);
> +	src_h = drm_rect_height(&pstate->src);
> +	dst_w = drm_rect_width(&pstate->dst);
> +	dst_h = drm_rect_height(&pstate->dst);
> +	if (intel_rotation_90_or_270(pstate->base.rotation))
> +		swap(dst_w, dst_h);
> +
> +	downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
> +	downscale_w = max(src_w / dst_w, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
> +
> +	/* Provide result in 16.16 fixed point */
> +	return (uint64_t)downscale_w * downscale_h >> 16;
> +}
> +
>   static unsigned int
>   skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
>   			     const struct drm_plane_state *pstate,
> @@ -3273,6 +3314,30 @@ static uint32_t skl_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal,
>   	return ret;
>   }
>   
> +static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cstate,
> +					      struct intel_plane_state *pstate)
> +{
> +	uint64_t adjusted_pixel_rate;
> +	uint64_t downscale_amount;
> +	uint64_t pixel_rate;
> +
> +	/* Shouldn't reach here on disabled planes... */
> +	if (WARN_ON(!pstate->visible))
> +		return 0;
> +
> +	/*
> +	 * Adjusted plane pixel rate is just the pipe's adjusted pixel rate
> +	 * with additional adjustments for plane-specific scaling.
> +	 */
> +	adjusted_pixel_rate = skl_pipe_pixel_rate(cstate);
> +	downscale_amount = skl_plane_downscale_amount(pstate);
> +
> +	pixel_rate = adjusted_pixel_rate * downscale_amount >> 16;
> +	WARN_ON(pixel_rate != clamp_t(uint32_t, pixel_rate, 0, ~0));
> +
> +	return pixel_rate;
> +}
> +
>   static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>   				struct intel_crtc_state *cstate,
>   				struct intel_plane_state *intel_pstate,
> @@ -3291,6 +3356,7 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>   	uint32_t selected_result;
>   	uint8_t cpp;
>   	uint32_t width = 0, height = 0;
> +	uint32_t plane_pixel_rate;
>   
>   	if (latency == 0 || !cstate->base.active || !intel_pstate->visible) {
>   		*enabled = false;
> @@ -3304,9 +3370,10 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>   		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),
> +	plane_pixel_rate = skl_adjusted_plane_pixel_rate(cstate, intel_pstate);
> +
> +	method1 = skl_wm_method1(plane_pixel_rate, cpp, latency);
> +	method2 = skl_wm_method2(plane_pixel_rate,
>   				 cstate->base.adjusted_mode.crtc_htotal,
>   				 width,
>   				 cpp,

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

  reply	other threads:[~2016-05-30  5:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16 22:51 [PATCH 0/4] SKL watermark algorithm updates Matt Roper
2016-05-16 22:51 ` [PATCH 1/4] drm/i915: Don't try to calculate relative data rates during hw readout Matt Roper
2016-05-16 22:51 ` [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v4) Matt Roper
2016-05-26 22:13   ` [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v5) Matt Roper
2016-05-30  5:05     ` Mahesh Kumar
2016-05-31 16:58       ` [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v6) Matt Roper
2016-06-01 14:25         ` Mahesh Kumar
2016-06-01 14:40           ` Matt Roper
2016-05-16 22:52 ` [PATCH 3/4] drm/i915/skl+: calculate plane pixel rate (v4) Matt Roper
2016-05-30  5:28   ` Mahesh Kumar [this message]
2016-05-16 22:52 ` [PATCH 4/4] drm/i915/skl+: Use scaling amount for plane data rate calculation (v3) Matt Roper
2016-05-19 22:03   ` [PATCH 4/4] drm/i915/skl+: Use scaling amount for plane data rate calculation (v4) Matt Roper
2016-05-30  5:33     ` Mahesh Kumar
2016-05-17  5:51 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates Patchwork
2016-05-20  8:52 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev2) Patchwork
2016-05-27  6:09 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev3) Patchwork
2016-05-31 17:34 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev4) Patchwork
2016-05-31 18:20   ` Matt Roper

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=574BCF69.20004@intel.com \
    --to=mahesh1.kumar@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 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.