From: Jani Nikula <jani.nikula@linux.intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
intel-gfx@lists.freedesktop.org
Cc: Drew Davenport <ddavenport@chromium.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: assume some pixelrate for src smaller than 1
Date: Wed, 04 Jan 2023 15:23:38 +0200 [thread overview]
Message-ID: <87zgaywi05.fsf@intel.com> (raw)
In-Reply-To: <20230104124448.7418-1-juhapekka.heikkila@gmail.com>
On Wed, 04 Jan 2023, Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> wrote:
> intel_adjusted_rate() didn't take into account src rectangle
> can be less than 1 in width or height.
>
> 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);
The options are to use 1U or max_t(), but please don't cast the
parameters of max().
Side note, the explicit "unsigned int" is always preferred over the
implicit "unsigned".
BR,
Jani.
> +
> + 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,
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-01-04 13:23 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 [this message]
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 ` [Intel-gfx] [PATCH] drm/i915/display: assume some pixelrate for src smaller than 1 Ville Syrjälä
2023-01-11 18:28 ` 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=87zgaywi05.fsf@intel.com \
--to=jani.nikula@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 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.