Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915: Extract intel_adjusted_rate()
Date: Thu, 1 Apr 2021 17:32:20 +0300	[thread overview]
Message-ID: <YGXZdLbrne3N56sw@intel.com> (raw)
In-Reply-To: <87mtuimayu.fsf@intel.com>

On Thu, Apr 01, 2021 at 03:43:37PM +0300, Jani Nikula wrote:
> On Tue, 30 Mar 2021, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Extract a small helper to calculate the downscaling
> > adjusted pixel rate/data rate/etc.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_atomic_plane.c | 27 +++++++++++++------
> >  1 file changed, 19 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > index c3f2962aa1eb..3f830b70b0c1 100644
> > --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> > @@ -133,25 +133,36 @@ intel_plane_destroy_state(struct drm_plane *plane,
> >  	kfree(plane_state);
> >  }
> >  
> > -unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
> > -				    const struct intel_plane_state *plane_state)
> > +static 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;
> > -	unsigned int pixel_rate = crtc_state->pixel_rate;
> >  
> > -	src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
> > -	src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
> > -	dst_w = drm_rect_width(&plane_state->uapi.dst);
> > -	dst_h = drm_rect_height(&plane_state->uapi.dst);
> > +	src_w = drm_rect_width(src) >> 16;
> > +	src_h = drm_rect_height(src) >> 16;
> > +	dst_w = drm_rect_width(dst);
> > +	dst_h = drm_rect_height(dst);
> >  
> >  	/* Downscaling limits the maximum pixel rate */
> >  	dst_w = min(src_w, dst_w);
> >  	dst_h = min(src_h, dst_h);
> >  
> > -	return DIV_ROUND_UP_ULL(mul_u32_u32(pixel_rate, src_w * src_h),
> > +	return DIV_ROUND_UP_ULL(mul_u32_u32(rate, src_w * src_h),
> >  				dst_w * dst_h);
> >  }
> >  
> > +unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
> > +				    const struct intel_plane_state *plane_state)
> > +{
> > +	if (!plane_state->uapi.visible)
> 
> Potential functional change not covered in the commit message? Makes
> sense, but the rabbit hole is too deep to find out if this could
> actually make a difference.

This is fine. If the plane isn't visible then it's not
generating any pixels anyway. I think I either had some other
patches originally that wanted this, or I just wanted to make
this safe to call at any point without checking for plane
visibility in the caller. But IIRC I dropped those other
patches and so this might not be necessary anymore. I'll double
check and either drop this or amend the commit msg a bit.

> 
> If mentioned in the commit message,
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> 
> > +		return 0;
> > +
> > +	return intel_adjusted_rate(&plane_state->uapi.src,
> > +				   &plane_state->uapi.dst,
> > +				   crtc_state->pixel_rate);
> > +}
> > +
> >  unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
> >  				   const struct intel_plane_state *plane_state)
> >  {
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

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

  reply	other threads:[~2021-04-01 14:32 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
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ä [this message]
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=YGXZdLbrne3N56sw@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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