lkml.org 
[lkml]   [2017]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@siol.net> wrote:
> Calculate scaling parameters and call appropriate scaler set up
> function.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.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@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

\
 
 \ /
  Last update: 2017-11-29 22:49    [W:0.120 / U:10.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site