All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: tomba@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: [PATCH 3/3] drm/omap: add alpha blender property
Date: Tue, 21 Sep 2021 16:16:54 +0200	[thread overview]
Message-ID: <20210921141654.66550-4-narmstrong@baylibre.com> (raw)
In-Reply-To: <20210921141654.66550-1-narmstrong@baylibre.com>

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

Add support to enable/disable alpha blender on DSS3.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 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 */
-- 
2.25.1


  parent reply	other threads:[~2021-09-21 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 14:16 [PATCH 0/3] drm/omap: add crtc properties Neil Armstrong
2021-09-21 14:16 ` [PATCH 1/3] drm/omap: add crtc background property Neil Armstrong
2021-09-21 14:16 ` [PATCH 2/3] drm/omap: add crtc transparency key property Neil Armstrong
2021-09-21 14:16 ` Neil Armstrong [this message]
2021-09-21 14:28 ` [PATCH 0/3] drm/omap: add crtc properties Tomi Valkeinen
2021-09-21 14:30   ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921141654.66550-4-narmstrong@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomba@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.