Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754922AbeAIM1V (ORCPT + 1 other); Tue, 9 Jan 2018 07:27:21 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:54334 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752117AbeAIM1U (ORCPT ); Tue, 9 Jan 2018 07:27:20 -0500 Date: Tue, 9 Jan 2018 13:27:08 +0100 From: Boris Brezillon To: Maxime Ripard Cc: Chen-Yu Tsai , Daniel Vetter , Jani Nikula , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , thomas@vitsch.nl Subject: Re: [PATCH 02/19] drm/atmel-hlcdc: Use the alpha format helper Message-ID: <20180109132708.2ae5e54f@bbrezillon> In-Reply-To: <22c5a25fbdd56193ece1de90dc17cfa8747e7136.1515494838.git-series.maxime.ripard@free-electrons.com> References: <22c5a25fbdd56193ece1de90dc17cfa8747e7136.1515494838.git-series.maxime.ripard@free-electrons.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, 9 Jan 2018 11:56:21 +0100 Maxime Ripard wrote: > Now that the core has a drm format helper to tell if a format embeds an > alpha component in it, let's use it. > > Cc: Boris Brezillon Acked-by: Boris Brezillon > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 20 ++---------------- > 1 file changed, 3 insertions(+), 17 deletions(-) > > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > index 703c2d13603f..1a9318810a29 100644 > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c > @@ -194,20 +194,6 @@ static int atmel_hlcdc_format_to_plane_mode(u32 format, u32 *mode) > return 0; > } > > -static bool atmel_hlcdc_format_embeds_alpha(u32 format) > -{ > - int i; > - > - for (i = 0; i < sizeof(format); i++) { > - char tmp = (format >> (8 * i)) & 0xff; > - > - if (tmp == 'A') > - return true; > - } > - > - return false; > -} > - > static u32 heo_downscaling_xcoef[] = { > 0x11343311, > 0x000000f7, > @@ -395,7 +381,7 @@ atmel_hlcdc_plane_update_general_settings(struct atmel_hlcdc_plane *plane, > cfg |= ATMEL_HLCDC_LAYER_OVR | ATMEL_HLCDC_LAYER_ITER2BL | > ATMEL_HLCDC_LAYER_ITER; > > - if (atmel_hlcdc_format_embeds_alpha(format)) > + if (drm_format_has_alpha(format)) > cfg |= ATMEL_HLCDC_LAYER_LAEN; > else > cfg |= ATMEL_HLCDC_LAYER_GAEN | > @@ -566,7 +552,7 @@ atmel_hlcdc_plane_prepare_disc_area(struct drm_crtc_state *c_state) > ovl_state = drm_plane_state_to_atmel_hlcdc_plane_state(ovl_s); > > if (!ovl_s->fb || > - atmel_hlcdc_format_embeds_alpha(ovl_s->fb->format->format) || > + drm_format_has_alpha(ovl_s->fb->format->format) || > ovl_state->alpha != 255) > continue; > > @@ -769,7 +755,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, > > if ((state->crtc_h != state->src_h || state->crtc_w != state->src_w) && > (!desc->layout.memsize || > - atmel_hlcdc_format_embeds_alpha(state->base.fb->format->format))) > + drm_format_has_alpha(state->base.fb->format->format))) > return -EINVAL; > > if (state->crtc_x < 0 || state->crtc_y < 0)