Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Drew Davenport <ddavenport@chromium.org>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: assume some pixelrate for src smaller than 1
Date: Wed, 11 Jan 2023 16:19:00 +0200	[thread overview]
Message-ID: <Y77FVOCTCWcUI1D+@intel.com> (raw)
In-Reply-To: <20230104124448.7418-1-juhapekka.heikkila@gmail.com>

On Wed, Jan 04, 2023 at 02:44:48PM +0200, Juha-Pekka Heikkila wrote:
> intel_adjusted_rate() didn't take into account src rectangle
> can be less than 1 in width or height.

This should not get called in those cases. What does the
backtrace look like?

> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/intel_atomic_plane.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 10e1fc9d0698..a9948e8d3543 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -144,7 +144,7 @@ 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 src_w, src_h, dst_w, dst_h, dst_wh;
>  
>  	src_w = drm_rect_width(src) >> 16;
>  	src_h = drm_rect_height(src) >> 16;
> @@ -155,8 +155,10 @@ unsigned int intel_adjusted_rate(const struct drm_rect *src,
>  	dst_w = min(src_w, dst_w);
>  	dst_h = min(src_h, dst_h);
>  
> -	return DIV_ROUND_UP_ULL(mul_u32_u32(rate, src_w * src_h),
> -				dst_w * dst_h);
> +	/* in case src contained only fractional part */
> +	dst_wh = max(dst_w * dst_h, (unsigned) 1);
> +
> +	return DIV_ROUND_UP_ULL(mul_u32_u32(rate, src_w * src_h), dst_wh);
>  }
>  
>  unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
> -- 
> 2.37.3

-- 
Ville Syrjälä
Intel

  parent reply	other threads:[~2023-01-11 14:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 12:44 [Intel-gfx] [PATCH] drm/i915/display: assume some pixelrate for src smaller than 1 Juha-Pekka Heikkila
2023-01-04 13:23 ` Jani Nikula
2023-01-04 19:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-01-04 19:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-01-05  1:54 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-01-08 11:30 ` [Intel-gfx] [PATCH v2] " Juha-Pekka Heikkila
2023-01-10 21:27   ` Imre Deak
2023-01-11  0:31     ` Imre Deak
2023-01-08 13:13 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/display: assume some pixelrate for src smaller than 1 (rev2) Patchwork
2023-01-08 15:57 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/display: assume some pixelrate for src smaller than 1 (rev3) Patchwork
2023-01-08 17:18 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-01-11 14:19 ` Ville Syrjälä [this message]
2023-01-11 18:28   ` [Intel-gfx] [PATCH] drm/i915/display: assume some pixelrate for src smaller than 1 Drew Davenport
2023-01-11 19:39     ` Ville Syrjälä
2023-01-11 20:09       ` Drew Davenport
2023-01-11 21:25         ` Juha-Pekka Heikkila

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=Y77FVOCTCWcUI1D+@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ddavenport@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.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