[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0255d007-6929-4366-b47e-0826e13b86e8@amd.com>
Date: Fri, 8 Mar 2024 15:57:00 -0500
From: Harry Wentland <harry.wentland@....com>
To: Arthur Grillo <arthurgrillo@...eup.net>,
Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Melissa Wen <melissa.srw@...il.com>, MaĆra Canal
<mairacanal@...eup.net>, Haneen Mohammed <hamohammed.sa@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Jonathan Corbet <corbet@....net>,
pekka.paalanen@...oniitty.fi, Louis Chauvet <louis.chauvet@...tlin.com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
jeremie.dautheribes@...tlin.com, miquel.raynal@...tlin.com,
thomas.petazzoni@...tlin.com, seanpaul@...gle.com, marcheu@...gle.com,
nicolejadeyee@...gle.com, Pekka Paalanen <pekka.paalanen@...labora.com>
Subject: Re: [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5
On 2024-03-06 15:03, Arthur Grillo wrote:
> As well noted by Pekka[1], the rounding of drm_fixp2int_round is wrong.
> To round a number, you need to add 0.5 to the number and floor that,
> drm_fixp2int_round() is adding 0.0000076. Make it add 0.5.
>
> [1]: https://lore.kernel.org/all/20240301135327.22efe0dd.pekka.paalanen@collabora.com/
>
> Suggested-by: Pekka Paalanen <pekka.paalanen@...labora.com>
> Signed-off-by: Arthur Grillo <arthurgrillo@...eup.net>
Reviewed-by: Harry Wentland <harry.wentland@....com>
I had a different jab at this [1], but your patch is cleaner.
https://patchwork.freedesktop.org/patch/579978/?series=123446&rev=4
Harry
> ---
> include/drm/drm_fixed.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
> index 0c9f917a4d4b..de3a79909ac9 100644
> --- a/include/drm/drm_fixed.h
> +++ b/include/drm/drm_fixed.h
> @@ -90,7 +90,7 @@ static inline int drm_fixp2int(s64 a)
>
> static inline int drm_fixp2int_round(s64 a)
> {
> - return drm_fixp2int(a + (1 << (DRM_FIXED_POINT_HALF - 1)));
> + return drm_fixp2int(a + DRM_FIXED_ONE / 2);
> }
>
> static inline int drm_fixp2int_ceil(s64 a)
>
Powered by blists - more mailing lists