From patchwork Tue Jan 9 10:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10151839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 88068603ED for ; Tue, 9 Jan 2018 11:49:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AC9B27FB7 for ; Tue, 9 Jan 2018 11:49:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E4562854A; Tue, 9 Jan 2018 11:49:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D47AB27FB7 for ; Tue, 9 Jan 2018 11:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qsQwZw0eiryhqVUYYo0pOsD17+8jbP1Te93lcKLO4do=; b=ZQeNAz8AGnrztYtI1HlWD73B6+ 4elFlWEjaE6hn5YxDmdORHSnNMW9M2axNP8DyMFi3tC5p73IucKwTE3XLGXA6Vb7mQL1x54xr1xfi Dq4m/CzJ08yEMXIP6MGjNcRwROwX/pwEFf1AMiocRS4GpoOYBVrHRAKoCQ2qPxyhmz8VO6KC0zuc1 E9SoOMxsYJtfnoARXCnlALqS3DrVKi9OvbWkhmWC6ky/xEpkxbpLMjqYQbvMOMoYjl12a/2+nTlR/ 9gF0XmRUTsJ3e63Jh+AEd1qzP0tgJXBW596vr3JroEV7AZXio82Bl3OWwroT2dCsHGB/DMVJLNugP WnsiAeqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYsPL-0005gw-Pv; Tue, 09 Jan 2018 11:49:31 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYsKm-0001Qu-Tb for linux-arm-kernel@bombadil.infradead.org; Tue, 09 Jan 2018 11:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DP/Cji8/q3F3bw1wBDY2ut03Ca9gQGho9+OO5yEa8Gs=; b=JyD+AIesGTZmuAjKSLrhqcwv3 KHRF6TzVzAtHyZWlSV/Z0dBUFMlseREmfi7T5YglIyNaPd0Ele4Dh96ym6IBRUqlngq8dy5W+GlKs NLul5PBf5CLxYO8gTJOueY+xX9K4vd0QPJd+orpRZKaJVRf97Xg3ZBEe5KPYb6optNgYLtOmxvlc0 2dR4ZYziNgmH322B4XEZgtNhl1HS1DyoW9zJKzG20ozS+0YwqDJFqJCrMdK+KwLLqsfX2cOaIHdao BmdnEChGkl1KsLhZgYXzEDnfkF0uYmj9mV8+NlXfUh2EPAlBTHKh2CyuSAKIsT+eTWTuJIXkDXqgs nQf78irTQ==; Received: from mail.free-electrons.com ([62.4.15.54]) by merlin.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYraa-000859-DD for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2018 10:57:05 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 375AD2066A; Tue, 9 Jan 2018 11:57:01 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id BCD0B2074A; Tue, 9 Jan 2018 11:56:42 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 02/19] drm/atmel-hlcdc: Use the alpha format helper Date: Tue, 9 Jan 2018 11:56:21 +0100 Message-Id: <22c5a25fbdd56193ece1de90dc17cfa8747e7136.1515494838.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Boris Brezillon , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Maxime Ripard Acked-by: Boris Brezillon --- 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)