[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGRGNgX_ZP9bpVuHzgmkyj18TKAMUpNgudiEzFRkJV-Z4MN4fQ@mail.gmail.com>
Date: Thu, 30 Nov 2017 08:48:34 +1100
From: Julian Calaby <julian.calaby@...il.com>
To: jernej.skrabec@...l.net
Cc: Maxime Ripard <maxime.ripard@...e-electrons.com>,
Chen-Yu Tsai <wens@...e.org>, David Airlie <airlied@...ux.ie>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
"Mailing List, Arm" <linux-arm-kernel@...ts.infradead.org>,
icenowy@...c.io, linux-sunxi <linux-sunxi@...glegroups.com>
Subject: Re: [linux-sunxi] [PATCH 11/17] drm/sun4i: Wire in DE2 scaler support
Hi Jernej,
On Tue, Nov 28, 2017 at 7:57 AM, Jernej Skrabec <jernej.skrabec@...l.net> wrote:
> Calculate scaling parameters and call appropriate scaler set up
> function.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@...l.net>
> ---
> drivers/gpu/drm/sun4i/sun8i_layer.c | 12 +++-
> drivers/gpu/drm/sun4i/sun8i_mixer.c | 115 +++++++++++++++++++++++++-----------
> drivers/gpu/drm/sun4i/sun8i_mixer.h | 4 --
> 3 files changed, 90 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c
> index e1b6ad82145e..6860271e5415 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c
> @@ -41,9 +44,14 @@ static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane,
> clip.x2 = crtc_state->adjusted_mode.hdisplay;
> clip.y2 = crtc_state->adjusted_mode.vdisplay;
>
> + scaler_supported = !!(layer->mixer->cfg->scaler_mask & BIT(layer->id));
> +
> + min_scale = scaler_supported ? 1 : DRM_PLANE_HELPER_NO_SCALING;
> + max_scale = scaler_supported ? (1UL << 20) - 1 :
> + DRM_PLANE_HELPER_NO_SCALING;
> +
Disclaimer: I hate ternaries, but this looks like it'd be better
written as an if statement. I.e.
min_scale = DRM_PLANE_HELPER_NO_SCALING;
max_scale = DRM_PLANE_HELPER_NO_SCALING;
if (layer->mixer->cfg->scaler_mask & BIT(layer->id)) {
min_scale = 1;
max_scale = (1UL << 20) - 1;
}
However the compiler will probably sort it all out anyway, so it
probably doesn't matter that much, except for style.
Thanks,
--
Julian Calaby
Email: julian.calaby@...il.com
Profile: http://www.google.com/profiles/julian.calaby/
Powered by blists - more mailing lists