Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915: Reuse intel_adjusted_rate() for pfit pixel rate adjustment
Date: Thu, 01 Apr 2021 15:55:20 +0300	[thread overview]
Message-ID: <87k0pmmafb.fsf@intel.com> (raw)
In-Reply-To: <20210330184254.6290-2-ville.syrjala@linux.intel.com>

On Tue, 30 Mar 2021, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Replace the hand rolled pfit downscale calculations with
> intel_adjusted_rate().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  .../gpu/drm/i915/display/intel_atomic_plane.c |  6 ++---
>  .../gpu/drm/i915/display/intel_atomic_plane.h |  4 ++++
>  drivers/gpu/drm/i915/display/intel_display.c  | 23 +++++--------------
>  3 files changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 3f830b70b0c1..5f0a5ea474eb 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -133,9 +133,9 @@ intel_plane_destroy_state(struct drm_plane *plane,
>  	kfree(plane_state);
>  }
>  
> -static unsigned int intel_adjusted_rate(const struct drm_rect *src,
> -					const struct drm_rect *dst,
> -					unsigned int rate)
> +unsigned int intel_adjusted_rate(const struct drm_rect *src,
> +				 const struct drm_rect *dst,
> +				 unsigned int rate)
>  {
>  	unsigned int src_w, src_h, dst_w, dst_h;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.h b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> index 5c78a087ed86..dc4d05e75e1c 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> @@ -10,6 +10,7 @@
>  
>  struct drm_plane;
>  struct drm_property;
> +struct drm_rect;
>  struct intel_atomic_state;
>  struct intel_crtc;
>  struct intel_crtc_state;
> @@ -18,6 +19,9 @@ struct intel_plane_state;
>  
>  extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
>  
> +unsigned int intel_adjusted_rate(const struct drm_rect *src,
> +				 const struct drm_rect *dst,
> +				 unsigned int rate);
>  unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
>  				    const struct intel_plane_state *plane_state);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index d74b263c5f4e..472e691286c6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3978,7 +3978,7 @@ static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
>  static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
>  {
>  	u32 pixel_rate = crtc_state->hw.pipe_mode.crtc_clock;
> -	unsigned int pipe_w, pipe_h, pfit_w, pfit_h;
> +	struct drm_rect src;
>  
>  	/*
>  	 * We only use IF-ID interlacing. If we ever use
> @@ -3988,23 +3988,12 @@ static u32 ilk_pipe_pixel_rate(const struct intel_crtc_state *crtc_state)
>  	if (!crtc_state->pch_pfit.enabled)
>  		return pixel_rate;
>  
> -	pipe_w = crtc_state->pipe_src_w;
> -	pipe_h = crtc_state->pipe_src_h;
> +	drm_rect_init(&src, 0, 0,
> +		      crtc_state->pipe_src_w << 16,
> +		      crtc_state->pipe_src_h << 16);
>  
> -	pfit_w = drm_rect_width(&crtc_state->pch_pfit.dst);
> -	pfit_h = drm_rect_height(&crtc_state->pch_pfit.dst);
> -
> -	if (pipe_w < pfit_w)
> -		pipe_w = pfit_w;

So this is src_w = max(src_w, dst_w) and gets turned into dst_w =
min(src_w, dst_w) instead? Ditto for _h. Does it end up being the same
thing after the division?

BR,
Jani.

> -	if (pipe_h < pfit_h)
> -		pipe_h = pfit_h;
> -
> -	if (drm_WARN_ON(crtc_state->uapi.crtc->dev,
> -			!pfit_w || !pfit_h))
> -		return pixel_rate;
> -
> -	return div_u64(mul_u32_u32(pixel_rate, pipe_w * pipe_h),
> -		       pfit_w * pfit_h);
> +	return intel_adjusted_rate(&src, &crtc_state->pch_pfit.dst,
> +				   pixel_rate);
>  }
>  
>  static void intel_mode_from_crtc_timings(struct drm_display_mode *mode,

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-04-01 12:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 18:42 [Intel-gfx] [PATCH 1/2] drm/i915: Extract intel_adjusted_rate() Ville Syrjala
2021-03-30 18:42 ` [Intel-gfx] [PATCH 2/2] drm/i915: Reuse intel_adjusted_rate() for pfit pixel rate adjustment Ville Syrjala
2021-04-01 12:55   ` Jani Nikula [this message]
2021-04-01 14:23     ` Ville Syrjälä
2021-04-01 14:50       ` Jani Nikula
2021-03-30 19:04 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for series starting with [1/2] drm/i915: Extract intel_adjusted_rate() Patchwork
2021-03-30 19:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-03-30 20:54 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-04-01 12:43 ` [Intel-gfx] [PATCH 1/2] " Jani Nikula
2021-04-01 14:32   ` Ville Syrjälä
2021-04-01 15:21     ` Ville Syrjälä
2021-04-01 15:40 ` [Intel-gfx] [PATCH v2 " Ville Syrjala
2021-04-01 17:33 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for series starting with [v2,1/2] drm/i915: Extract intel_adjusted_rate() (rev2) Patchwork
2021-04-01 17:57 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-04-01 22:23 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=87k0pmmafb.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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