From patchwork Mon Jan 22 10:35:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 125379 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1081017ljf; Mon, 22 Jan 2018 02:36:07 -0800 (PST) X-Google-Smtp-Source: AH8x227Cedkg+8OW4WPtJbACvQwy+HRqSfMeJgfP4ur1J3Nps1kJ45qUB4Cia2gyOl8lZmWOdCWI X-Received: by 10.99.115.89 with SMTP id d25mr6850042pgn.218.1516617367718; Mon, 22 Jan 2018 02:36:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516617367; cv=none; d=google.com; s=arc-20160816; b=xqWA8QxYoC4m3YzPbdoW4K+OZBWIAStvKCq9jAvmXY9Um3J26hf/hux3X6MphmzpZQ vMaA23yTVMYgoBh0xsoXAN2o4bp/YSLL5ROY9z9TMbiHsPfVb0nxGmK9U/nInW0+BPrX rU7YISnbS7VGSDOQrzOiqHr5L+/SmPcRJ+zUjtgaIr5B9AlfaWUwxfQ0p9fRVC57MC5P YlLumhWAcTwtx0Udkgp5ZFspXsX4t7w9/zJUoW7dxylVfK16zleR0150BHHw69G8qRDC d2s/+zRifdKRfQvZ2xbJLoEvpVvHp0KsRytbhbEoBZbQHkju274SMYDALQyZTwgPWCjI B4NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=b8qL4PIWAEtp61yVH8YN4j4Gw8qsSs18j2werLVw4Pw=; b=rehz/V/2BRY60GoVAujdkkz5MCx4ddZHL1LMcwBSN0CTshYW37u3E/iXt8iXksXS1y JA5jLiuQ2Ho98lUpAsOFdU+aAV426DPllgxYEse9zCOa5KQwOKWPWGETlYJmO3yyPQTo sl+hWERbUZm38kGv3YJXPc6qFjm0c7MO1jvA/w5aZi7a+6Ojx1S2duEZfve/Vn2gZgbi 90IdCRx+QgYcDtsA8f45Gt760abCaHPFQx7lY+RIJnOydHiE2NP9oGUZt7wB59RUvAYC VjMEpt3jtXs+uTE7KL+MkZKVH6R3VF91tZnEKr58UJd19E1TSsUTCiWloMsbbKHkqDSr 3r4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n28si15173092pfg.103.2018.01.22.02.36.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 02:36:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 433D56E16E; Mon, 22 Jan 2018 10:36:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id BF34C6E132 for ; Mon, 22 Jan 2018 10:36:01 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 234B320397; Mon, 22 Jan 2018 11:36: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 E3B892039D; Mon, 22 Jan 2018 11:35:50 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org Subject: [PATCH v2 02/19] drm/atmel-hlcdc: Use the alpha format field in drm_format_info Date: Mon, 22 Jan 2018 11:35:31 +0100 Message-Id: <23518426a46320dd884465cebec0961f839f2972.1516617243.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, thomas@vitsch.nl X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Now that the drm_format_info has a alpha field to tell if a format embeds an alpha component in it, let's use it. Acked-by: Boris Brezillon Reviewed-by: Daniel Vetter Signed-off-by: Maxime Ripard --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 24 +++--------------- 1 file changed, 5 insertions(+), 19 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..e18800ed7cd1 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, @@ -377,13 +363,13 @@ atmel_hlcdc_plane_update_general_settings(struct atmel_hlcdc_plane *plane, { unsigned int cfg = ATMEL_HLCDC_LAYER_DMA_BLEN_INCR16 | state->ahb_id; const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc; - u32 format = state->base.fb->format->format; + const struct drm_format_info *format = state->base.fb->format; /* * Rotation optimization is not working on RGB888 (rotation is still * working but without any optimization). */ - if (format == DRM_FORMAT_RGB888) + if (format->format == DRM_FORMAT_RGB888) cfg |= ATMEL_HLCDC_LAYER_DMA_ROTDIS; atmel_hlcdc_layer_write_cfg(&plane->layer, ATMEL_HLCDC_LAYER_DMA_CFG, @@ -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 (format->has_alpha) 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) || + ovl_s->fb->format->has_alpha || 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))) + state->base.fb->format->has_alpha)) return -EINVAL; if (state->crtc_x < 0 || state->crtc_y < 0)