From patchwork Tue Jan 9 10:56:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123876 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305807edr; Tue, 9 Jan 2018 02:57:23 -0800 (PST) X-Google-Smtp-Source: ACJfBou29Dz7as4h3FAcGNp/CdW7rHUJ+bT7QWyvmecxHDXl1j2/YgKxB7xklc2RP4+ua1E7aSKJ X-Received: by 10.98.36.69 with SMTP id r66mr13194092pfj.96.1515495442941; Tue, 09 Jan 2018 02:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495442; cv=none; d=google.com; s=arc-20160816; b=fLm56DZtcjJ7W1yZHDn8u4yPTcCAnqhors5Pl/dYlTeJEhaLM4F83PcfrAM+2TOcwn 5gA+owKwcEe3G77we0ApwbRdFM5pV+1ODcs/WLRCic/QsgXxv17CxFLxobTzKFnN+qOD x20MGKS1m1TM6A3xCFU1MtDg21vRi83ZkMYBaDH/kRB60I95K41Ru/T9JEuqb75mp8cP XTUGJQSol1CoVThEoPHIR6abk1WXjZhlJXYvfPgQ1cK2xeMqhrGT1dZ0BV+9Rn05pKEM kOJWiq5r/QjcMP4zzAy9d4R+LCZNc/iPaJPpIzbCzZ91hs7ZeX45edhHFmzO4a+11Jyp 5auQ== 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=ThvE27PGy3mCZJLQmm59BmsX/6P8cGhjKKs0wS/Nryc=; b=YhbbadbDBPUXzPCZ8MAXUTvT0dXGFGoiL1eab5d8s7ynCw3JeIPK0dlsTPar1VqGTM qx73pmmiyTeSehhmC2lRU3VbYGjaNARb5PR8AQyR2NUrlSGZisq76nAZsYFPKetLFBpG e82+uJR+ftfWg3d53d6EP40i3Vlth+F6MILNIVqM79R89bPNoUyfG7h4VIxGkb9efZIN Ah9X8q8hYnCIJ+oz+zzGaSGU7zTBDinynfcnPNlIvQzttJZUPA5HQrneKYCX+m0NNAFE xxhQpltG6w6ndEc8k3BQoIKwsFY0hSh7LochlCvOC6vvurRp/EBU2RdgHTHcUqP+UgN1 Gx7w== 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 q7si10264115plk.225.2018.01.09.02.57.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:22 -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 330E26E067; Tue, 9 Jan 2018 10:57:05 +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 B765E6E04A for ; Tue, 9 Jan 2018 10:57:02 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 3D91F20725; 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 59BDB20741; 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 01/19] drm/fourcc: Add a function to tell if the format embeds alpha Date: Tue, 9 Jan 2018 11:56:20 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Thomas Petazzoni , Boris Brezillon , Seung-Woo Kim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kyungmin Park , Laurent Pinchart , Mark Yao , 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" There's a bunch of drivers that duplicate the same function to know if a particular format embeds an alpha component or not. Let's create a helper to avoid duplicating that logic. Cc: Boris Brezillon Cc: Eric Anholt Cc: Inki Dae Cc: Joonyoung Shim Cc: Kyungmin Park Cc: Laurent Pinchart Cc: Mark Yao Cc: Seung-Woo Kim Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_fourcc.c | 43 +++++++++++++++++++++++++++++++++++++- include/drm/drm_fourcc.h | 1 +- 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c index 9c0152df45ad..6e6227d6a46b 100644 --- a/drivers/gpu/drm/drm_fourcc.c +++ b/drivers/gpu/drm/drm_fourcc.c @@ -348,3 +348,46 @@ int drm_format_plane_height(int height, uint32_t format, int plane) return height / info->vsub; } EXPORT_SYMBOL(drm_format_plane_height); + +/** + * drm_format_has_alpha - get whether the format embeds an alpha component + * @format: pixel format (DRM_FORMAT_*) + * + * Returns: + * true if the format embeds an alpha component, false otherwise. + */ +bool drm_format_has_alpha(uint32_t format) +{ + switch (format) { + case DRM_FORMAT_ARGB4444: + case DRM_FORMAT_ABGR4444: + case DRM_FORMAT_RGBA4444: + case DRM_FORMAT_BGRA4444: + case DRM_FORMAT_ARGB1555: + case DRM_FORMAT_ABGR1555: + case DRM_FORMAT_RGBA5551: + case DRM_FORMAT_BGRA5551: + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_ABGR8888: + case DRM_FORMAT_RGBA8888: + case DRM_FORMAT_BGRA8888: + case DRM_FORMAT_ARGB2101010: + case DRM_FORMAT_ABGR2101010: + case DRM_FORMAT_RGBA1010102: + case DRM_FORMAT_BGRA1010102: + case DRM_FORMAT_AYUV: + case DRM_FORMAT_XRGB8888_A8: + case DRM_FORMAT_XBGR8888_A8: + case DRM_FORMAT_RGBX8888_A8: + case DRM_FORMAT_BGRX8888_A8: + case DRM_FORMAT_RGB888_A8: + case DRM_FORMAT_BGR888_A8: + case DRM_FORMAT_RGB565_A8: + case DRM_FORMAT_BGR565_A8: + return true; + + default: + return false; + } +} +EXPORT_SYMBOL(drm_format_has_alpha); diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h index 6942e84b6edd..e08fc22c5f78 100644 --- a/include/drm/drm_fourcc.h +++ b/include/drm/drm_fourcc.h @@ -69,5 +69,6 @@ int drm_format_vert_chroma_subsampling(uint32_t format); int drm_format_plane_width(int width, uint32_t format, int plane); int drm_format_plane_height(int height, uint32_t format, int plane); const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf); +bool drm_format_has_alpha(uint32_t format); #endif /* __DRM_FOURCC_H__ */ From patchwork Tue Jan 9 10:56:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123871 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305542edr; Tue, 9 Jan 2018 02:57:05 -0800 (PST) X-Google-Smtp-Source: ACJfBosYjEqdCYwCisLS7MwuhhiHnKZOZbs6d4IhsQSbFzeBppjlr6f5G3yVO/VnN+FM8bAKpFud X-Received: by 10.159.235.130 with SMTP id f2mr15495189plr.43.1515495424968; Tue, 09 Jan 2018 02:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495424; cv=none; d=google.com; s=arc-20160816; b=zd0dI6QHORtUainuE1uDL1TxZYon5hAvJL03hZVlQn5hvi7bDLDBP+r6tIYd0/pb6m CdAniGvOFJ2SlzHTv9c/lPQs4UOMsXcmq3zG314GRvutdu1rWdkVeD7WmFNHArWBiFxL nQlAI8J2BZhMCSrehbQYTAQL/1SV+0R19HtK+oiefPN5mC7DYmtHTYDobaLgw+lSrcvW 9pbQzcmfNPy2K2oH7EfV4z+EQO8rnd0WzIBexvo2S4IOCI7HtbV6Pu02QCDp+THg6tRd p+wzhIN//jOnVbrpF6iTtgsaw5rkXtpQ5PqL3Nr36cZAdsgF8dopNhNdFmdow+S1Zxyd 1teQ== 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=6eUC4xTn3jqFs9VhhNwETpQFf5QZ0oIKDSsMMIbJb44=; b=J/OQvVlQMEEISIdKANQAh/LO+h9GV0hCNR+AuZtOfAcrDhaAoKT1PC1ZWptprlmE6l mSvjjqdciiuQC/4CCV8l76tHPbM04iL1NuFVVymUNHmeHjJlJfWCdOPiqmKjtczqHbSV a8Ip/CPdKaZ8IAQ7/bBEe2JwUS8od7pqj/PXMNrNZqLA1dDDXx3Y9jZ9siPEyij2ld2b iLNkfEXopHp6aYc6qC9h8ZiAaqV2+GxCHkyNeE/cTfRwuZeCmiWZBm9UcfF114uOokNA 7VNDemhJTh5qxQoclt/PrvVtaxeCIJ8eiWJiLnSQIa7WR/IU6UwHrufULn93J8K0Tx92 IrNg== 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 u91si10252150plb.50.2018.01.09.02.57.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:04 -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 F1B966E059; Tue, 9 Jan 2018 10:57:03 +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 0B6066E046 for ; Tue, 9 Jan 2018 10:57:03 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 863B120727; 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 29DEC207AA; 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 03/19] drm/exynos: Use the alpha format helper Date: Tue, 9 Jan 2018 11:56:22 +0100 Message-Id: <345b8966460f13af7e29d2700876572d34f06cf4.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 , Seung-Woo Kim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kyungmin Park , 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: Inki Dae Cc: Joonyoung Shim Cc: Kyungmin Park Cc: Seung-Woo Kim Signed-off-by: Maxime Ripard Acked-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_mixer.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index dc5d79465f9b..d7339a6d072c 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -179,18 +179,6 @@ static const u8 filter_cr_horiz_tap4[] = { 70, 59, 48, 37, 27, 19, 11, 5, }; -static inline bool is_alpha_format(unsigned int pixel_format) -{ - switch (pixel_format) { - case DRM_FORMAT_ARGB8888: - case DRM_FORMAT_ARGB1555: - case DRM_FORMAT_ARGB4444: - return true; - default: - return false; - } -} - static inline u32 vp_reg_read(struct mixer_context *ctx, u32 reg_id) { return readl(ctx->vp_regs + reg_id); @@ -625,7 +613,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(ctx, MXR_GRAPHIC_BASE(win), dma_addr); mixer_cfg_layer(ctx, win, priority, true); - mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->format->format)); + mixer_cfg_gfx_blend(ctx, win, drm_format_has_alpha(fb->format->format)); /* layer update mandatory for mixer 16.0.33.0 */ if (ctx->mxr_ver == MXR_VER_16_0_33_0 || From patchwork Tue Jan 9 10:56:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123873 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305672edr; Tue, 9 Jan 2018 02:57:14 -0800 (PST) X-Google-Smtp-Source: ACJfBosswt47JM3NKUBsxARDptjyapAR7g4xrkBchNXKdMi9H+ZjHkoXhs0VLrx3j1V13n4Bp0fu X-Received: by 10.159.230.13 with SMTP id u13mr262359plq.114.1515495433998; Tue, 09 Jan 2018 02:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495433; cv=none; d=google.com; s=arc-20160816; b=dJdeba2G+GjSAERiwTYJxnDp+4JGs0uP9mhNaHy+e7VeS5F/wiGXDfAzoWWdavq58n gYjv4javGDu0p7gcpHQtlIqNK8URQtH8Fob1jcG/2ivvp39kQTk1f/mygIgglQwxjrIc wRbcWjTLi4kH3zHl9MvzhkRzQL4oM47oLV8DrHv98LLaz8TNKp5VSuCgRNHJm9wKO5nX CbvkqF2Sly8YWbeZHdS716ggGJdz564o+ofthLsI/9S1ctUWGXGuztr+9YJ8O6D/gwTQ YwfurLWLXtrJbhYgd5RHOyrp6iI4vI3qLWeBka+5sgGPxp8VJj7RIJgftIu07nCfj7ks PxgQ== 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=FaTSOD06rq2Dj/x2CwVHBz8M17uT/yE4DLn8yXVllFE=; b=rDrrlJliCmoI7k5MfejKXAf4i7O8YSVvpGIK1D2Sg+EvaV0pvCCQd+2SU38WHIbEwO 4KXEZXqgvr2QamC6/i4m+csoQ+5jT58Go5am+FoD5vxyAdNjcK3uMd8XZH+2hBlWfT/x X6/fdmlhlnslIG59VNct0qFDuWJ8hxPToO/zMUm0Kfii7uUsPiX3fOYUS8tniXEYKGoE 9g0THqXxmJA3YPYhTUGwzgJ+NNTX+lhutOCFmMeAG46JOQMA4snGYx42FDy1xKZDmPx2 tw2gGnLOkLqB2Gy02/9RORmJ51OvVMj7lPmW9KakRWSZAU8myvwHogQQboFL+t8fDsQU 7DYg== 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 t2si8932184pgr.148.2018.01.09.02.57.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:13 -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 33F1F6E04E; Tue, 9 Jan 2018 10:57:04 +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 193536E04E for ; Tue, 9 Jan 2018 10:57:03 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 8D76E2072D; 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 8E339207D8; 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 04/19] drm/rockchip: Use the alpha format helper Date: Tue, 9 Jan 2018 11:56:23 +0100 Message-Id: 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, thomas@vitsch.nl, linux-arm-kernel@lists.infradead.org, Mark Yao 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: Mark Yao Signed-off-by: Maxime Ripard Acked-by: Sandy huang --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 19128b4dea54..cfc4d4909185 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -253,17 +253,6 @@ static bool is_yuv_support(uint32_t format) } } -static bool is_alpha_support(uint32_t format) -{ - switch (format) { - case DRM_FORMAT_ARGB8888: - case DRM_FORMAT_ABGR8888: - return true; - default: - return false; - } -} - static uint16_t scl_vop_cal_scale(enum scale_mode mode, uint32_t src, uint32_t dst, bool is_horizontal, int vsu_mode, int *vskiplines) @@ -790,7 +779,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane, rb_swap = has_rb_swapped(fb->format->format); VOP_WIN_SET(vop, win, rb_swap, rb_swap); - if (is_alpha_support(fb->format->format)) { + if (drm_format_has_alpha(fb->format->format)) { VOP_WIN_SET(vop, win, dst_alpha_ctl, DST_FACTOR_M0(ALPHA_SRC_INVERSE)); val = SRC_ALPHA_EN(1) | SRC_COLOR_M0(ALPHA_SRC_PRE_MUL) | 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) | From patchwork Tue Jan 9 10:56:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123885 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306434edr; Tue, 9 Jan 2018 02:58:15 -0800 (PST) X-Google-Smtp-Source: ACJfBot4Ey8Pg+HM7RvyeGXxQ1C5NCUVoSFIC9Z7N25OYEntkvuxCpzTBu3USoK7yW4I/NnmrULl X-Received: by 10.159.242.136 with SMTP id u8mr9564609plr.291.1515495494974; Tue, 09 Jan 2018 02:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495494; cv=none; d=google.com; s=arc-20160816; b=gmje/2LgBMR4gwwmLVXBHP8MrAzStCvs+N44R4oktumQB9499YWIEI6KQ51ooZ19K9 NH5vG1HPep8EqhHpERDHrUNFdYl3CCgMWc9KvuAbRR6gNlukn+hFTdslslCmhYJoqgXp F7XdaNYuMzHoEJgm5XPS25VWEBmRdJ7yiLgmopcENRZ7Li6FGAegtSsG26GtJXwvMTzv jbG05enMCqupoO8+77GW9sC3svgopI+TjhhtZjL+GXzYEol8cpEP5+uLIuQF6XmQfQin i3pQDXFn57zwcdShBYFMzON3mVwcnfB7WFkNEOyFmtq6tC/4yAQorL65nsMRoFD84HJT VKZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:cc :references:in-reply-to:mime-version:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=42Q0f4L6aBL+ViKcKh/xjtKnPBezqHOWvI0pJVSfT0g=; b=eoLfPudAIa1/JZQo/XioVGUo3IVfiRc8nXPdUY3R2qIjH639VSJK/oieOisO2ikeMi wE7YkFPlZkDmZjJH54QYCS5q14V73Epxx+tl+ebKbK7R3UHh+5wRdrGkkA61EBKn91b9 1qWvew55N+O4ZMCD4wPBqIu5C9wXfd5qfzSl/zRFFjjEH0XZhUeC8asE0l9tjiwPdF6v 9+flAfp6H2PCM2tcPNoFDw0ph0b2F2RDlioAcYLjxI2dACuFW3R/3z4LTBUWPGIU+jKz vm2Owby0PSU39TYydwo1mHggGDtHk+TlLW0CkAFkiZc8OeVDULijbBh0jLucCiQ48k4A e8Lg== 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 n10si10125252plp.158.2018.01.09.02.58.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:58:14 -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 D10366E0A9; Tue, 9 Jan 2018 10:57:09 +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 BC6036E04A for ; Tue, 9 Jan 2018 10:57:03 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id EEB9F2074A; 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 4994E2082B; Tue, 9 Jan 2018 11:56:44 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 06/19] drm/blend: Add a generic alpha property Date: Tue, 9 Jan 2018 11:56:25 +0100 Message-Id: <5c765fc730d75cb362dc37bcdb3b3aeacc7bdb30.1515494838.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Cc: Thomas Petazzoni , Boris Brezillon , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some drivers duplicate the logic to create a property to store a per-plane alpha. Let's create a helper in order to move that to the core. Cc: Boris Brezillon Cc: Laurent Pinchart Signed-off-by: Maxime Ripard --- Documentation/gpu/kms-properties.csv | 2 +- drivers/gpu/drm/drm_atomic.c | 4 ++++- drivers/gpu/drm/drm_atomic_helper.c | 1 +- drivers/gpu/drm/drm_blend.c | 32 +++++++++++++++++++++++++++++- include/drm/drm_blend.h | 1 +- include/drm/drm_plane.h | 6 +++++- 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Documentation/gpu/kms-properties.csv b/Documentation/gpu/kms-properties.csv index 927b65e14219..a3c3969c1992 100644 --- a/Documentation/gpu/kms-properties.csv +++ b/Documentation/gpu/kms-properties.csv @@ -99,5 +99,5 @@ radeon,DVI-I,“coherent”,RANGE,"Min=0, Max=1",Connector,TBD ,,"""underscan vborder""",RANGE,"Min=0, Max=128",Connector,TBD ,Audio,“audio”,ENUM,"{ ""off"", ""on"", ""auto"" }",Connector,TBD ,FMT Dithering,“dither”,ENUM,"{ ""off"", ""on"" }",Connector,TBD -rcar-du,Generic,"""alpha""",RANGE,"Min=0, Max=255",Plane,TBD +,,"""alpha""",RANGE,"Min=0, Max=255",Plane,Opacity of the plane from transparent (0) to opaque (255) ,,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index c2da5585e201..ade18cf62c89 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -749,6 +749,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->src_w = val; } else if (property == config->prop_src_h) { state->src_h = val; + } else if (property == plane->alpha_property) { + state->alpha = val; } else if (property == plane->rotation_property) { if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) return -EINVAL; @@ -810,6 +812,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->src_w; } else if (property == config->prop_src_h) { *val = state->src_h; + } else if (property == plane->alpha_property) { + *val = state->alpha; } else if (property == plane->rotation_property) { *val = state->rotation; } else if (property == plane->zpos_property) { diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 71d712f1b56a..018993df4c18 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3372,6 +3372,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane) if (plane->state) { plane->state->plane = plane; + plane->state->alpha = 255; plane->state->rotation = DRM_MODE_ROTATE_0; } } diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index 2e5e089dd912..8eea2a8af458 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -104,6 +104,38 @@ */ /** + * drm_plane_create_alpha_property - create a new alpha property + * @plane: drm plane + * @alpha: initial value of alpha, from 0 (transparent) to 255 (opaque) + * + * This function initializes a generic, mutable, alpha property and + * enables support for it in the DRM core. + * + * Drivers can then attach this property to their plane to enable + * support for configurable plane alpha. + * + * Returns: + * 0 on success, negative error code on failure. + */ +int drm_plane_create_alpha_property(struct drm_plane *plane, u8 alpha) +{ + struct drm_property *prop; + + prop = drm_property_create_range(plane->dev, 0, "alpha", 0, 255); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&plane->base, prop, alpha); + plane->alpha_property = prop; + + if (plane->state) + plane->state->alpha = alpha; + + return 0; +} +EXPORT_SYMBOL(drm_plane_create_alpha_property); + +/** * drm_plane_create_rotation_property - create a new rotation property * @plane: drm plane * @rotation: initial value of the rotation property diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h index 17606026590b..5979a8fce453 100644 --- a/include/drm/drm_blend.h +++ b/include/drm/drm_blend.h @@ -36,6 +36,7 @@ static inline bool drm_rotation_90_or_270(unsigned int rotation) return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270); } +int drm_plane_create_alpha_property(struct drm_plane *plane, u8 alpha); int drm_plane_create_rotation_property(struct drm_plane *plane, unsigned int rotation, unsigned int supported_rotations); diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 571615079230..a5e26064b132 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -42,6 +42,7 @@ struct drm_modeset_acquire_ctx; * plane (in 16.16) * @src_w: width of visible portion of plane (in 16.16) * @src_h: height of visible portion of plane (in 16.16) + * @alpha: opacity of the plane * @rotation: rotation of the plane * @zpos: priority of the given plane on crtc (optional) * Note that multiple active planes on the same crtc can have an identical @@ -105,6 +106,9 @@ struct drm_plane_state { uint32_t src_x, src_y; uint32_t src_h, src_w; + /* Plane opacity */ + u8 alpha; + /* Plane rotation */ unsigned int rotation; @@ -481,6 +485,7 @@ enum drm_plane_type { * @funcs: helper functions * @properties: property tracking for this plane * @type: type of plane (overlay, primary, cursor) + * @alpha_property: alpha property for this plane * @zpos_property: zpos property for this plane * @rotation_property: rotation property for this plane * @helper_private: mid-layer private data @@ -546,6 +551,7 @@ struct drm_plane { */ struct drm_plane_state *state; + struct drm_property *alpha_property; struct drm_property *zpos_property; struct drm_property *rotation_property; }; From patchwork Tue Jan 9 10:56:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123880 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306023edr; Tue, 9 Jan 2018 02:57:39 -0800 (PST) X-Google-Smtp-Source: ACJfBot/MVPatjr7pzhna7uqpSoiXCP9zZ7P4zuFmi9OR0rnkd7ioZ7T8t2dqRNyAlMWoVdu8F6v X-Received: by 10.98.11.83 with SMTP id t80mr13111368pfi.99.1515495459747; Tue, 09 Jan 2018 02:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495459; cv=none; d=google.com; s=arc-20160816; b=QO5HLOGvTqFDmQ2iq7fS/aGHSjpIwPJmCszq8oQIX6cV9V23ypjIrRicWB783LxLxE DeXOBz/RoGkhoaHDCNC+g+gGtp4xlm2CaTPqu9AIBmbZA1e0fIrOpJHaW4Mq1GO453R+ 7HSQY3v0Bsbn8+utidutTd6+Ns2md3513dDKxFQVMkOZG+vqhvLHUCu2Pr4oVHmNwQ1K XDNeEkCVrYglHsBMN5JY7zHR5LVz3GHtfGiwdjpq1sr2SkYsRLwT/Am+N96CqrbiQqll nI/+U5nRv5Xhr7hfFUqz0Vnh5B19fFB06Bblt1dfq4WMyvRpoe6LbvoJk8ldbRGOwOBN QbvQ== 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=/w9K9ImDL55PHVJsjis9ak3QW50P0zC8Zum9D0xFHPc=; b=T6ndJQ/xWVCo/jPlP1nsG+vzwmlqCZY5GCJKEpB3HcWKlOxcZhwALW4dw6XRDKOut9 CxiKlnBcuYVTSkM574+lqNVDc2YSWe4niWPkxf6M9sPKR1D9FJEq26KMRFT05ClqBIq4 DlSikL4EBO4zFVNboH1nFGiNrsO2Ztgd8SEIWIM1wk0hEnKhpUAuB3o67QU2wGxajVAx xmKc4hpdF81KM7mzlf1+mMX7cZnbrrwYjDH9qqMHqEvYplSqIBgFFx+QWbuvJeefra6O yqEM/9eu5uCaXJUlylTHtfF/m+I90eTYS0LJSD9aZKc6zp9dkqcrlV48GpURElliKgKe pxwQ== 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 f6si2983597pgn.797.2018.01.09.02.57.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:39 -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 52B9A6E0A3; Tue, 9 Jan 2018 10:57:09 +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 BCE886E054 for ; Tue, 9 Jan 2018 10:57:03 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 30C82207AA; Tue, 9 Jan 2018 11:57:02 +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 AB3E62082F; Tue, 9 Jan 2018 11:56:44 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 07/19] drm/atmel-hclcdc: Convert to the new generic alpha property Date: Tue, 9 Jan 2018 11:56:26 +0100 Message-Id: <87b4f265eaade03c5afdbd55a46851bbe4d8d2fe.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 , Boris Brezillon , 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 we have support for per-plane alpha in the core, let's use it. Cc: Boris Brezillon Signed-off-by: Maxime Ripard --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h | 13 +--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 89 ++---------------- 2 files changed, 14 insertions(+), 88 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h index 6833ee253cfa..704cac6399eb 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h @@ -298,7 +298,6 @@ struct atmel_hlcdc_layer { struct atmel_hlcdc_plane { struct drm_plane base; struct atmel_hlcdc_layer layer; - struct atmel_hlcdc_plane_properties *properties; }; static inline struct atmel_hlcdc_plane * @@ -345,18 +344,6 @@ struct atmel_hlcdc_dc_desc { }; /** - * Atmel HLCDC Plane properties. - * - * This structure stores plane property definitions. - * - * @alpha: alpha blending (or transparency) property - * @rotation: rotation property - */ -struct atmel_hlcdc_plane_properties { - struct drm_property *alpha; -}; - -/** * Atmel HLCDC Display Controller. * * @desc: HLCDC Display Controller description diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 1a9318810a29..dbc508889e87 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -31,7 +31,6 @@ * @src_y: y buffer position * @src_w: buffer width * @src_h: buffer height - * @alpha: alpha blending of the plane * @disc_x: x discard position * @disc_y: y discard position * @disc_w: discard width @@ -54,8 +53,6 @@ struct atmel_hlcdc_plane_state { uint32_t src_w; uint32_t src_h; - u8 alpha; - int disc_x; int disc_y; int disc_w; @@ -385,7 +382,7 @@ atmel_hlcdc_plane_update_general_settings(struct atmel_hlcdc_plane *plane, cfg |= ATMEL_HLCDC_LAYER_LAEN; else cfg |= ATMEL_HLCDC_LAYER_GAEN | - ATMEL_HLCDC_LAYER_GA(state->alpha); + ATMEL_HLCDC_LAYER_GA(state->base.alpha); } if (state->disc_h && state->disc_w) @@ -553,7 +550,7 @@ atmel_hlcdc_plane_prepare_disc_area(struct drm_crtc_state *c_state) if (!ovl_s->fb || drm_format_has_alpha(ovl_s->fb->format->format) || - ovl_state->alpha != 255) + ovl_s->alpha != 255) continue; /* TODO: implement a smarter hidden area detection */ @@ -829,51 +826,18 @@ static void atmel_hlcdc_plane_destroy(struct drm_plane *p) drm_plane_cleanup(p); } -static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p, - struct drm_plane_state *s, - struct drm_property *property, - uint64_t val) -{ - struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); - struct atmel_hlcdc_plane_properties *props = plane->properties; - struct atmel_hlcdc_plane_state *state = - drm_plane_state_to_atmel_hlcdc_plane_state(s); - - if (property == props->alpha) - state->alpha = val; - else - return -EINVAL; - - return 0; -} - -static int atmel_hlcdc_plane_atomic_get_property(struct drm_plane *p, - const struct drm_plane_state *s, - struct drm_property *property, - uint64_t *val) -{ - struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); - struct atmel_hlcdc_plane_properties *props = plane->properties; - const struct atmel_hlcdc_plane_state *state = - container_of(s, const struct atmel_hlcdc_plane_state, base); - - if (property == props->alpha) - *val = state->alpha; - else - return -EINVAL; - - return 0; -} - -static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane, - struct atmel_hlcdc_plane_properties *props) +static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane) { const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc; if (desc->type == ATMEL_HLCDC_OVERLAY_LAYER || - desc->type == ATMEL_HLCDC_CURSOR_LAYER) - drm_object_attach_property(&plane->base.base, - props->alpha, 255); + desc->type == ATMEL_HLCDC_CURSOR_LAYER) { + int ret; + + ret = drm_plane_create_alpha_property(&plane->base, 255); + if (ret) + return ret; + } if (desc->layout.xstride && desc->layout.pstride) { int ret; @@ -988,8 +952,8 @@ static void atmel_hlcdc_plane_reset(struct drm_plane *p) return; } - state->alpha = 255; p->state = &state->base; + p->state->alpha = 255; p->state->plane = p; } } @@ -1042,13 +1006,10 @@ static const struct drm_plane_funcs layer_plane_funcs = { .reset = atmel_hlcdc_plane_reset, .atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state, .atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state, - .atomic_set_property = atmel_hlcdc_plane_atomic_set_property, - .atomic_get_property = atmel_hlcdc_plane_atomic_get_property, }; static int atmel_hlcdc_plane_create(struct drm_device *dev, - const struct atmel_hlcdc_layer_desc *desc, - struct atmel_hlcdc_plane_properties *props) + const struct atmel_hlcdc_layer_desc *desc) { struct atmel_hlcdc_dc *dc = dev->dev_private; struct atmel_hlcdc_plane *plane; @@ -1060,7 +1021,6 @@ static int atmel_hlcdc_plane_create(struct drm_device *dev, return -ENOMEM; atmel_hlcdc_layer_init(&plane->layer, desc, dc->hlcdc->regmap); - plane->properties = props; if (desc->type == ATMEL_HLCDC_BASE_LAYER) type = DRM_PLANE_TYPE_PRIMARY; @@ -1081,7 +1041,7 @@ static int atmel_hlcdc_plane_create(struct drm_device *dev, &atmel_hlcdc_layer_plane_helper_funcs); /* Set default property values*/ - ret = atmel_hlcdc_plane_init_properties(plane, props); + ret = atmel_hlcdc_plane_init_properties(plane); if (ret) return ret; @@ -1090,34 +1050,13 @@ static int atmel_hlcdc_plane_create(struct drm_device *dev, return 0; } -static struct atmel_hlcdc_plane_properties * -atmel_hlcdc_plane_create_properties(struct drm_device *dev) -{ - struct atmel_hlcdc_plane_properties *props; - - props = devm_kzalloc(dev->dev, sizeof(*props), GFP_KERNEL); - if (!props) - return ERR_PTR(-ENOMEM); - - props->alpha = drm_property_create_range(dev, 0, "alpha", 0, 255); - if (!props->alpha) - return ERR_PTR(-ENOMEM); - - return props; -} - int atmel_hlcdc_create_planes(struct drm_device *dev) { struct atmel_hlcdc_dc *dc = dev->dev_private; - struct atmel_hlcdc_plane_properties *props; const struct atmel_hlcdc_layer_desc *descs = dc->desc->layers; int nlayers = dc->desc->nlayers; int i, ret; - props = atmel_hlcdc_plane_create_properties(dev); - if (IS_ERR(props)) - return PTR_ERR(props); - dc->dscrpool = dmam_pool_create("atmel-hlcdc-dscr", dev->dev, sizeof(struct atmel_hlcdc_dma_channel_dscr), sizeof(u64), 0); @@ -1130,7 +1069,7 @@ int atmel_hlcdc_create_planes(struct drm_device *dev) descs[i].type != ATMEL_HLCDC_CURSOR_LAYER) continue; - ret = atmel_hlcdc_plane_create(dev, &descs[i], props); + ret = atmel_hlcdc_plane_create(dev, &descs[i]); if (ret) return ret; } From patchwork Tue Jan 9 10:56:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123868 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305430edr; Tue, 9 Jan 2018 02:56:55 -0800 (PST) X-Google-Smtp-Source: ACJfBovFI9koPMNydStjMh1+Ecf6Xe6y1iPmOPBYrxrsbo0ni3SPkD6P0iE8xjAWBCFStmjhF2EN X-Received: by 10.99.155.2 with SMTP id r2mr12310252pgd.422.1515495415831; Tue, 09 Jan 2018 02:56:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495415; cv=none; d=google.com; s=arc-20160816; b=NW82kqp3o4AXXirak90nMZcelM0ixZjMKgC6o1eYNzGXHF9mHkL8cGFHZnB49qjHi2 kldEtV3WF5FDbrNcFhlyO2C8uINyT2HvayRLX+q3JR4Fnsf9PGrN14lvj0lGm5l5SOn6 uXEkOufpvsN2ZHFRFg1ewyGRFZmjfJ/qhN3no3p2lAnh7tNr/Z8Tshsqn+1IKYP94qUK Vx2Ha8hlk/AbXTut2BAnSJqJxtv9aHC0nf97HM2hgAjTdksvQzRDF0wDYXVORJGimTo3 zzI8+nwEg1wNwshIOkv2u1giVtOJOVdxSZm1e2IV6jgTBjhTyb6DjRg3g8jLfke7LnyO 3LgA== 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=ctYKxXrKixuSLfQPW/ltFwJQlh97OqNfc47esTg9iiE=; b=TNuFZ00LI2K9uqYwGZuWEGEXNn20mdnKwk3vUVjtZV22E9+62cHYvrDvWcRnTze2Mj iqb6KfOUGJPRKnr00Txa1bUH4+TLTOsEJf7T5V0cjMj0ItUI1TVvJn6sAgKor0Z93BPV lNPYjZ5cMrFbeHFJvb+CeX4/mfvN2xehuS8cci02qaNRJ+lgoDPbck7bJklkQq2U6T2u 1GbRrjVbMqc+nXbF2r0yw2eb5HKNP3DXLovWF4d/smgAc5ECwKJCyskux+JPV8dLevvR VdcxcCDta/qvcWjnhzVOlY6dJsx3pP9l4M5fdqD6O5kMhib8ljLXFTBCdUuCiYfyKerv 4n7g== 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 c13si8857534pgu.658.2018.01.09.02.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:56:55 -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 D13FE89D60; Tue, 9 Jan 2018 10:56:53 +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 F24D289E0E for ; Tue, 9 Jan 2018 10:56:52 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 715542037C; Tue, 9 Jan 2018 11:56:51 +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 406462037C; Tue, 9 Jan 2018 11:56:41 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 10/19] drm/sun4i: backend: Fix define typo Date: Tue, 9 Jan 2018 11:56:29 +0100 Message-Id: <47be05d234208a6b206fe4585420b3c32695ee79.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: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" There was a typo in the width spelling of the (unused) SUN4I_BACKEND_IYUVLINEWITDTH_REG macro. Fix it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index b5edf2d50a24..1ca8b7db6807 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -112,7 +112,9 @@ #define SUN4I_BACKEND_SPRALPHACTL_REG 0x90c #define SUN4I_BACKEND_IYUVCTL_REG 0x920 #define SUN4I_BACKEND_IYUVADD_REG(c) (0x930 + (0x4 * (c))) -#define SUN4I_BACKEND_IYUVLINEWITDTH_REG(c) (0x940 + (0x4 * (c))) + +#define SUN4I_BACKEND_IYUVLINEWIDTH_REG(c) (0x940 + (0x4 * (c))) + #define SUN4I_BACKEND_YGCOEF_REG(c) (0x950 + (0x4 * (c))) #define SUN4I_BACKEND_YGCONS_REG 0x95c #define SUN4I_BACKEND_URCOEF_REG(c) (0x960 + (0x4 * (c))) From patchwork Tue Jan 9 10:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123887 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306878edr; Tue, 9 Jan 2018 02:58:48 -0800 (PST) X-Google-Smtp-Source: ACJfBot+QSJ2GIFGPTAmGXu8ZmZcURyohvhvL+R3i3otcFxCnwqT4LcP2fn+IS7EG7gncELwFk9Y X-Received: by 10.84.231.22 with SMTP id f22mr15159126plk.442.1515495528475; Tue, 09 Jan 2018 02:58:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495528; cv=none; d=google.com; s=arc-20160816; b=YJXP8zTYf5Jy0OZGvuOk6WMRcB9cqLXTpkQ6rJdACIjau1yWHs4VfBP6kkFWJrvx0m Iiw4axLuvuM8mQFyXKTOVosCKn5ug62qneAjZ29UbhbbV2iOzXalT6cJghSd9BdZBh7r XtBKHmRB+L6gxsExMNdbL64sJewT3qDs2psEIh0I6quVubdIINEcj9w1NMXgfKyPNXnn z4SAMgmegCBP7V3P+eyq9zcBDwMjeI+Pvtg46cunqBXOaCavygytwZv8IvcFTnSvg7bV oHPnmwM68AARZRWPI+rI0tYeReDYLnlDROnQtziQ093ZywB5hUmu5A1MiLAjVElhDa20 I4YA== 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=RwZllol2Ak2yfMl6xuEo/JOS0jN28m4Bpx2FwLQ4xwA=; b=taLHz9jJRrBI2z3Kj+YBFilPcvjem7ApYIoiHQFdwvksRW0q9yAdUqyJrV+pXoDbTs qMN8ZZJjuVzpZ0pRbXWrY4WBbY/SaH+a6QczFdsXVU47Ny8M0gwUiaNfniiFfF56ZHgz 2mYoo2FO+PIR1Qg5XZX+nYnXfkEruQsSp96iZqrIR+GzALsJCVexO0S35gwsWRDaucuv NWplk1o8oUOWzvPj2t/xV0HAbK260G/7DbZgjp42tbCvVu8ktGTzrHjHm4PomAMFS4Rl 2cPPD6DeW6yoldyy6ZHtvZiL0Az9eHRE4FPuDc6SbdiAQC/FzGlUHxrRTqDsFC55GrRg ta3g== 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 o13si8865661pgd.463.2018.01.09.02.58.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:58:48 -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 2A5206E0CD; Tue, 9 Jan 2018 10:57:14 +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 80D2F6E0C6 for ; Tue, 9 Jan 2018 10:57:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 0542320974; Tue, 9 Jan 2018 11:57:11 +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 4F36F20993; Tue, 9 Jan 2018 11:56:48 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 13/19] drm/sun4i: backend: Set a default zpos in our reset hook Date: Tue, 9 Jan 2018 11:56:32 +0100 Message-Id: <63f77d84e998ae7b9a1a583de94c1a5c13cb10cb.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: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" The our plane state zpos value will be set only if there's an existing state attached to the plane when creating the property. However, this is not the case during the probe, and we therefore need to put our default value in our reset hook. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_layer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index c448cb6b9fa9..03549646528a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -28,6 +28,7 @@ struct sun4i_plane_desc { static void sun4i_backend_layer_reset(struct drm_plane *plane) { + struct sun4i_layer *layer = plane_to_sun4i_layer(plane); struct sun4i_layer_state *state; if (plane->state) { @@ -43,6 +44,7 @@ static void sun4i_backend_layer_reset(struct drm_plane *plane) if (state) { plane->state = &state->state; plane->state->plane = plane; + plane->state->zpos = layer->id; } } From patchwork Tue Jan 9 10:56:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123879 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp305976edr; Tue, 9 Jan 2018 02:57:36 -0800 (PST) X-Google-Smtp-Source: ACJfBovYgpRh3eGGNN8h7vJLGUcCpiXamMiwqYPiOxr9DiEJPDKRuO+WlQ5zT05x+ZP35zqiFiUb X-Received: by 10.101.80.74 with SMTP id k10mr12300989pgo.246.1515495456172; Tue, 09 Jan 2018 02:57:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495456; cv=none; d=google.com; s=arc-20160816; b=P0SEAh3rQJd84cC1iKoVFTyOT++WSWaa0ywLmnhvSQaah8C3xz8Ca8PjYhNMmjghou 6y0ZASuiTH3fMBqTTRfX7XtB5nUqzhhQLlkY3rrs4EsnBQOtT2iKC236m5IZMwEssVgC jV15R6V9rmTcwnRMNOmnMCrSd/TF/25dk39TYs60yZll3UE6GLtvZsJ5oQDCjmsj6ZMd tpFaXyXnTD55uclTDcX26nCXmuJ8lTjkWE+tZFBDFnPEvp3gJGyE4ye2UVSaddwJpTyk ebCjlqfK8aDrMiLzs7GtH2GZEkzG+d2aETsvMvGO9/8NAgewDGz17Fbsb64CnrXXXorR 0/Fw== 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=g+E71E2JI9WDeCc+CBIzFr0TCBwtCQQGGw5Bwu8/ByY=; b=tnos4V6432kgpvfeclGFeFEvuWTM2prxGeLmLTWoUTZW3zrYAPkBYzcJL3e/iJ/p3S lkVXAotCFwcsSBh8o2gQEMymGCZ6BqzVSx2eWePEAZRR+iONcrdAppl6ndFRHznVipOv YvYF9vRCCTKW/pYdgx/PBU7lCvm1VYaGdp/0tA1/Ydz81q8kxNVq/ICytgp2Aw+ablX6 Ex/iRvAZW0l8Pn+4XJXvEuCMoZWRYqm81DgmV55nzjyTkmEfHZTQS6WQ7jGmfdmF82xL 9qLazav0k0V9K6wJ76NxrvhmyXj7D88gXtsYonRlsU0ui+YA4TTIFnz+38gVol3kdXI1 wndQ== 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 l1si10191186pld.20.2018.01.09.02.57.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:57:36 -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 165CD6E095; Tue, 9 Jan 2018 10:57:07 +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 4BCFB6E075 for ; Tue, 9 Jan 2018 10:57:05 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id BE2EC2082B; Tue, 9 Jan 2018 11:57:03 +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 066E920938; Tue, 9 Jan 2018 11:56:46 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 14/19] drm/sun4i: backend: Add support for zpos Date: Tue, 9 Jan 2018 11:56:33 +0100 Message-Id: <80dd87e70ba86233e250566a6f628a624c5b2868.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: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" Our various planes have a configurable zpos, that combined with the pipes allow to configure the composition. Since the interaction between the pipes, zpos and alphas framebuffers are not trivials, let's just enable the zpos as an immutable property for now, and use that zpos in our atomic_update part. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 15 +++++++++++++++ drivers/gpu/drm/sun4i/sun4i_backend.h | 2 ++ drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 ++++ drivers/gpu/drm/sun4i/sun4i_layer.c | 3 +++ 4 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index a18c86a15748..c4986054909b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -272,6 +272,21 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, return 0; } +int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, + struct drm_plane *plane) +{ + struct drm_plane_state *state = plane->state; + unsigned int priority = state->normalized_zpos; + + DRM_DEBUG_DRIVER("Setting layer %d priority to %d\n", layer, priority); + + regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), + SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL_MASK, + SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL(priority)); + + return 0; +} + static bool sun4i_backend_plane_uses_scaler(struct drm_plane_state *state) { u16 src_h = state->src_h >> 16; diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index 1ca8b7db6807..04a4f11b87a8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -182,5 +182,7 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, int layer, struct drm_plane *plane); int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend, int layer, uint32_t in_fmt); +int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, + int layer, struct drm_plane *plane); #endif /* _SUN4I_BACKEND_H_ */ diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c index e68004844abe..5b3986437a50 100644 --- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c +++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c @@ -35,6 +35,10 @@ static int sun4i_de_atomic_check(struct drm_device *dev, if (ret) return ret; + ret = drm_atomic_normalize_zpos(dev, state); + if (ret) + return ret; + return drm_atomic_helper_check_planes(dev, state); } diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 03549646528a..fbf25d59cf88 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -115,6 +115,7 @@ static void sun4i_backend_layer_atomic_update(struct drm_plane *plane, } sun4i_backend_update_layer_coord(backend, layer->id, plane); + sun4i_backend_update_layer_zpos(backend, layer->id, plane); sun4i_backend_layer_enable(backend, layer->id, true); } @@ -237,6 +238,8 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, return ERR_CAST(layer); }; + drm_plane_create_zpos_immutable_property(&layer->plane, i); + DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n", i ? "overlay" : "primary", plane->pipe); regmap_update_bits(engine->regs, SUN4I_BACKEND_ATTCTL_REG0(i), From patchwork Tue Jan 9 10:56:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123884 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306421edr; Tue, 9 Jan 2018 02:58:14 -0800 (PST) X-Google-Smtp-Source: ACJfBot82F3P3HYBQHk7QTHyb49ytzlu/ROCLyUNaLgPKznmScTQu2reAjLRNF35E4v+R7xO70BX X-Received: by 10.101.68.69 with SMTP id e5mr12350147pgq.413.1515495494012; Tue, 09 Jan 2018 02:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495494; cv=none; d=google.com; s=arc-20160816; b=Mpivbf7X5l1HlTY7KTH61y5A8C3+wMOQeItV6wnOvmFMP7JCxKahJksqd/Kgt8yD27 Q5R5BeMdNbzK5fd7DkID5PpvY1qN5rVqWwQ9YWU5n5yQ4Xd2DuQbYEzjuonJuHYNQFjh aokXqPkCZEz/Ma3A3lD+AfrvM2f75VhdJ7QgLdh7WRz96l3aeAO3YRcUG6v15zbIyBFA zcEChU64NbYZ+7K1Ug4Lalhc7eyHie4gWgkk1HZ0wiaORSV6+t1gE7XkByyNq4IErr6y GyzfPcYP1JQBhBg0/yuosa2BmKYa+F81iPHXmGliSd459RcaGJxeg3ORab3KAvyCB+Gc M6kA== 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=LS3HwRXbdtncn8tVOkmhSDAr4nLuuBeSkNVqworAQ6U=; b=wLtFL9pcsDSCN6a6xyv+y9Ue6Gj7D1i5iW4dLKk2XUglDXIjTc/imW/QqKjfH9+V1d xNgyuItfk6BT0WQp+L0oS1kbm9D5cxiywYPcrQ9PA1CbiQsDYpsZmvuukaxsKefx9yUZ 8rIuPaxi25KP+TRaZ2w8nvGJI2Ha/eaOWwDkK1/HZ8LF1c2hJ787mOWbRrODbIoN+1w2 d6MYg3QCPib6p/IkF+QtCzD+dS+5Rj6ylju2yKufmagA/xtRXfivgmyzvZwjcCnzmyw2 NA/bkr5u/gxH278nq/UmSqWm12OEIahGC2AJYbvJ6g7to1v6EasGGPpYgskFc/83TH5m BiZQ== 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 b3si10280790pli.459.2018.01.09.02.58.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:58:14 -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 C66F56E0CC; Tue, 9 Jan 2018 10:57:13 +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 D2AC76E0A1 for ; Tue, 9 Jan 2018 10:57:08 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 57B8C20931; Tue, 9 Jan 2018 11:57:07 +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 685B720949; Tue, 9 Jan 2018 11:56:46 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 15/19] drm/sun4i: backend: Check for the number of alpha planes Date: Tue, 9 Jan 2018 11:56:34 +0100 Message-Id: <7fd29069dc7f24cc0fee5f17b82cee36b1b1e74f.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: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" Due to the way the composition is done in hardware, we can only have a single alpha-enabled plane active at a time, placed in the second (highest priority) pipe. Make sure of that in our atomic_check to not end up in an impossible scenario. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 50 ++++++++++++++++++++++++++++- drivers/gpu/drm/sun4i/sun4i_backend.h | 2 +- drivers/gpu/drm/sun4i/sun4i_layer.c | 23 +------------- 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index c4986054909b..dd995a6b8b12 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -329,6 +329,8 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, struct drm_atomic_state *state = crtc_state->state; struct drm_device *drm = state->dev; struct drm_plane *plane; + unsigned int num_planes = 0; + unsigned int num_alpha_planes = 0; unsigned int num_frontend_planes = 0; DRM_DEBUG_DRIVER("Starting checking our planes\n"); @@ -341,6 +343,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, drm_atomic_get_plane_state(state, plane); struct sun4i_layer_state *layer_state = state_to_sun4i_layer_state(plane_state); + struct drm_framebuffer *fb = plane_state->fb; if (sun4i_backend_plane_uses_frontend(plane_state)) { DRM_DEBUG_DRIVER("Using the frontend for plane %d\n", @@ -351,6 +354,50 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, } else { layer_state->uses_frontend = false; } + + DRM_DEBUG_DRIVER("Plane FB format is %s\n", + drm_get_format_name(fb->format->format, + &format_name)); + if (drm_format_has_alpha(fb->format->format)) + num_alpha_planes++; + + num_planes++; + } + + /* + * The hardware is a bit unusual here. + * + * Even though it supports 4 layers, it does the composition + * in two separate steps. + * + * The first one is assigning a layer to one of its two + * pipes. If more that 1 layer is assigned to the same pipe, + * and if pixels overlaps, the pipe will take the pixel from + * the layer with the highest priority. + * + * The second step is the actual alpha blending, that takes + * the two pipes as input, and uses the eventual alpha + * component to do the transparency between the two. + * + * This two steps scenario makes us unable to guarantee a + * robust alpha blending between the 4 layers in all + * situations, since this means that we need to have one layer + * with alpha at the lowest position of our two pipes. + * + * However, we cannot even do that, since the hardware has a + * bug where the lowest plane of the lowest pipe (pipe 0, + * priority 0), if it has any alpha, will discard the pixel + * entirely and just display the pixels in the background + * color (black by default). + * + * Since means that we effectively have only three valid + * configurations with alpha, all of them with the alpha being + * on pipe1 with the lowest position, which can be 1, 2 or 3 + * depending on the number of planes and their zpos. + */ + if (num_alpha_planes > SUN4I_BACKEND_NUM_ALPHA_LAYERS) { + DRM_DEBUG_DRIVER("Too many planes with alpha, rejecting...\n"); + return -EINVAL; } if (num_frontend_planes > SUN4I_BACKEND_NUM_FRONTEND_LAYERS) { @@ -358,6 +405,9 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, return -EINVAL; } + DRM_DEBUG_DRIVER("State valid with %u planes, %u alpha, %u video\n", + num_planes, num_alpha_planes, num_frontend_planes); + return 0; } diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h index 04a4f11b87a8..52e77591186a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.h +++ b/drivers/gpu/drm/sun4i/sun4i_backend.h @@ -146,6 +146,8 @@ #define SUN4I_BACKEND_HWCCOLORTAB_OFF 0x4c00 #define SUN4I_BACKEND_PIPE_OFF(p) (0x5000 + (0x400 * (p))) +#define SUN4I_BACKEND_NUM_LAYERS 4 +#define SUN4I_BACKEND_NUM_ALPHA_LAYERS 1 #define SUN4I_BACKEND_NUM_FRONTEND_LAYERS 1 struct sun4i_backend { diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index fbf25d59cf88..900e716443b8 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -201,32 +201,11 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, struct sun4i_backend *backend = engine_to_sun4i_backend(engine); int i; - planes = devm_kcalloc(drm->dev, ARRAY_SIZE(sun4i_backend_planes) + 1, + planes = devm_kcalloc(drm->dev, SUN4I_BACKEND_NUM_LAYERS, sizeof(*planes), GFP_KERNEL); if (!planes) return ERR_PTR(-ENOMEM); - /* - * The hardware is a bit unusual here. - * - * Even though it supports 4 layers, it does the composition - * in two separate steps. - * - * The first one is assigning a layer to one of its two - * pipes. If more that 1 layer is assigned to the same pipe, - * and if pixels overlaps, the pipe will take the pixel from - * the layer with the highest priority. - * - * The second step is the actual alpha blending, that takes - * the two pipes as input, and uses the eventual alpha - * component to do the transparency between the two. - * - * This two steps scenario makes us unable to guarantee a - * robust alpha blending between the 4 layers in all - * situations. So we just expose two layers, one per pipe. On - * SoCs that support it, sprites could fill the need for more - * layers. - */ for (i = 0; i < ARRAY_SIZE(sun4i_backend_planes); i++) { const struct sun4i_plane_desc *plane = &sun4i_backend_planes[i]; struct sun4i_layer *layer; From patchwork Tue Jan 9 10:56:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123883 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306324edr; Tue, 9 Jan 2018 02:58:05 -0800 (PST) X-Google-Smtp-Source: ACJfBouuk8NlpM4Y2ZR4CllufNKUPAdak4fz/uNr5O12usRfncyYY1dVpvCqZofkLyb/xwKuypBM X-Received: by 10.98.130.5 with SMTP id w5mr820334pfd.117.1515495485564; Tue, 09 Jan 2018 02:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495485; cv=none; d=google.com; s=arc-20160816; b=wxQGVUVFFUg9wrMv0ob88FpbvMiRUBvD2f925C81v7H6wIaBg6X5AlGoOHtp3rGcYJ AGVWnmdjZ8cRdATu1k6Gl2s9FApoEeHttdKsxhDLjs4aMWv4LmtIoodCWe8h3bbFIJEs 8b0z9dc0zgNZ3V42D8CtiQv+s8z6jmJ9+ez+1yYjPjai6LM9nMQxWnKiu4Bn8E2i7YJS Vs1rqNZtfkOz/HnZvKnuGpHeJ63idSH7jn103kGpUy1AqVe6JRQAG8+wyT/a/iFrSAUw b5c8Wz//cvmgi2sC7wCIGBuhPaaQJoWd0I1sD+7PZnq65SSi7EcgzwYKp06bAb1oY4+W Xg9w== 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=6nT7ZcNDEqC/x048EQqtA6X/LJyrx7FdWc+jD1qlThI=; b=KQfvzb6M27bS0CM36osXjttlBjqQdF19Fm7tifXfOLz8JqIBlvQQ+F1jvKCrNopNF1 gMh8997scFhFLX/AqrtPIwqIC0vsW8P8/jpckwXFcco+1x41WkJg2NFe9slSJzDLaRrt JEKONdFrdfkOTHZsfA4C3pXd52pjD+rq+CC925S6rhHP8+mhZCtO/0bfZxAf/X64io+H yFlY/SrgbarpjxScFxG/+4PjJ2FGBWXHhUB4wADUfx8bpN2X7NleQWLqsOMZQ7mTj9Eo nIM0eWA327xTtV57KKh8wd1B1hXJp1kSw29dzJIf1LBCUKGWE68w5ugx6+xvwLfwU89Z wdNg== 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 g15si8891915pgu.739.2018.01.09.02.58.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:58:05 -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 A33D86E0C7; Tue, 9 Jan 2018 10:57:12 +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 5FA2B6E0B2 for ; Tue, 9 Jan 2018 10:57:11 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id D9F552095C; Tue, 9 Jan 2018 11:57:09 +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 CC42B2095A; Tue, 9 Jan 2018 11:56:46 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 16/19] drm/sun4i: backend: Assign the pipes automatically Date: Tue, 9 Jan 2018 11:56:35 +0100 Message-Id: <6bec53786132c34587af3d9f45c371ca2800493e.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: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" Since we now have a way to enforce the zpos, check for the number of alpha planes, the only missing part is to assign our pipe automatically instead of hardcoding it. The algorithm is quite simple, but requires two iterations over the list of planes. In the first one (which is the same one that we've had to check for alpha, the frontend usage, and so on), we order the planes by their zpos. We can then do a second iteration over that array by ascending zpos starting with the pipe 0. When and if we encounter our alpha plane, we put it and all the other subsequent planes in the second pipe. And since we have runtime checks and pipe assignments now, we can just remove the static declaration of the planes we used to have. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 41 +++++++++++++++++++++-- drivers/gpu/drm/sun4i/sun4i_layer.c | 50 ++++------------------------ drivers/gpu/drm/sun4i/sun4i_layer.h | 1 +- 3 files changed, 48 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index dd995a6b8b12..ad370ce66b4d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -276,12 +276,16 @@ int sun4i_backend_update_layer_zpos(struct sun4i_backend *backend, int layer, struct drm_plane *plane) { struct drm_plane_state *state = plane->state; + struct sun4i_layer_state *p_state = state_to_sun4i_layer_state(state); unsigned int priority = state->normalized_zpos; + unsigned int pipe = p_state->pipe; - DRM_DEBUG_DRIVER("Setting layer %d priority to %d\n", layer, priority); - + DRM_DEBUG_DRIVER("Setting layer %d priority to %d and pipe %d\n", + layer, priority, pipe); regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_ATTCTL_REG0(layer), + SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK | SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL_MASK, + SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(p_state->pipe) | SUN4I_BACKEND_ATTCTL_REG0_LAY_PRISEL(priority)); return 0; @@ -326,12 +330,15 @@ static void sun4i_backend_atomic_begin(struct sunxi_engine *engine, static int sun4i_backend_atomic_check(struct sunxi_engine *engine, struct drm_crtc_state *crtc_state) { + struct drm_plane_state *plane_states[SUN4I_BACKEND_NUM_LAYERS] = { 0 }; struct drm_atomic_state *state = crtc_state->state; struct drm_device *drm = state->dev; struct drm_plane *plane; unsigned int num_planes = 0; unsigned int num_alpha_planes = 0; unsigned int num_frontend_planes = 0; + unsigned int current_pipe = 0; + unsigned int i; DRM_DEBUG_DRIVER("Starting checking our planes\n"); @@ -344,6 +351,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, struct sun4i_layer_state *layer_state = state_to_sun4i_layer_state(plane_state); struct drm_framebuffer *fb = plane_state->fb; + struct drm_format_name_buf format_name; if (sun4i_backend_plane_uses_frontend(plane_state)) { DRM_DEBUG_DRIVER("Using the frontend for plane %d\n", @@ -361,9 +369,19 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, if (drm_format_has_alpha(fb->format->format)) num_alpha_planes++; + DRM_DEBUG_DRIVER("Plane zpos is %d\n", + plane_state->normalized_zpos); + + /* Sort our planes by Zpos */ + plane_states[plane_state->normalized_zpos] = plane_state; + num_planes++; } + /* All our planes were disabled, bail out */ + if (!num_planes) + return 0; + /* * The hardware is a bit unusual here. * @@ -400,6 +418,25 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, return -EINVAL; } + /* We can't have an alpha plane at the lowest position */ + if (drm_format_has_alpha(plane_states[0]->fb->format->format)) + return -EINVAL; + + for (i = 1; i < num_planes; i++) { + struct drm_plane_state *p_state = plane_states[i]; + struct drm_framebuffer *fb = p_state->fb; + struct sun4i_layer_state *s_state = state_to_sun4i_layer_state(p_state); + + /* + * The only alpha position is the lowest plane of the + * second pipe. + */ + if (drm_format_has_alpha(fb->format->format)) + current_pipe++; + + s_state->pipe = current_pipe; + } + if (num_frontend_planes > SUN4I_BACKEND_NUM_FRONTEND_LAYERS) { DRM_DEBUG_DRIVER("Too many planes going through the frontend, rejecting\n"); return -EINVAL; diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 900e716443b8..ec7b906dbb84 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -19,13 +19,6 @@ #include "sun4i_layer.h" #include "sunxi_engine.h" -struct sun4i_plane_desc { - enum drm_plane_type type; - u8 pipe; - const uint32_t *formats; - uint32_t nformats; -}; - static void sun4i_backend_layer_reset(struct drm_plane *plane) { struct sun4i_layer *layer = plane_to_sun4i_layer(plane); @@ -133,14 +126,7 @@ static const struct drm_plane_funcs sun4i_backend_layer_funcs = { .update_plane = drm_atomic_helper_update_plane, }; -static const uint32_t sun4i_backend_layer_formats_primary[] = { - DRM_FORMAT_ARGB8888, - DRM_FORMAT_RGB888, - DRM_FORMAT_RGB565, - DRM_FORMAT_XRGB8888, -}; - -static const uint32_t sun4i_backend_layer_formats_overlay[] = { +static const uint32_t sun4i_backend_layer_formats[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_ARGB4444, DRM_FORMAT_ARGB1555, @@ -151,24 +137,9 @@ static const uint32_t sun4i_backend_layer_formats_overlay[] = { DRM_FORMAT_XRGB8888, }; -static const struct sun4i_plane_desc sun4i_backend_planes[] = { - { - .type = DRM_PLANE_TYPE_PRIMARY, - .pipe = 0, - .formats = sun4i_backend_layer_formats_primary, - .nformats = ARRAY_SIZE(sun4i_backend_layer_formats_primary), - }, - { - .type = DRM_PLANE_TYPE_OVERLAY, - .pipe = 1, - .formats = sun4i_backend_layer_formats_overlay, - .nformats = ARRAY_SIZE(sun4i_backend_layer_formats_overlay), - }, -}; - static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, struct sun4i_backend *backend, - const struct sun4i_plane_desc *plane) + enum drm_plane_type type) { struct sun4i_layer *layer; int ret; @@ -180,8 +151,9 @@ static struct sun4i_layer *sun4i_layer_init_one(struct drm_device *drm, /* possible crtcs are set later */ ret = drm_universal_plane_init(drm, &layer->plane, 0, &sun4i_backend_layer_funcs, - plane->formats, plane->nformats, - NULL, plane->type, NULL); + sun4i_backend_layer_formats, + ARRAY_SIZE(sun4i_backend_layer_formats), + NULL, type, NULL); if (ret) { dev_err(drm->dev, "Couldn't initialize layer\n"); return ERR_PTR(ret); @@ -206,11 +178,11 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, if (!planes) return ERR_PTR(-ENOMEM); - for (i = 0; i < ARRAY_SIZE(sun4i_backend_planes); i++) { - const struct sun4i_plane_desc *plane = &sun4i_backend_planes[i]; + for (i = 0; i < SUN4I_BACKEND_NUM_LAYERS; i++) { + enum drm_plane_type type = i ? DRM_PLANE_TYPE_OVERLAY : DRM_PLANE_TYPE_PRIMARY; struct sun4i_layer *layer; - layer = sun4i_layer_init_one(drm, backend, plane); + layer = sun4i_layer_init_one(drm, backend, type); if (IS_ERR(layer)) { dev_err(drm->dev, "Couldn't initialize %s plane\n", i ? "overlay" : "primary"); @@ -219,12 +191,6 @@ struct drm_plane **sun4i_layers_init(struct drm_device *drm, drm_plane_create_zpos_immutable_property(&layer->plane, i); - DRM_DEBUG_DRIVER("Assigning %s plane to pipe %d\n", - i ? "overlay" : "primary", plane->pipe); - regmap_update_bits(engine->regs, SUN4I_BACKEND_ATTCTL_REG0(i), - SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL_MASK, - SUN4I_BACKEND_ATTCTL_REG0_LAY_PIPESEL(plane->pipe)); - layer->id = i; planes[i] = &layer->plane; }; diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.h b/drivers/gpu/drm/sun4i/sun4i_layer.h index 75b4868ba87c..36b20265bd31 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.h +++ b/drivers/gpu/drm/sun4i/sun4i_layer.h @@ -24,6 +24,7 @@ struct sun4i_layer { struct sun4i_layer_state { struct drm_plane_state state; + unsigned int pipe; bool uses_frontend; }; From patchwork Tue Jan 9 10:56:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123882 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp306253edr; Tue, 9 Jan 2018 02:58:00 -0800 (PST) X-Google-Smtp-Source: ACJfBotsAwvCgKOyCcnEPxmJ7Uh98DN9jseb0BmMspmKifg0uUE0EXDAzeJ9E43knWuJ5NUWaReR X-Received: by 10.84.235.198 with SMTP id m6mr15512124plt.175.1515495480271; Tue, 09 Jan 2018 02:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515495480; cv=none; d=google.com; s=arc-20160816; b=YoA0zFQvNFM1o0Aqemb0I2Qe9UVYpdWb1l5N4e57ZW9JoFmijTqzmO911PLzOrbMuk CblBeo1WYPw0Y9bCZ27XsOZ6jEpzv8PnAIyx54n3TfwJb/33BW8Ar18kvow7EIj4fsMl EYhbRNjDXgmcYNfD8J5dJ67ADtjT5kDlcyGldLqZxSoyf5UROHuFJpFocjVPzWgnFzg8 eUBwwdaOWEsFlmLFYmUy/wEvQQkPj7x8ze/P3O2IRJ6SegqFi8jpfOy9AhpcFMAv9tbd gQew9OfcH2fpojHViPH/hxdfddNlLZQO+8kPmH2g/aEtzxsddvY7fhHmFNNyfdoeU4JY qaRg== 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=fWDxrUOjohLxVQ7pf8UVce3kUIZHRWJ39oaVolaK+ok=; b=07Fpf/+bIZTEXOM/7SnHVf2fr/rfJ34PYUlRfeEI75UJ7yWeu8sPvUQUtee1UDoNRx GwydNMNY4pljVVwLQIIaIk/w5Y80WcxCipnlaZ9agV48nbAHOtqeDUgqbuYNlkcUzII3 rEYUgbVA5gE5O0H7KAU0u138ESdQk9DCWKDbhNlI2hJBMWr3WoUucmMAz1MEK6PN2eWk Vk5VOPSdZiTENHz8+Qz+btGiwpW/zE4Z2M1T1dwPtAbIxrRUDR3eiNwgU/zemz16aB4n /O2cOI3VZ5CX4xItd+h+J/bwu0wvxL/bewHkUOliUPpREvnlSh50VBUoL3tI/puMtblB P74w== 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 p9si8879618pgs.509.2018.01.09.02.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 02:58:00 -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 021AE6E0B2; Tue, 9 Jan 2018 10:57:12 +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 6CE316E0C0 for ; Tue, 9 Jan 2018 10:57:11 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E92B52095A; Tue, 9 Jan 2018 11:57:09 +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 E3A1220986; Tue, 9 Jan 2018 11:56:47 +0100 (CET) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , Jani Nikula , Sean Paul Subject: [PATCH 19/19] drm/sun4i: backend: Remove ARGB spoofing Date: Tue, 9 Jan 2018 11:56:38 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , 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" We've had some code for quite some time to prevent the alpha bug from happening on the lowest primary plane. Since we now check for this in our atomic_check, we can simply remove it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_backend.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index ec47098bfdb2..15a7bce27412 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -92,13 +92,8 @@ void sun4i_backend_layer_enable(struct sun4i_backend *backend, SUN4I_BACKEND_MODCTL_LAY_EN(layer), val); } -static int sun4i_backend_drm_format_to_layer(struct drm_plane *plane, - u32 format, u32 *mode) +static int sun4i_backend_drm_format_to_layer(u32 format, u32 *mode) { - if (plane && (plane->type == DRM_PLANE_TYPE_PRIMARY) && - (format == DRM_FORMAT_ARGB8888)) - format = DRM_FORMAT_XRGB8888; - switch (format) { case DRM_FORMAT_ARGB8888: *mode = SUN4I_BACKEND_LAY_FBFMT_ARGB8888; @@ -200,8 +195,7 @@ int sun4i_backend_update_layer_formats(struct sun4i_backend *backend, SUN4I_BACKEND_ATTCTL_REG0_LAY_GLBALPHA_EN, val); - ret = sun4i_backend_drm_format_to_layer(plane, fb->format->format, - &val); + ret = sun4i_backend_drm_format_to_layer(fb->format->format, &val); if (ret) { DRM_DEBUG_DRIVER("Invalid format\n"); return ret; @@ -220,7 +214,7 @@ int sun4i_backend_update_layer_frontend(struct sun4i_backend *backend, u32 val; int ret; - ret = sun4i_backend_drm_format_to_layer(NULL, fmt, &val); + ret = sun4i_backend_drm_format_to_layer(fmt, &val); if (ret) { DRM_DEBUG_DRIVER("Invalid format\n"); return ret;