Skip to contentSkip to conversation

OMAP3: DSS2: Pre-Multiplied Alpha support

PATCH In review Samreen 2 participants 4 messages Nov 4, 2010 – Nov 12, 2010

Subsystems (3)
lore
Share & tools
lore

Samreen

author
#0 lore raw

v2 cover OMAP3: DSS2: Pre-Multiplied Alpha support

Enable Pre multiplied alpha support on OMAP3630

The first patch splits the omap3 dss has features for omap3430 and omap3630 separately
The second patch adds the support for pre multiplied alpha

Version2:
- Split the patch into dss has feature patch and pre multiplied alpha support
- Remove the BUG_ON in functions setting pre multiplied alpha and global alpha
- Uniformly use "pre_mult_alpha" naming convention

Rajkumar N (1):
OMAP3630: DSS2: Enable Pre-Multiplied Alpha Support

Samreen (1):
OMAP3: DSS2: Split OMAP3 has feature for 3430 & 3630

 arch/arm/plat-omap/include/plat/display.h |    1 +
 drivers/video/omap2/dss/dispc.c           |   30 ++++++++++++++++-----
 drivers/video/omap2/dss/dss.h             |    3 +-
 drivers/video/omap2/dss/dss_features.c    |   20 ++++++++++++--
 drivers/video/omap2/dss/dss_features.h    |    1 +
 drivers/video/omap2/dss/manager.c         |    5 +++-
 drivers/video/omap2/dss/overlay.c         |   41 +++++++++++++++++++++++++++++
 7 files changed, 89 insertions(+), 12 deletions(-)
author
#1 lore raw

PATCH v2 1/2 OMAP3: DSS2: Split OMAP3 has feature for 3430 & 3630

Splitting the OMAP3 dss has feature separately for omap3430 & omap3630

---
 drivers/video/omap2/dss/dss_features.c |   20 +++++++++++++++++---
 drivers/video/omap2/dss/dss_features.h |    1 +
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/video/omap2/dss/dss_features.c +17 -3
index 867f68d..854deba 100644
@@ -134,7 +134,7 @@ static struct omap_dss_features omap2_dss_features = {
 };
 
 /* OMAP3 DSS Features */
-static struct omap_dss_features omap3_dss_features = {
+static struct omap_dss_features omap3430_dss_features = {
 	.reg_fields = omap3_dss_reg_fields,
 	.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
 
@@ -146,6 +146,18 @@ static struct omap_dss_features omap3_dss_features = {
 	.supported_color_modes = omap3_dss_supported_color_modes,
 };
 
+static struct omap_dss_features omap3630_dss_features = {
+	.reg_fields = omap3_dss_reg_fields,
+	.num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
+
+	.has_feature    = FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA,
+
+	.num_mgrs = 2,
+	.num_ovls = 3,
+	.supported_displays = omap3_dss_supported_displays,
+	.supported_color_modes = omap3_dss_supported_color_modes,
+};
+
 /* Functions returning values related to a DSS feature */
 int dss_feat_get_num_mgrs(void)
 {
@@ -186,6 +198,8 @@ void dss_features_init(void)
 {
 	if (cpu_is_omap24xx())
 		omap_current_dss_features = &omap2_dss_features;
-	else
-		omap_current_dss_features = &omap3_dss_features;
+	else if (cpu_is_omap3630())
+		omap_current_dss_features = &omap3630_dss_features;
+	else if (cpu_is_omap34xx())
+		omap_current_dss_features = &omap3430_dss_features;
 }
drivers/video/omap2/dss/dss_features.h +1 -0
index cb231ea..aeb2eea 100644
@@ -27,6 +27,7 @@
 enum dss_feat_id {
 	FEAT_GLOBAL_ALPHA	= 1 << 0,
 	FEAT_GLOBAL_ALPHA_VID1	= 1 << 1,
+	FEAT_PRE_MULT_ALPHA	= 1 << 2,
 };
 
 /* DSS register field id */
Signature · 1 line
1.5.6.3
author
#2 lore raw

PATCH v2 2/2 OMAP3630: DSS2: Enable Pre-Multiplied Alpha Support

From: Rajkumar N <[email protected]>

Enable dss to process color formats with pre-mulitplied alpha. With this we can have alpha values defined for each pixel and hence can have different blending values for each pixel. sysfs entry has been created for this and pre-multiplied alpha support is turned off by default.

---
 arch/arm/plat-omap/include/plat/display.h |    1 +
 drivers/video/omap2/dss/dispc.c           |   30 ++++++++++++++++-----
 drivers/video/omap2/dss/dss.h             |    3 +-
 drivers/video/omap2/dss/manager.c         |    5 +++-
 drivers/video/omap2/dss/overlay.c         |   41 +++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+), 9 deletions(-)
arch/arm/plat-omap/include/plat/display.h +1 -0
index c915a66..d433baf 100644
@@ -268,6 +268,7 @@ struct omap_overlay_info {
 	u16 out_width;	/* if 0, out_width == width */
 	u16 out_height;	/* if 0, out_height == height */
 	u8 global_alpha;
+	u8 pre_mult_alpha;
 };
 
 struct omap_overlay {
drivers/video/omap2/dss/dispc.c +23 -7
index fa40fa5..2179618 100644
@@ -773,13 +773,26 @@ static void _dispc_set_vid_size(enum omap_plane plane, int width, int height)
 	dispc_write_reg(vsi_reg[plane-1], val);
 }
 
+static void _dispc_set_pre_mult_alpha(enum omap_plane plane, bool enable)
+{
+	if (!dss_has_feature(FEAT_PRE_MULT_ALPHA))
+		return;
+
+	if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
+		plane == OMAP_DSS_VIDEO1)
+		return;
+
+	REG_FLD_MOD(dispc_reg_att[plane], enable ? 1 : 0, 28, 28);
+}
+
 static void _dispc_setup_global_alpha(enum omap_plane plane, u8 global_alpha)
 {
 	if (!dss_has_feature(FEAT_GLOBAL_ALPHA))
 		return;
 
-	BUG_ON(!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
-			plane == OMAP_DSS_VIDEO1);
+	if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
+		plane == OMAP_DSS_VIDEO1)
+		return;
 
 	if (plane == OMAP_DSS_GFX)
 		REG_FLD_MOD(DISPC_GLOBAL_ALPHA, global_alpha, 7, 0);
@@ -1507,7 +1520,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		bool ilace,
 		enum omap_dss_rotation_type rotation_type,
 		u8 rotation, int mirror,
-		u8 global_alpha)
+		u8 global_alpha,
+		u8 pre_mult_alpha)
 {
 	const int maxdownscale = cpu_is_omap34xx() ? 4 : 2;
 	bool five_taps = 0;
@@ -1693,8 +1707,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 
 	_dispc_set_rotation_attrs(plane, rotation, mirror, color_mode);
 
-	if (plane != OMAP_DSS_VIDEO1)
-		_dispc_setup_global_alpha(plane, global_alpha);
+	_dispc_set_pre_mult_alpha(plane, pre_mult_alpha);
+	_dispc_setup_global_alpha(plane, global_alpha);
 
 	return 0;
 }
