From patchwork Tue Sep 21 14:16:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12507969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 191ADC433F5 for ; Tue, 21 Sep 2021 14:17:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEFB8610A1 for ; Tue, 21 Sep 2021 14:17:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CEFB8610A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3EDAC6E99A; Tue, 21 Sep 2021 14:17:05 +0000 (UTC) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id A43B06E998 for ; Tue, 21 Sep 2021 14:17:02 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id w17so31548722wrv.10 for ; Tue, 21 Sep 2021 07:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Js1K5O/bNEjXe8kobmaNxax8coFwgIMmis+r8avEafc=; b=wNlTWwfdMgL+/ylxZ9+GQUZbwWU8v5m72MXlTBdX6DIG03NVg/fsnP0DocO33Vt50I hlA3ntQKTYxABDKfAjkrR/XYw+77xkw8jRic6Pt8ZdJYmkdmj9SBDwmA+B4M3VbnqCLo ASTW3nmrRMpzT5K4WP3MjT4GtD66Oi3FM7B1hXFoiRHl3UGOEtXT41YBCBJD/EpVBGab JZMxW5+i8B+I2KyZruR3pSysUSW0p6Gc6PAjDMDgcmFUmLkBMkjbTSQrNNjTeL3WQPrs uOACguwsuS0qbqVutntyIRz8X6eNF+uT9mNBlML8oT4DMJx81X9WYd2B59tOVxWi6Qmi 0UTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Js1K5O/bNEjXe8kobmaNxax8coFwgIMmis+r8avEafc=; b=m45EioA+9RRGvF6w0yMJe/StQ7xZhzlZi/TJwewO6wKmiIZvpCMojMJsbI+EVtF4LQ 9qBrnJeWYi7DALQ1xhkLbq4cuEj4EwWgiM3GOMgbfFuq3V+UDPArNdtWJpZ4t2IGaEb2 yOb4TPoMHLhcZj2+yI53BWJZvv+9ANxr2nn6L40fhDFIwyzKTB9vKe8FgKTfM5OoFmTX 88xL9C/m4S5+8E3Wa6lWZceE7owQXjgUeHG2soYj0fwL1QZS0DG7OKnm8nHu1AV8T2bC ai9wCK2iP8r+DyUvnVrFcjr0WJIpC59bSyF6TWK7Ynt3YWWub6lEOqeEw80Exz1qU4Dr 4aHg== X-Gm-Message-State: AOAM531yqGMcSSyKePpo9Rnd3JujkYOu3KnDOhj0CnfQvPPxN3TivtTV IRCR/ldVrFPsbAZKNAXcZLKQXw== X-Google-Smtp-Source: ABdhPJzv0W9BhSoIim/x4wr1AuULg7u0E6ARAAUsGFhOKYt4VkU5X780hOtba4+fps0rWQLSb6RjGw== X-Received: by 2002:a05:6000:1b90:: with SMTP id r16mr10232620wru.250.1632233820973; Tue, 21 Sep 2021 07:17:00 -0700 (PDT) Received: from localhost.localdomain ([2001:861:44c0:66c0:19bb:c937:2c91:f02]) by smtp.gmail.com with ESMTPSA id c15sm20573379wrc.83.2021.09.21.07.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 07:16:59 -0700 (PDT) From: Neil Armstrong To: tomba@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Neil Armstrong Subject: [PATCH 1/3] drm/omap: add crtc background property Date: Tue, 21 Sep 2021 16:16:52 +0200 Message-Id: <20210921141654.66550-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921141654.66550-1-narmstrong@baylibre.com> References: <20210921141654.66550-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4593; i=narmstrong@baylibre.com; h=from:subject; bh=EdsQJ0MRrbKhSXtJcPpTqnttAQ84nGQ4XAMIRS/VhJk=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBhSeilyJ8PsDwh7F+2xbVl1/LK/IdMB9Dub0IR64al 0Nq/tWqJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYUnopQAKCRB33NvayMhJ0Zi9D/ 9vImwyRyS/rfIlkiLXFO6pvUPMPBvcT5QZcebxJMTvDkF+9EBjf0wBcNsRv4cfICbgcxPVg5BVvy/h 85DTRrv2132wB9wdf6ziZ1F6BPpSbFS2OuxeAJFtzL9bALdCyu6/Q4Bu0/40WRx1FYp/BiYc8zvhGu ZY07EV3P8zGhRHSmmg22cvt9xvLgZBYZ+K1WJpc6ggLQ+LBG/75EURiVnLGxk8iF4+bI7gOpmT15c/ 7TJ/QbIe3wPKrRPb6ucwobW22CRDJea3TcV0fV7V3tWjvdl5Tv9sYKfhNW6zJ/sbJm6CeuFiwQQ1Xm /WaeLSuDf70c+bq8PdCdCZrh7YOfKgBQtmqe6mzJzT5ZtWc/UWRCc3RLhQcGrMsshC/PbbDPhTLxBP h0/k4giBNGkGpoeV3ABBZluCvJw+rSf9DEn3xEzsqnGSTaNV6vxANRfzg8+Rd8iS+HITb8qajQXazH ctVc3JiKjH3JxSeXBD7qnuqJ5scbHu6hu7jcHGvPDRYMTwih5XgIS9/GFGbOUWI5hCgGG3IZ/0aTBY 5Tl+FSkSxHhyrJMweLiGQ+24UXCuDYC16ilZg9NAc791eUVnyr4jHUKwKxKdChuD54+OB0X7FFST6L uulybBd2fzGXkjapLKlY4x/RJlCCYwQWzcJT1aiLZWcZrx/8FnZsqw0GLvGQ== X-Developer-Key: i=narmstrong@baylibre.com; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" From: Tomi Valkeinen Add DRM properties for crtc background color property. Background color is shown on areas where there are no planes. Signed-off-by: Tomi Valkeinen Signed-off-by: Neil Armstrong --- drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++++++++++++++++++++- drivers/gpu/drm/omapdrm/omap_drv.c | 7 +++++++ drivers/gpu/drm/omapdrm/omap_drv.h | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 06a719c104f4..4ba2d3e51b2b 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -24,6 +24,8 @@ struct omap_crtc_state { unsigned int rotation; unsigned int zpos; bool manually_updated; + + u32 default_color; }; #define to_omap_crtc(x) container_of(x, struct omap_crtc, base) @@ -395,13 +397,14 @@ static void omap_crtc_cpr_coefs_from_ctm(const struct drm_color_ctm *ctm, static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) { + const struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state); struct omap_drm_private *priv = crtc->dev->dev_private; struct omap_crtc *omap_crtc = to_omap_crtc(crtc); struct omap_overlay_manager_info info; memset(&info, 0, sizeof(info)); - info.default_color = 0x000000; + info.default_color = omap_state->default_color; info.trans_enabled = false; info.partial_alpha_enabled = false; @@ -668,6 +671,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, { struct omap_drm_private *priv = crtc->dev->dev_private; struct drm_plane_state *plane_state; + struct omap_crtc_state *omap_state = to_omap_crtc_state(state); /* * Delegate property set to the primary plane. Get the plane state and @@ -683,6 +687,8 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, plane_state->rotation = val; else if (property == priv->zorder_prop) plane_state->zpos = val; + else if (property == priv->background_color_prop) + omap_state->default_color = val; else return -EINVAL; @@ -701,6 +707,8 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, *val = omap_state->rotation; else if (property == priv->zorder_prop) *val = omap_state->zpos; + else if (property == priv->background_color_prop) + *val = omap_state->default_color; else return -EINVAL; @@ -741,6 +749,8 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc) state->rotation = current_state->rotation; state->manually_updated = current_state->manually_updated; + state->default_color = current_state->default_color; + return &state->base; } @@ -778,6 +788,15 @@ static const char *channel_names[] = { [OMAP_DSS_CHANNEL_LCD3] = "lcd3", }; +static void omap_crtc_install_properties(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + struct drm_mode_object *obj = &crtc->base; + struct omap_drm_private *priv = dev->dev_private; + + drm_object_attach_property(obj, priv->background_color_prop, 0); +} + /* initialize crtc */ struct drm_crtc *omap_crtc_init(struct drm_device *dev, struct omap_drm_pipeline *pipe, @@ -843,6 +862,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size); } + omap_crtc_install_properties(crtc); omap_plane_install_properties(crtc->primary, &crtc->base); return crtc; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index f86e20578143..48ebd1689601 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -200,6 +200,13 @@ static int omap_modeset_init_properties(struct drm_device *dev) if (!priv->zorder_prop) return -ENOMEM; + /* crtc properties */ + + priv->background_color_prop = + drm_property_create_range(dev, 0, "background", 0, 0xffffff); + if (!priv->background_color_prop) + return -ENOMEM; + return 0; } diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 591d4c273f02..ed69ae78ae89 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -73,6 +73,9 @@ struct omap_drm_private { /* properties: */ struct drm_property *zorder_prop; + /* crtc properties */ + struct drm_property *background_color_prop; + /* irq handling: */ spinlock_t wait_lock; /* protects the wait_list */ struct list_head wait_list; /* list of omap_irq_wait */ From patchwork Tue Sep 21 14:16:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12507971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E36AC433EF for ; Tue, 21 Sep 2021 14:17:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6614161159 for ; Tue, 21 Sep 2021 14:17:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6614161159 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 688D46E998; Tue, 21 Sep 2021 14:17:08 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F4906E998 for ; Tue, 21 Sep 2021 14:17:04 +0000 (UTC) Received: by mail-wr1-x436.google.com with SMTP id q26so39604060wrc.7 for ; Tue, 21 Sep 2021 07:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QKTzUiIslopLihKMv00bRn1BvdaTo9yXPswlnaQZN5Q=; b=mCk3EnSTBVUkGyheg+o6ZULz1TmBXi/9sCFnGE2uiYFCaQ50/PFGUo0a9ehrY6NIIX PMc3jEYAmadvLYTNGGGk5a5HyDna7yDaWur1nKW2FhFYdylPhsiXMMFKGjNcNMiwiZo0 CfnmiI4KIRzQMnWsUUlXS9GacR8GdP5Z1DwJT2Lc2Pz4DX97+AqCOZYZMFONSzuBTArx YXZSVRh1WdGE+NPamUchGFL1dkxELEEjuNPJNQQWdI+7KkDuXYntrwSsbho3mCCTDiW/ J727AL13pp4tsq4nwveYP9oS2YIsOukxq6+PkW5uEMTKeeCKwjezDmIpwpwX3gfAGQUE Vzcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QKTzUiIslopLihKMv00bRn1BvdaTo9yXPswlnaQZN5Q=; b=wnQwArw/P4Yyq/w+5kirgoteNuI/z/ahWuNN3ZhFZyxrHLsqoP2l7WtabKu7X8AQGF n+TuCHR1b3oY6Sc53wOK2zUo3lX1nic2cfhpG2Nsi30hGA+rrbWsVfXN399QTqJqf8cm 42ChX8i1s6ON/DXDmO20kOM46jwmAh6KLMknPWq0CmhPYMyxI8aWx1l7eIh5SUSdPkW/ R7pgzdKLcBFwdeQrtasXYuQMzPIFDHgze6s+E1DV8PAT0NcmWQqc+qfOb9aVFo2VdFDn H56yt7Ud1pCsmmWeuMvGC+xhvWFUcV/l1N/PPnQcz/WkTOAoTThLoR9Ns7kLERgM7Uxc T7PQ== X-Gm-Message-State: AOAM533UyTjdIT4vaeZLd5iwpq2wC9VscSzjc1/9916HcQr3qa0ILY22 bbeCML2gDiCae95wjmqO2Lz00g== X-Google-Smtp-Source: ABdhPJylEmqk77m/NewpkXVpwop/ZqyU2zfHF5e+BAqMJZucUYLK6CN86GqT9aW9R3MGDrnR/LcIzQ== X-Received: by 2002:adf:ea90:: with SMTP id s16mr35463301wrm.235.1632233822270; Tue, 21 Sep 2021 07:17:02 -0700 (PDT) Received: from localhost.localdomain ([2001:861:44c0:66c0:19bb:c937:2c91:f02]) by smtp.gmail.com with ESMTPSA id c15sm20573379wrc.83.2021.09.21.07.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 07:17:01 -0700 (PDT) From: Neil Armstrong To: tomba@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Peter Ujfalusi , Neil Armstrong Subject: [PATCH 2/3] drm/omap: add crtc transparency key property Date: Tue, 21 Sep 2021 16:16:53 +0200 Message-Id: <20210921141654.66550-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921141654.66550-1-narmstrong@baylibre.com> References: <20210921141654.66550-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6377; i=narmstrong@baylibre.com; h=from:subject; bh=4+XpwBDvQNvYsb0GsKGwtHNgM+J3P3z2VfHsFFdY2oM=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBhSeilnW37hks7upqmmFJF4Kp0P8StJu+0b03SiMYN +7joIeSJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYUnopQAKCRB33NvayMhJ0ZDwD/ 9f2Nv5Bx6XMB22HG+TbyfERDeqpzb2yC/N0go+BXl69Umj41l3erXKhjMCDbEOUT7jzOkleDtlvud5 FrFprkRbTDQFzOfuROzkMpfQkoWkazDpzr2qpTJ+Aby77zEIIrTzHc+/irBFrBwkzVJ1pfXgp4ONuR 6FqRlPZthl6FSOpbKx96l0arE2qWviIW9sv+70NKSPxeUG3kOvpwMS4mTm5yW9C8Z+lAeV0y2SVEva rOy+LJpvn7JIz1raoZuMK/jzdf65V5Eivp44h6iyoeLbZssbbaZ+OfXlui7i1AYFmQUMs9gB0/qbxl 4kbJGVYZMcdrDpZUz594nY1nONDYIyrJpPl71XqLDqVXcGRlmlRPI4BDPefZIQcOHRwXk5UH59a28f EUYhGbSdgAfUa9AcpY+MvuOLtFdSsg4c3sYeyQtRnkrIXplIujoWiKW0/k4PDI10qe+bmM0tyug58E XzMfoiB3cpehpfoaKaRqVvP4uvHhVuynYSMqVp1q1tqZ2yT51UegxJDHDXax2emgZLgJHdHYFf/bMV P0PB9iOaEPMVCCVjF1SjF7iWFBNjUGPppBbJ7VaaCZAzea5TNW1hKxppzHoQUjM0omB1cYUdagtIea dRCXlKdrggWMJcvEeQ+GiHZp/XyzsJSappYJqc5vGT69qa5nP19pz/37dmuA== X-Developer-Key: i=narmstrong@baylibre.com; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" From: Tomi Valkeinen Add support for transparency keying. User space must understand how the TCK works and needs to place the planes to correct zpos. The generic zpos normalization in DRM however is going to do normalization and might move the position of the planes which breaks the TCK as planes are no longer in the position where application deliberately placed them. If the TCK is enabled for the crtc then use the zpos configured by the application instead of the normalized positions and at the same time do a sanity check against overlapping zpos. Signed-off-by: Tomi Valkeinen Signed-off-by: Peter Ujfalusi Signed-off-by: Neil Armstrong --- drivers/gpu/drm/omapdrm/omap_crtc.c | 53 ++++++++++++++++++++++++++++- drivers/gpu/drm/omapdrm/omap_drv.c | 18 ++++++++++ drivers/gpu/drm/omapdrm/omap_drv.h | 2 ++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 4ba2d3e51b2b..d1fbbbaa3da8 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -26,6 +26,8 @@ struct omap_crtc_state { bool manually_updated; u32 default_color; + unsigned int trans_key_mode; + unsigned int trans_key; }; #define to_omap_crtc(x) container_of(x, struct omap_crtc, base) @@ -405,9 +407,25 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) memset(&info, 0, sizeof(info)); info.default_color = omap_state->default_color; - info.trans_enabled = false; info.partial_alpha_enabled = false; + info.trans_key = omap_state->trans_key; + + switch (omap_state->trans_key_mode) { + case 0: + default: + info.trans_enabled = false; + break; + case 1: + info.trans_enabled = true; + info.trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST; + break; + case 2: + info.trans_enabled = true; + info.trans_key_type = OMAP_DSS_COLOR_KEY_VID_SRC; + break; + } + if (crtc->state->ctm) { struct drm_color_ctm *ctm = crtc->state->ctm->data; @@ -584,6 +602,7 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc, { struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + const struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc_state); struct drm_plane_state *pri_state; if (crtc_state->color_mgmt_changed && crtc_state->degamma_lut) { @@ -594,6 +613,25 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc, return -EINVAL; } + if (omap_state->trans_key_mode) { + struct drm_plane *plane; + struct drm_plane_state *plane_state; + u32 zpos_mask = 0; + + drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) { + plane_state = + drm_atomic_get_plane_state(crtc_state->state, plane); + if (IS_ERR(plane_state)) + return PTR_ERR(plane_state); + + if (zpos_mask & BIT(plane_state->zpos)) + return -EINVAL; + + zpos_mask |= BIT(plane_state->zpos); + plane_state->normalized_zpos = plane_state->zpos; + } + } + pri_state = drm_atomic_get_new_plane_state(state, crtc->primary); if (pri_state) { @@ -689,6 +727,10 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, plane_state->zpos = val; else if (property == priv->background_color_prop) omap_state->default_color = val; + else if (property == priv->trans_key_mode_prop) + omap_state->trans_key_mode = val; + else if (property == priv->trans_key_prop) + omap_state->trans_key = val; else return -EINVAL; @@ -709,6 +751,10 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, *val = omap_state->zpos; else if (property == priv->background_color_prop) *val = omap_state->default_color; + else if (property == priv->trans_key_mode_prop) + *val = omap_state->trans_key_mode; + else if (property == priv->trans_key_prop) + *val = omap_state->trans_key; else return -EINVAL; @@ -751,6 +797,9 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc) state->default_color = current_state->default_color; + state->trans_key_mode = current_state->trans_key_mode; + state->trans_key = current_state->trans_key; + return &state->base; } @@ -795,6 +844,8 @@ static void omap_crtc_install_properties(struct drm_crtc *crtc) struct omap_drm_private *priv = dev->dev_private; drm_object_attach_property(obj, priv->background_color_prop, 0); + drm_object_attach_property(obj, priv->trans_key_mode_prop, 0); + drm_object_attach_property(obj, priv->trans_key_prop, 0); } /* initialize crtc */ diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 48ebd1689601..adf99b60b2e0 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -195,6 +195,12 @@ static int omap_modeset_init_properties(struct drm_device *dev) struct omap_drm_private *priv = dev->dev_private; unsigned int num_planes = dispc_get_num_ovls(priv->dispc); + static const struct drm_prop_enum_list trans_key_mode_list[] = { + { 0, "disable"}, + { 1, "gfx-dst"}, + { 2, "vid-src"}, + }; + priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, num_planes - 1); if (!priv->zorder_prop) @@ -207,6 +213,18 @@ static int omap_modeset_init_properties(struct drm_device *dev) if (!priv->background_color_prop) return -ENOMEM; + priv->trans_key_mode_prop = + drm_property_create_enum(dev, 0, "trans-key-mode", + trans_key_mode_list, + ARRAY_SIZE(trans_key_mode_list)); + if (!priv->trans_key_mode_prop) + return -ENOMEM; + + priv->trans_key_prop = + drm_property_create_range(dev, 0, "trans-key", 0, 0xffffff); + if (!priv->trans_key_prop) + return -ENOMEM; + return 0; } diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index ed69ae78ae89..6a882b213e2f 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -75,6 +75,8 @@ struct omap_drm_private { /* crtc properties */ struct drm_property *background_color_prop; + struct drm_property *trans_key_mode_prop; + struct drm_property *trans_key_prop; /* irq handling: */ spinlock_t wait_lock; /* protects the wait_list */ From patchwork Tue Sep 21 14:16:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 12507973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 585F0C433EF for ; Tue, 21 Sep 2021 14:17:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 270C1610A1 for ; Tue, 21 Sep 2021 14:17:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 270C1610A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36B3D6E99E; Tue, 21 Sep 2021 14:17:11 +0000 (UTC) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12CC96E99E for ; Tue, 21 Sep 2021 14:17:06 +0000 (UTC) Received: by mail-wr1-x42c.google.com with SMTP id u15so39662448wru.6 for ; Tue, 21 Sep 2021 07:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nAYhYOtljv3sKR69Z1ld7zhrPXbSYXbm9pU5Q7uYDg8=; b=3O2cO0UUhOwWc/ZGVhgR4m0GzP8beqjgLU7EM3PdnuKJ4yZCt5INVW8L/XqIc+mAJN +so/fEBys7cxZynQTGDvXg0vAVaw2WGyDnh2U4OhptOFv9yWhhIAzoyYmIOdcmeuJlwB OmaBKNOn/p8d+PHCTy0NT0+evxHFNfQBFvgpDrf3Y+INZRDneDx8OxqEjVG4W1illZLb u/R5pga0U4ELdOmnzBAie+64FOaQ4NP3uAH6gopt2OVj/Hgyn1pgw/odKDo96zganZZv lPJ8nsMX9D+rkHT8z6bH/7CdFjq1IthkhkfcibuMPCtwhjrDqc1wBe1+Eqrf8XbZ7CjB GU8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nAYhYOtljv3sKR69Z1ld7zhrPXbSYXbm9pU5Q7uYDg8=; b=6+QOL+w+sjVpvS6Eco8XfZ0P2eXzcb77yh6tnSo2zgNpSQ3y011SF/bGzv5F3lOwQS ACCyz/BP26VrRiZWTLDxJYctCJ/ht72kfCTwF+gCarcZre6IkKVvpqG1AJmzqE7vqWn4 40PLezC4wLnfq2i7NVOIey1EiU4UgJDBqv7RkOMk/8T/KZbQxssLREu0D7Xj8pO7r6KI NI64u/UdUcSqOHCZJmbA2UO5lq0GAHYSuKSkqmkuYIt2NzPfXMTW/lFYWqZY0OveSCCv vwX9ezKq1w/KQ3GhsYiwcw2nrqT6U8hXupK0kKwM/Vyxqqm1nWxnYxxQ30EYbhf1wFFa jpKg== X-Gm-Message-State: AOAM5317FM5c6fcI5Kl4sT3e1zh9Lrss41MFzhHx/J6AhpvcR5QUiSIN 9wrGAA8Od0c/F8pYDhfdgBGE3EZCg3Tnv5ms X-Google-Smtp-Source: ABdhPJxBnLsc/rBKHK4t0KQIubNY1C6tlwqyLHwTEDRyM2PrO4BNVYBJuWkANBb6ewOQ+IXGOWZ57A== X-Received: by 2002:a5d:440e:: with SMTP id z14mr5104794wrq.64.1632233823384; Tue, 21 Sep 2021 07:17:03 -0700 (PDT) Received: from localhost.localdomain ([2001:861:44c0:66c0:19bb:c937:2c91:f02]) by smtp.gmail.com with ESMTPSA id c15sm20573379wrc.83.2021.09.21.07.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 07:17:02 -0700 (PDT) From: Neil Armstrong To: tomba@kernel.org Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , Neil Armstrong Subject: [PATCH 3/3] drm/omap: add alpha blender property Date: Tue, 21 Sep 2021 16:16:54 +0200 Message-Id: <20210921141654.66550-4-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921141654.66550-1-narmstrong@baylibre.com> References: <20210921141654.66550-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5181; i=narmstrong@baylibre.com; h=from:subject; bh=xSxrqKj2uaFJ56uvpTXcueCbdB/6tiKYytLm8zoamVk=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBhSeilyYzVVXmB7RfeQMnRsiqzzRMDQHswZvnFfxcw NREbsX6JAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCYUnopQAKCRB33NvayMhJ0U33D/ 9xfTmLPOvbgzU/NlWWQGBWn22636lZnKiCCegjq3UWLSPuZaIgWebvleT+npsVlok5bXUHGCcODUHL i45gZeKAVYZN3yLTF9aBHb1lSfcqzXqYar5VHBHasgjvP8UHDhoqopGO8N8jgj0yNoQY4notOwdr8H PXvTFriRbMobUDoZD2sVydZx/pBxH35q1tz+Wz4B8B1luMmRHzlAUs0w3vbVHBzx2+/IjARbWqOy9z 1kLQj4D0oQf95lfky49EBlGsezQN9KIVfYeN2WnqtD0I1mMuoOEypXrLi8RrNk+FkSbix2zQvVpxXa sMNeJ6rjmmydGnFiQmWFD5se+aTi189ofRAptMrT0V3f+dtoM4+MgcUVYRwu/DGOQ99u7pnn6VcmAR zF0f+ivpnQsfv5Px3Y91tX4h8yaUCKuRVMjbJmZAAYPMl8byxXQyG6a+aGIO1FHAIZwmKO/H72kHFj DjhPbQPn2TD4KPHuNIAKW6JSs4j29uguO7BNI9zKFccgp/r8naeumQ4qkw8LvZF2560Xt6YjvBSY8w O69BYjGatLpprEtE8yXBTd/FvmDx45jZ+iBnST61FIgrmjx9JOa1+9alsj0PcuoMTco1f8JhrSQRE2 Z85mFboG4YoSsapYxMH0k9DIPwhwt8TTXHvQ8SpiXrSyKLMGRQJUW5y/bhgA== X-Developer-Key: i=narmstrong@baylibre.com; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" From: Tomi Valkeinen Add support to enable/disable alpha blender on DSS3. Signed-off-by: Tomi Valkeinen Signed-off-by: Neil Armstrong --- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++-- drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 +- drivers/gpu/drm/omapdrm/omap_crtc.c | 10 +++++++++- drivers/gpu/drm/omapdrm/omap_drv.c | 5 +++++ drivers/gpu/drm/omapdrm/omap_drv.h | 1 + 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5619420cc2cc..ca05d608e44a 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2995,7 +2995,7 @@ void dispc_mgr_setup(struct dispc_device *dispc, info->trans_key); dispc_mgr_enable_trans_key(dispc, channel, info->trans_enabled); dispc_mgr_enable_alpha_fixed_zorder(dispc, channel, - info->partial_alpha_enabled); + info->alpha_blender_enabled); if (dispc_has_feature(dispc, FEAT_CPR)) { dispc_mgr_enable_cpr(dispc, channel, info->cpr_enable); dispc_mgr_set_cpr_coef(dispc, channel, &info->cpr_coefs); @@ -4588,7 +4588,7 @@ static const struct dispc_errata_i734_data { .mgri = { .default_color = 0, .trans_enabled = false, - .partial_alpha_enabled = false, + .alpha_blender_enabled = false, .cpr_enable = false, }, .lcd_conf = { diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 040d5a3e33d6..6988459f267c 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -175,7 +175,7 @@ struct omap_overlay_manager_info { u32 trans_key; bool trans_enabled; - bool partial_alpha_enabled; + bool alpha_blender_enabled; bool cpr_enable; struct omap_dss_cpr_coefs cpr_coefs; diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index d1fbbbaa3da8..fbcc092399dd 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -28,6 +28,7 @@ struct omap_crtc_state { u32 default_color; unsigned int trans_key_mode; unsigned int trans_key; + bool alpha_blender_enabled; }; #define to_omap_crtc(x) container_of(x, struct omap_crtc, base) @@ -407,7 +408,6 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) memset(&info, 0, sizeof(info)); info.default_color = omap_state->default_color; - info.partial_alpha_enabled = false; info.trans_key = omap_state->trans_key; @@ -426,6 +426,8 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) break; } + info.alpha_blender_enabled = omap_state->alpha_blender_enabled; + if (crtc->state->ctm) { struct drm_color_ctm *ctm = crtc->state->ctm->data; @@ -731,6 +733,8 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, omap_state->trans_key_mode = val; else if (property == priv->trans_key_prop) omap_state->trans_key = val; + else if (property == priv->alpha_blender_prop) + omap_state->alpha_blender_enabled = !!val; else return -EINVAL; @@ -755,6 +759,8 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, *val = omap_state->trans_key_mode; else if (property == priv->trans_key_prop) *val = omap_state->trans_key; + else if (property == priv->alpha_blender_prop) + *val = omap_state->alpha_blender_enabled; else return -EINVAL; @@ -799,6 +805,7 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc) state->trans_key_mode = current_state->trans_key_mode; state->trans_key = current_state->trans_key; + state->alpha_blender_enabled = current_state->alpha_blender_enabled; return &state->base; } @@ -846,6 +853,7 @@ static void omap_crtc_install_properties(struct drm_crtc *crtc) drm_object_attach_property(obj, priv->background_color_prop, 0); drm_object_attach_property(obj, priv->trans_key_mode_prop, 0); drm_object_attach_property(obj, priv->trans_key_prop, 0); + drm_object_attach_property(obj, priv->alpha_blender_prop, 0); } /* initialize crtc */ diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index adf99b60b2e0..92e459c67eff 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -225,6 +225,11 @@ static int omap_modeset_init_properties(struct drm_device *dev) if (!priv->trans_key_prop) return -ENOMEM; + priv->alpha_blender_prop = + drm_property_create_bool(dev, 0, "alpha_blender"); + if (!priv->alpha_blender_prop) + return -ENOMEM; + return 0; } diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 6a882b213e2f..38ec1e0eab8a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -77,6 +77,7 @@ struct omap_drm_private { struct drm_property *background_color_prop; struct drm_property *trans_key_mode_prop; struct drm_property *trans_key_prop; + struct drm_property *alpha_blender_prop; /* irq handling: */ spinlock_t wait_lock; /* protects the wait_list */