[PATCH 3/3] drm/omap: add alpha blender property

From: Neil Armstrong
Date: Tue Sep 21 2021 - 10:18:45 EST


From: Tomi Valkeinen <tomi.valkeinen@xxxxxx>

Add support to enable/disable alpha blender on DSS3.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxx>
Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
---
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