@@ -3139,7 +3153,8 @@ int dispc_setup_plane(enum omap_plane plane,
 		       enum omap_color_mode color_mode,
 		       bool ilace,
 		       enum omap_dss_rotation_type rotation_type,
-		       u8 rotation, bool mirror, u8 global_alpha)
+		       u8 rotation, bool mirror, u8 global_alpha,
+		       u8 pre_mult_alpha)
 {
 	int r = 0;
 
@@ -3161,7 +3176,8 @@ int dispc_setup_plane(enum omap_plane plane,
 			   color_mode, ilace,
 			   rotation_type,
 			   rotation, mirror,
-			   global_alpha);
+			   global_alpha,
+			   pre_mult_alpha);
 
 	enable_clocks(0);
 
drivers/video/omap2/dss/dss.h +2 -1
index 5c7940d..2bb515c 100644
@@ -359,7 +359,8 @@ int dispc_setup_plane(enum omap_plane plane,
 		      bool ilace,
 		      enum omap_dss_rotation_type rotation_type,
 		      u8 rotation, bool mirror,
-		      u8 global_alpha);
+		      u8 global_alpha,
+		      u8 pre_mult_alpha);
 
 bool dispc_go_busy(enum omap_channel channel);
 void dispc_go(enum omap_channel channel);
drivers/video/omap2/dss/manager.c +4 -1
index 545e9b9..873b334 100644
@@ -406,6 +406,7 @@ struct overlay_cache_data {
 	u16 out_width;	/* if 0, out_width == width */
 	u16 out_height;	/* if 0, out_height == height */
 	u8 global_alpha;
+	u8 pre_mult_alpha;
 
 	enum omap_channel channel;
 	bool replication;
@@ -842,7 +843,8 @@ static int configure_overlay(enum omap_plane plane)
 			c->rotation_type,
 			c->rotation,
 			c->mirror,
-			c->global_alpha);
+			c->global_alpha,
+			c->pre_mult_alpha);
 
 	if (r) {
 		/* this shouldn't happen */
@@ -1265,6 +1267,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 		oc->out_width = ovl->info.out_width;
 		oc->out_height = ovl->info.out_height;
 		oc->global_alpha = ovl->info.global_alpha;
+		oc->pre_mult_alpha = ovl->info.pre_mult_alpha;
 
 		oc->replication =
 			dss_use_replication(dssdev, ovl->info.color_mode);
drivers/video/omap2/dss/overlay.c +41 -0

59 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#3 lore raw
In reply to Samreen

Hi,

Quoted 6 lines · ext Samreen

Enable Pre multiplied alpha support on OMAP3630

The first patch splits the omap3 dss has features for omap3430 and omap3630 separately
The second patch adds the support for pre multiplied alpha

Quoted 6 lines

Version2:
- Split the patch into dss has feature patch and pre multiplied alpha support
- Remove the BUG_ON in functions setting pre multiplied alpha and global alpha
- Uniformly use "pre_mult_alpha" naming convention

Looks good, I'll apply to my tree.

Tomi