Hi Julian, Dne sreda, 29. november 2017 ob 22:48:34 CET je Julian Calaby napisal(a): > Hi Jernej, > > On Tue, Nov 28, 2017 at 7:57 AM, Jernej Skrabec <jernej.skrabec@xxxxxxxx> wrote: > > Calculate scaling parameters and call appropriate scaler set up > > function. > > > > Signed-off-by: Jernej Skrabec <jernej.skrabec@xxxxxxxx> > > --- > > > > 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. That indeed looks much better. I will use it in next version. Thanks, Jernej > > Thanks, > > -- > Julian Calaby > > Email: julian.calaby@xxxxxxxxx > Profile: http://www.google.com/profiles/julian.calaby/ _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel