aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-omap/include/plat/display.h1
-rw-r--r--drivers/video/omap2/dss/dispc.c30
-rw-r--r--drivers/video/omap2/dss/dss.h3
-rw-r--r--drivers/video/omap2/dss/manager.c5
-rw-r--r--drivers/video/omap2/dss/overlay.c41
5 files changed, 71 insertions, 9 deletions
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index c915a661f1f5..d433baf4e977 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -268,6 +268,7 @@ struct omap_overlay_info {
268 u16 out_width; /* if 0, out_width == width */ 268 u16 out_width; /* if 0, out_width == width */
269 u16 out_height; /* if 0, out_height == height */ 269 u16 out_height; /* if 0, out_height == height */
270 u8 global_alpha; 270 u8 global_alpha;
271 u8 pre_mult_alpha;
271}; 272};
272 273
273struct omap_overlay { 274struct omap_overlay {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 4e04a73a8ff3..54ba8d3ad317 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -773,13 +773,26 @@ static void _dispc_set_vid_size(enum omap_plane plane, int width, int height)
773 dispc_write_reg(vsi_reg[plane-1], val); 773 dispc_write_reg(vsi_reg[plane-1], val);
774} 774}
775 775
776static void _dispc_set_pre_mult_alpha(enum omap_plane plane, bool enable)
777{
778 if (!dss_has_feature(FEAT_PRE_MULT_ALPHA))
779 return;
780
781 if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
782 plane == OMAP_DSS_VIDEO1)
783 return;
784
785 REG_FLD_MOD(dispc_reg_att[plane], enable ? 1 : 0, 28, 28);
786}
787
776static void _dispc_setup_global_alpha(enum omap_plane plane, u8 global_alpha) 788static void _dispc_setup_global_alpha(enum omap_plane plane, u8 global_alpha)
777{ 789{
778 if (!dss_has_feature(FEAT_GLOBAL_ALPHA)) 790 if (!dss_has_feature(FEAT_GLOBAL_ALPHA))
779 return; 791 return;
780 792
781 BUG_ON(!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) && 793 if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
782 plane == OMAP_DSS_VIDEO1); 794 plane == OMAP_DSS_VIDEO1)
795 return;
783 796
784 if (plane == OMAP_DSS_GFX) 797 if (plane == OMAP_DSS_GFX)
785 REG_FLD_MOD(DISPC_GLOBAL_ALPHA, global_alpha, 7, 0); 798 REG_FLD_MOD(DISPC_GLOBAL_ALPHA, global_alpha, 7, 0);
@@ -1507,7 +1520,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
1507 bool ilace, 1520 bool ilace,
1508 enum omap_dss_rotation_type rotation_type, 1521 enum omap_dss_rotation_type rotation_type,
1509 u8 rotation, int mirror, 1522 u8 rotation, int mirror,
1510 u8 global_alpha) 1523 u8 global_alpha,
1524 u8 pre_mult_alpha)
1511{ 1525{
1512 const int maxdownscale = cpu_is_omap34xx() ? 4 : 2; 1526 const int maxdownscale = cpu_is_omap34xx() ? 4 : 2;
1513 bool five_taps = 0; 1527 bool five_taps = 0;
@@ -1693,8 +1707,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
1693 1707
1694 _dispc_set_rotation_attrs(plane, rotation, mirror, color_mode); 1708 _dispc_set_rotation_attrs(plane, rotation, mirror, color_mode);
1695 1709
1696 if (plane != OMAP_DSS_VIDEO1) 1710 _dispc_set_pre_mult_alpha(plane, pre_mult_alpha);
1697 _dispc_setup_global_alpha(plane, global_alpha); 1711 _dispc_setup_global_alpha(plane, global_alpha);
1698 1712
1699 return 0; 1713 return 0;
1700} 1714}
@@ -3138,7 +3152,8 @@ int dispc_setup_plane(enum omap_plane plane,
3138 enum omap_color_mode color_mode, 3152 enum omap_color_mode color_mode,
3139 bool ilace, 3153 bool ilace,
3140 enum omap_dss_rotation_type rotation_type, 3154 enum omap_dss_rotation_type rotation_type,
3141 u8 rotation, bool mirror, u8 global_alpha) 3155 u8 rotation, bool mirror, u8 global_alpha,
3156 u8 pre_mult_alpha)
3142{ 3157{
3143 int r = 0; 3158 int r = 0;
3144 3159
@@ -3160,7 +3175,8 @@ int dispc_setup_plane(enum omap_plane plane,
3160 color_mode, ilace, 3175 color_mode, ilace,
3161 rotation_type, 3176 rotation_type,
3162 rotation, mirror, 3177 rotation, mirror,
3163 global_alpha); 3178 global_alpha,
3179 pre_mult_alpha);
3164 3180
3165 enable_clocks(0); 3181 enable_clocks(0);
3166 3182
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 5c7940d5f282..2bb515c61f4b 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -359,7 +359,8 @@ int dispc_setup_plane(enum omap_plane plane,
359 bool ilace, 359 bool ilace,
360 enum omap_dss_rotation_type rotation_type, 360 enum omap_dss_rotation_type rotation_type,
361 u8 rotation, bool mirror, 361 u8 rotation, bool mirror,
362 u8 global_alpha); 362 u8 global_alpha,
363 u8 pre_mult_alpha);
363 364
364bool dispc_go_busy(enum omap_channel channel); 365bool dispc_go_busy(enum omap_channel channel);
365void dispc_go(enum omap_channel channel); 366void dispc_go(enum omap_channel channel);
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 545e9b9a4d92..873b33469060 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -406,6 +406,7 @@ struct overlay_cache_data {
406 u16 out_width; /* if 0, out_width == width */ 406 u16 out_width; /* if 0, out_width == width */
407 u16 out_height; /* if 0, out_height == height */ 407 u16 out_height; /* if 0, out_height == height */
408 u8 global_alpha; 408 u8 global_alpha;
409 u8 pre_mult_alpha;
409 410
410 enum omap_channel channel; 411 enum omap_channel channel;
411 bool replication; 412 bool replication;
@@ -842,7 +843,8 @@ static int configure_overlay(enum omap_plane plane)
842 c->rotation_type, 843 c->rotation_type,
843 c->rotation, 844 c->rotation,
844 c->mirror, 845 c->mirror,
845 c->global_alpha); 846 c->global_alpha,
847 c->pre_mult_alpha);
846 848
847 if (r) { 849 if (r) {
848 /* this shouldn't happen */ 850 /* this shouldn't happen */
@@ -1265,6 +1267,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
1265 oc->out_width = ovl->info.out_width; 1267 oc->out_width = ovl->info.out_width;
1266 oc->out_height = ovl->info.out_height; 1268 oc->out_height = ovl->info.out_height;
1267 oc->global_alpha = ovl->info.global_alpha; 1269 oc->global_alpha = ovl->info.global_alpha;
1270 oc->pre_mult_alpha = ovl->info.pre_mult_alpha;
1268 1271
1269 oc->replication = 1272 oc->replication =
1270 dss_use_replication(dssdev, ovl->info.color_mode); 1273 dss_use_replication(dssdev, ovl->info.color_mode);
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 75642c22cac7..41a29024a8d0 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -257,6 +257,43 @@ static ssize_t overlay_global_alpha_store(struct omap_overlay *ovl,
257 return size; 257 return size;
258} 258}
259 259
260static ssize_t overlay_pre_mult_alpha_show(struct omap_overlay *ovl,
261 char *buf)
262{
263 return snprintf(buf, PAGE_SIZE, "%d\n",
264 ovl->info.pre_mult_alpha);
265}
266
267static ssize_t overlay_pre_mult_alpha_store(struct omap_overlay *ovl,
268 const char *buf, size_t size)
269{
270 int r;
271 struct omap_overlay_info info;
272
273 ovl->get_overlay_info(ovl, &info);
274
275 /* only GFX and Video2 plane support pre alpha multiplied
276 * set zero for Video1 plane
277 */
278 if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) &&
279 ovl->id == OMAP_DSS_VIDEO1)
280 info.pre_mult_alpha = 0;
281 else
282 info.pre_mult_alpha = simple_strtoul(buf, NULL, 10);
283
284 r = ovl->set_overlay_info(ovl, &info);
285 if (r)
286 return r;
287
288 if (ovl->manager) {
289 r = ovl->manager->apply(ovl->manager);
290 if (r)
291 return r;
292 }
293
294 return size;
295}
296
260struct overlay_attribute { 297struct overlay_attribute {
261 struct attribute attr; 298 struct attribute attr;
262 ssize_t (*show)(struct omap_overlay *, char *); 299 ssize_t (*show)(struct omap_overlay *, char *);
@@ -280,6 +317,9 @@ static OVERLAY_ATTR(enabled, S_IRUGO|S_IWUSR,
280 overlay_enabled_show, overlay_enabled_store); 317 overlay_enabled_show, overlay_enabled_store);
281static OVERLAY_ATTR(global_alpha, S_IRUGO|S_IWUSR, 318static OVERLAY_ATTR(global_alpha, S_IRUGO|S_IWUSR,
282 overlay_global_alpha_show, overlay_global_alpha_store); 319 overlay_global_alpha_show, overlay_global_alpha_store);
320static OVERLAY_ATTR(pre_mult_alpha, S_IRUGO|S_IWUSR,
321 overlay_pre_mult_alpha_show,
322 overlay_pre_mult_alpha_store);
283 323
284static struct attribute *overlay_sysfs_attrs[] = { 324static struct attribute *overlay_sysfs_attrs[] = {
285 &overlay_attr_name.attr, 325 &overlay_attr_name.attr,
@@ -290,6 +330,7 @@ static struct attribute *overlay_sysfs_attrs[] = {
290 &overlay_attr_output_size.attr, 330 &overlay_attr_output_size.attr,
291 &overlay_attr_enabled.attr, 331 &overlay_attr_enabled.attr,
292 &overlay_attr_global_alpha.attr, 332 &overlay_attr_global_alpha.attr,
333 &overlay_attr_pre_mult_alpha.attr,
293 NULL 334 NULL
294}; 335};
295 336