From patchwork Tue Jan 9 10:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123878 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305931edr; Tue, 9 Jan 2018 02:57:32 -0800 (PST) X-Google-Smtp-Source: ACJfBove1ZQ6MdXFRt2iao0H0Gn+QktMYNHUPqek19kDXKWd4jzhvPi1ZSZV5DOYFnq8f5WLU6o3 X-Received: by 10.159.229.8 with SMTP id s8mr14743079plq.81.1515495452121; Tue, 09 Jan 2018 02:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495452; cv=none; d=google.com; s=arc-20160816; b=OWvxP3ivWrGoX7XbW+6oERvW40Eso06DYlYbQCuDL13hkr1X2uquufXkGGioAS8sNb Xt8LW+u9Eg1+aJZVZ1F0655UUT4R+1BEvUnrEG8+kK6acGVcnLNRGPIT+Ax/qVOeL/xA 5Qeqpiz1eKlLbPm+FCVUuZ6moj4voCDmpTFxExa4xnC4stLzXVDCmnPytfwFErMSV+IK LiRgAFIrXkxBSZcA/xQmStctygdOSXouZfYyLoELx3A5VSLeRAECFwiadhFHAoN+caqA mEWg9tCgtMY8zo9MJFVnC4BYs/k00SKWqADxVZExhimwcJMRjrwnYsnulPxBwaI8JY5m pJIw== 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=7V2is5taoAz+wUF4ol0e21qRQd2Psb5gQv0NSVQ3eoE=; b=XQwfjPuJOXWxKRfvgSqgf64hWEfXLmflqYjDk0hFGsnRACJoD2NqLE7bqeRtWIHvhn ZODbB7K5+eYse6gnFAEAQnu5L3LEo/HG6qM9kUdraxWPgXvDei99vqOuEU0MJyHbr/0r bi7GnhmVdTNKCnUIeQ2GMgKKbFu9QL57Nm1FwcMyfQKL2Td/ZbfuRiH6tWUWgh1qwfRM 58NJq/eW+TUcp8FI1eDtS49zD7Koq4OpzctsIAlSmob9jjb31++knEqASd5TVbyQmwpQ r2Q0nvPLsmW/Ic7rRubTQYaal+4CH11qkIsLH+r8xQljGOivanEQZBSM2viJDPzSts/u VGgQ== 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 3si5951585pla.229.2018.01.09.02.57.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:32 -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 DD3F96E086; Tue, 9 Jan 2018 10:57: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 BC2D16E046 for ; Tue, 9 Jan 2018 10:57:03 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E67FF20741; 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 EBCA72081A; Tue, 9 Jan 2018 11:56:43 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 05/19] drm/vc4: Use the alpha format helper Date: Tue, 9 Jan 2018 11:56:24 +0100 Message-Id: <78890e262e8394b2319f15c11de3282a2a2a2efd.1515494838.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.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 core has a drm format helper to tell if a format embeds an alpha component in it, let's use it. Cc: Eric Anholt Signed-off-by: Maxime Ripard Reviewed-by: Eric Anholt --- drivers/gpu/drm/vc4/vc4_plane.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 423a23ed8fc2..2c0e25128dcd 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -85,40 +85,39 @@ static const struct hvs_format { u32 drm; /* DRM_FORMAT_* */ u32 hvs; /* HVS_FORMAT_* */ u32 pixel_order; - bool has_alpha; bool flip_cbcr; } hvs_formats[] = { { .drm = DRM_FORMAT_XRGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false, + .pixel_order = HVS_PIXEL_ORDER_ABGR, }, { .drm = DRM_FORMAT_ARGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, + .pixel_order = HVS_PIXEL_ORDER_ABGR, }, { .drm = DRM_FORMAT_ABGR8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ARGB, .has_alpha = true, + .pixel_order = HVS_PIXEL_ORDER_ARGB, }, { .drm = DRM_FORMAT_XBGR8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, - .pixel_order = HVS_PIXEL_ORDER_ARGB, .has_alpha = false, + .pixel_order = HVS_PIXEL_ORDER_ARGB, }, { .drm = DRM_FORMAT_RGB565, .hvs = HVS_PIXEL_FORMAT_RGB565, - .pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false, + .pixel_order = HVS_PIXEL_ORDER_XRGB, }, { .drm = DRM_FORMAT_BGR565, .hvs = HVS_PIXEL_FORMAT_RGB565, - .pixel_order = HVS_PIXEL_ORDER_XBGR, .has_alpha = false, + .pixel_order = HVS_PIXEL_ORDER_XBGR, }, { .drm = DRM_FORMAT_ARGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = true, + .pixel_order = HVS_PIXEL_ORDER_ABGR, }, { .drm = DRM_FORMAT_XRGB1555, .hvs = HVS_PIXEL_FORMAT_RGBA5551, - .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false, + .pixel_order = HVS_PIXEL_ORDER_ABGR, }, { .drm = DRM_FORMAT_YUV422, @@ -601,7 +600,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane, /* Position Word 2: Source Image Size, Alpha Mode */ vc4_state->pos2_offset = vc4_state->dlist_count; vc4_dlist_write(vc4_state, - VC4_SET_FIELD(format->has_alpha ? + VC4_SET_FIELD(drm_format_has_alpha(format->drm) ? SCALER_POS2_ALPHA_MODE_PIPELINE : SCALER_POS2_ALPHA_MODE_FIXED, SCALER_POS2_ALPHA_MODE) |