[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <32207beb-3d28-c858-4997-74725729e5a1@baylibre.com>
Date: Thu, 2 Sep 2021 11:15:34 +0200
From: Neil Armstrong <narmstrong@...libre.com>
To: Alyssa Rosenzweig <alyssa@...enzweig.io>,
dri-devel@...ts.freedesktop.org
Cc: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Kevin Hilman <khilman@...libre.com>,
Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
Rob Clark <robdclark@...il.com>, Sean Paul <sean@...rly.run>,
Sandy Huang <hjc@...k-chips.com>,
Heiko Stübner <heiko@...ech.de>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
Abhinav Kumar <abhinavk@...eaurora.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Lee Jones <lee.jones@...aro.org>,
Stephen Boyd <swboyd@...omium.org>,
Kalyan Thota <kalyan_t@...eaurora.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-amlogic@...ts.infradead.org
Subject: Re: [PATCH 2/5] drm/meson: Use common drm_fixed_16_16 helper
On 01/09/2021 19:54, Alyssa Rosenzweig wrote:
> Replace our open-coded FRAC_16_16 with the common drm_fixed_16_16
> helper to reduce code duplication between drivers.
>
> Signed-off-by: Alyssa Rosenzweig <alyssa@...enzweig.io>
> Cc: linux-amlogic@...ts.infradead.org
> ---
> drivers/gpu/drm/meson/meson_overlay.c | 7 +++----
> drivers/gpu/drm/meson/meson_plane.c | 5 ++---
> 2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c
> index dfef8afcc245..d8fc6bbb332f 100644
> --- a/drivers/gpu/drm/meson/meson_overlay.c
> +++ b/drivers/gpu/drm/meson/meson_overlay.c
> @@ -15,6 +15,7 @@
> #include <drm/drm_gem_atomic_helper.h>
> #include <drm/drm_gem_cma_helper.h>
> #include <drm/drm_plane_helper.h>
> +#include <drm/drm_fixed.h>
>
> #include "meson_overlay.h"
> #include "meson_registers.h"
> @@ -162,8 +163,6 @@ struct meson_overlay {
> };
> #define to_meson_overlay(x) container_of(x, struct meson_overlay, base)
>
> -#define FRAC_16_16(mult, div) (((mult) << 16) / (div))
> -
> static int meson_overlay_atomic_check(struct drm_plane *plane,
> struct drm_atomic_state *state)
> {
> @@ -181,8 +180,8 @@ static int meson_overlay_atomic_check(struct drm_plane *plane,
>
> return drm_atomic_helper_check_plane_state(new_plane_state,
> crtc_state,
> - FRAC_16_16(1, 5),
> - FRAC_16_16(5, 1),
> + drm_fixed_16_16(1, 5),
> + drm_fixed_16_16(5, 1),
> true, true);
> }
>
> diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
> index 8640a8a8a469..4fae9ebbf178 100644
> --- a/drivers/gpu/drm/meson/meson_plane.c
> +++ b/drivers/gpu/drm/meson/meson_plane.c
> @@ -19,6 +19,7 @@
> #include <drm/drm_gem_atomic_helper.h>
> #include <drm/drm_gem_cma_helper.h>
> #include <drm/drm_plane_helper.h>
> +#include <drm/drm_fixed.h>
>
> #include "meson_plane.h"
> #include "meson_registers.h"
> @@ -68,8 +69,6 @@ struct meson_plane {
> };
> #define to_meson_plane(x) container_of(x, struct meson_plane, base)
>
> -#define FRAC_16_16(mult, div) (((mult) << 16) / (div))
> -
> static int meson_plane_atomic_check(struct drm_plane *plane,
> struct drm_atomic_state *state)
> {
> @@ -92,7 +91,7 @@ static int meson_plane_atomic_check(struct drm_plane *plane,
> */
> return drm_atomic_helper_check_plane_state(new_plane_state,
> crtc_state,
> - FRAC_16_16(1, 5),
> + drm_fixed_16_16(1, 5),
> DRM_PLANE_HELPER_NO_SCALING,
> false, true);
> }
>
Reviewed-by: Neil Armstrong <narmstrong@...libre.com>
Powered by blists - more mailing lists