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: 123872 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305647edr; Tue, 9 Jan 2018 02:57:11 -0800 (PST) X-Google-Smtp-Source: ACJfBosCdJTsoMRwv+VK1Uji8skNwFsdvFdJZWH97tGJMDSsO0SqievuVO1pihK6+Jattzb+UzJu X-Received: by 10.159.245.150 with SMTP id a22mr6242591pls.60.1515495431821; Tue, 09 Jan 2018 02:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495431; cv=none; d=google.com; s=arc-20160816; b=SuOXmIUYlPU6ODayQPz9Q1hrHTeEetBLb1bGtUWwyEexpVzM0C64tXSwYtRBeGUBA+ dPr7xpv83JJESlmOWCC2TYVXexsIvO5TlVzS8pFAwhBXvsISf0YeNTNqe8CVCBIPTcLE 22MI0HBTxuGHA18iACi71j3nY6SYvsidUPsy0zPWaOOK+5wxvbzopY5f8G9cTmZ+1r4a C+3m4RuegV35rOejFuEg9USwXNaFvMPcjJ/plLyysfyyVvp+KRhmhLtw4biZkMzTCcFr T6ErWXXHwLR8pt16gEuWnwgjQx5HQIS1VX++hStSQwbvu461JCjrf7u5b9Why48guzGj aM+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DP/Cji8/q3F3bw1wBDY2ut03Ca9gQGho9+OO5yEa8Gs=; b=gws8+BRKy+ntHUQP1cVjtnf2gj5Bs0n7/DHsfIgekbXFIlRGTvMHESB1MAVmSWdSVk 0TX9yUKT+ivAPOifW1sH4b0cRwlZjUy8dI7nExkxUGoGDumHUbygkBxBgo3Q/FNLIUwH sp7dcOf861XHtARrkSHv4xyZhOpJtcvfHk8jHYXF4HU2Xaq4LcGhDHKGysB8p0VNZu4V 1uxL2B+Uzq7VJWF7u+cuAwqHH3d4equi4mOQIJXHZCHqGw8PLCL5ZvvnHWbKdLJ5oikM uhdYd9p8ZvKphwZJ9RGmVLbdOwpLmbN381+loOvjs3BfKvwH2+eFWZy2vC47Oa/3fcQO P5CQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si4426184pgn.551.2018.01.09.02.57.11; Tue, 09 Jan 2018 02:57:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932221AbeAIK5G (ORCPT + 28 others); Tue, 9 Jan 2018 05:57:06 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:50924 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754162AbeAIK5D (ORCPT ); Tue, 9 Jan 2018 05:57:03 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 375AD2066A; Tue, 9 Jan 2018 11:57:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 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 Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , thomas@vitsch.nl, Boris Brezillon 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 20 ++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) -- git-series 0.9.1 Acked-by: Boris Brezillon 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)