OMAPDSS: OVERLAY: Add position and replication as overlay caps
authorArchit Taneja <archit@ti.com>
Sat, 22 Sep 2012 07:00:17 +0000 (12:30 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 26 Sep 2012 11:58:49 +0000 (14:58 +0300)
Add position and replication as overlay caps, and pass overlay caps as an
argument to the corresponding functions. Adding position and replication to
overlay caps seems a bit unnecessary, but it allows us to use the
corresponding functions for writeback too.

These caps will be set for all overlays, but not for writeback. This is done
so writeback can reuse dispc_ovl_setup() to the maximum.

Signed-off-by: Archit Taneja <archit@ti.com>
drivers/video/omap2/dss/dispc.c
drivers/video/omap2/dss/dss_features.c
include/video/omapdss.h

index 334842a3b52736e6c252e153a6f0af6ecd6991da..3e1007810f832ccaed8afeb8d89870ef19c34999 100644 (file)
@@ -698,9 +698,15 @@ static void dispc_ovl_set_ba1_uv(enum omap_plane plane, u32 paddr)
        dispc_write_reg(DISPC_OVL_BA1_UV(plane), paddr);
 }
 
-static void dispc_ovl_set_pos(enum omap_plane plane, int x, int y)
+static void dispc_ovl_set_pos(enum omap_plane plane,
+               enum omap_overlay_caps caps, int x, int y)
 {
-       u32 val = FLD_VAL(y, 26, 16) | FLD_VAL(x, 10, 0);
+       u32 val;
+
+       if ((caps & OMAP_DSS_OVL_CAP_POS) == 0)
+               return;
+
+       val = FLD_VAL(y, 26, 16) | FLD_VAL(x, 10, 0);
 
        dispc_write_reg(DISPC_OVL_POSITION(plane), val);
 }
@@ -1051,11 +1057,15 @@ static void dispc_ovl_set_vid_color_conv(enum omap_plane plane, bool enable)
        dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), val);
 }
 
-static void dispc_ovl_enable_replication(enum omap_plane plane, bool enable)
+static void dispc_ovl_enable_replication(enum omap_plane plane,
+               enum omap_overlay_caps caps, bool enable)
 {
        static const unsigned shifts[] = { 5, 10, 10, 10 };
        int shift;
 
+       if ((caps & OMAP_DSS_OVL_CAP_REPLICATION) == 0)
+               return;
+
        shift = shifts[plane];
        REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable, shift, shift);
 }
@@ -2385,7 +2395,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
        DSSDBG("%d,%d %dx%d -> %dx%d\n", oi->pos_x, oi->pos_y, in_width,
                        in_height, out_width, out_height);
 
-       dispc_ovl_set_pos(plane, oi->pos_x, pos_y);
+       dispc_ovl_set_pos(plane, caps, oi->pos_x, pos_y);
 
        dispc_ovl_set_input_size(plane, in_width, in_height);
 
@@ -2405,7 +2415,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
        dispc_ovl_set_pre_mult_alpha(plane, caps, oi->pre_mult_alpha);
        dispc_ovl_setup_global_alpha(plane, caps, oi->global_alpha);
 
-       dispc_ovl_enable_replication(plane, replication);
+       dispc_ovl_enable_replication(plane, caps, replication);
 
        return 0;
 }
index bfe7fc7b8593488e43e6bd9578986751a2239b9e..5a5c25b134b1edf7944e8230ed8c4504e3b9181e 100644 (file)
@@ -314,54 +314,66 @@ static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
 
 static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
        /* OMAP_DSS_GFX */
-       0,
+       OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO1 */
-       OMAP_DSS_OVL_CAP_SCALE,
+       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO2 */
-       OMAP_DSS_OVL_CAP_SCALE,
+       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 };
 
 static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
        /* OMAP_DSS_GFX */
-       OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
+       OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO1 */
-       OMAP_DSS_OVL_CAP_SCALE,
+       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO2 */
-       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
+       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
+               OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 };
 
 static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
        /* OMAP_DSS_GFX */
-       OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
+       OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
+               OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO1 */
-       OMAP_DSS_OVL_CAP_SCALE,
+       OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO2 */
        OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
-               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
+               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 };
 
 static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
        /* OMAP_DSS_GFX */
        OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
-               OMAP_DSS_OVL_CAP_ZORDER,
+               OMAP_DSS_OVL_CAP_ZORDER | OMAP_DSS_OVL_CAP_POS |
+               OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO1 */
        OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
-               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
+               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
+               OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO2 */
        OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
-               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
+               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
+               OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 
        /* OMAP_DSS_VIDEO3 */
        OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
-               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
+               OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER |
+               OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
 };
 
 static const char * const omap2_dss_clk_source_names[] = {
index e65e2e9e16eb7860348e39ba382edec86248261c..46097bd052a284a68de5e9623fa094f94fb78e5a 100644 (file)
@@ -187,6 +187,8 @@ enum omap_overlay_caps {
        OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
        OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
        OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
+       OMAP_DSS_OVL_CAP_POS = 1 << 4,
+       OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
 };
 
 enum omap_overlay_manager_caps {