]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAP: DSS2: change manual update scaling setup
authorTomi Valkeinen <tomi.valkeinen@nokia.com>
Wed, 9 Jun 2010 12:31:34 +0000 (15:31 +0300)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Thu, 5 Aug 2010 13:52:03 +0000 (16:52 +0300)
Currently the update area on manual update displays is automatically
enlargened to fully cover scaled overlays. This patch makes that
optional, allowing the panel driver to choose if it's used or not.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
arch/arm/plat-omap/include/plat/display.h
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/manager.c
drivers/video/omap2/dss/rfbi.c

index b8de704793136507c142696418b9e116f814ac60..8bd15bdb4132c1532fdd0704c88af5206b7f6e15 100644 (file)
@@ -560,7 +560,8 @@ void omapdss_dsi_vc_enable_hs(int channel, bool enable);
 int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
 
 int omap_dsi_prepare_update(struct omap_dss_device *dssdev,
-                                   u16 *x, u16 *y, u16 *w, u16 *h);
+                                   u16 *x, u16 *y, u16 *w, u16 *h,
+                                   bool enlarge_update_area);
 int omap_dsi_update(struct omap_dss_device *dssdev,
                int channel,
                u16 x, u16 y, u16 w, u16 h,
index 2a91d5662c0750a7aefb4a9de163b647c84f3269..6848e3633ed934146454ec6e4cb45af855492989 100644 (file)
@@ -1135,7 +1135,7 @@ static int taal_update(struct omap_dss_device *dssdev,
                goto err;
        }
 
-       r = omap_dsi_prepare_update(dssdev, &x, &y, &w, &h);
+       r = omap_dsi_prepare_update(dssdev, &x, &y, &w, &h, true);
        if (r)
                goto err;
 
index 32297b4f7abb686314e6b40bf8f8a5a6e648f264..d0881e948bcf2f64fd299dfda58178fe4c59bf0d 100644 (file)
@@ -2860,7 +2860,8 @@ static void dsi_framedone_irq_callback(void *data, u32 mask)
 }
 
 int omap_dsi_prepare_update(struct omap_dss_device *dssdev,
-                                   u16 *x, u16 *y, u16 *w, u16 *h)
+                                   u16 *x, u16 *y, u16 *w, u16 *h,
+                                   bool enlarge_update_area)
 {
        u16 dw, dh;
 
@@ -2884,7 +2885,8 @@ int omap_dsi_prepare_update(struct omap_dss_device *dssdev,
        dsi_perf_mark_setup();
 
        if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) {
-               dss_setup_partial_planes(dssdev, x, y, w, h);
+               dss_setup_partial_planes(dssdev, x, y, w, h,
+                               enlarge_update_area);
                dispc_set_lcd_size(*w, *h);
        }
 
index 66e8e97d06a724cb47cf953bdee8c81213f4b918..5c7940d5f282f3137be4f8451c76a5692609b3a0 100644 (file)
@@ -199,7 +199,8 @@ int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
 void dss_setup_partial_planes(struct omap_dss_device *dssdev,
-                               u16 *x, u16 *y, u16 *w, u16 *h);
+                               u16 *x, u16 *y, u16 *w, u16 *h,
+                               bool enlarge_update_area);
 void dss_start_update(struct omap_dss_device *dssdev);
 
 /* overlay */
index a1d84ef659043d5b64a561e0ae63d81cd24c0976..4b09fcb432b3de140c8bf6b0416010283e9ba478 100644 (file)
@@ -440,6 +440,10 @@ struct manager_cache_data {
 
        /* manual update region */
        u16 x, y, w, h;
+
+       /* enlarge the update area if the update area contains scaled
+        * overlays */
+       bool enlarge_update_area;
 };
 
 static struct {
@@ -721,6 +725,7 @@ static int configure_overlay(enum omap_plane plane)
        u16 x, y, w, h;
        u32 paddr;
        int r;
+       u16 orig_w, orig_h, orig_outw, orig_outh;
 
        DSSDBGF("%d", plane);
 
@@ -741,8 +746,16 @@ static int configure_overlay(enum omap_plane plane)
        outh = c->out_height == 0 ? c->height : c->out_height;
        paddr = c->paddr;
 
+       orig_w = w;
+       orig_h = h;
+       orig_outw = outw;
+       orig_outh = outh;
+
        if (c->manual_update && mc->do_manual_update) {
                unsigned bpp;
+               unsigned scale_x_m = w, scale_x_d = outw;
+               unsigned scale_y_m = h, scale_y_d = outh;
+
                /* If the overlay is outside the update region, disable it */
                if (!rectangle_intersects(mc->x, mc->y, mc->w, mc->h,
                                        x, y, outw, outh)) {
@@ -773,39 +786,33 @@ static int configure_overlay(enum omap_plane plane)
                        BUG();
                }
 
-               if (dispc_is_overlay_scaled(c)) {
-                       /* If the overlay is scaled, the update area has
-                        * already been enlarged to cover the whole overlay. We
-                        * only need to adjust x/y here */
-                       x = c->pos_x - mc->x;
-                       y = c->pos_y - mc->y;
+               if (mc->x > c->pos_x) {
+                       x = 0;
+                       outw -= (mc->x - c->pos_x);
+                       paddr += (mc->x - c->pos_x) *
+                               scale_x_m / scale_x_d * bpp / 8;
                } else {
-                       if (mc->x > c->pos_x) {
-                               x = 0;
-                               w -= (mc->x - c->pos_x);
-                               paddr += (mc->x - c->pos_x) * bpp / 8;
-                       } else {
-                               x = c->pos_x - mc->x;
-                       }
+                       x = c->pos_x - mc->x;
+               }
 
-                       if (mc->y > c->pos_y) {
-                               y = 0;
-                               h -= (mc->y - c->pos_y);
-                               paddr += (mc->y - c->pos_y) * c->screen_width *
-                                       bpp / 8;
-                       } else {
-                               y = c->pos_y - mc->y;
-                       }
+               if (mc->y > c->pos_y) {
+                       y = 0;
+                       outh -= (mc->y - c->pos_y);
+                       paddr += (mc->y - c->pos_y) *
+                               scale_y_m / scale_y_d *
+                               c->screen_width * bpp / 8;
+               } else {
+                       y = c->pos_y - mc->y;
+               }
 
-                       if (mc->w < (x+w))
-                               w -= (x+w) - (mc->w);
+               if (mc->w < (x + outw))
+                       outw -= (x + outw) - (mc->w);
 
-                       if (mc->h < (y+h))
-                               h -= (y+h) - (mc->h);
+               if (mc->h < (y + outh))
+                       outh -= (y + outh) - (mc->h);
 
-                       outw = w;
-                       outh = h;
-               }
+               w = w * outw / orig_outw;
+               h = h * outh / orig_outh;
        }
 
        r = dispc_setup_plane(plane,
@@ -963,7 +970,7 @@ static void make_even(u16 *x, u16 *w)
 /* Configure dispc for partial update. Return possibly modified update
  * area */
 void dss_setup_partial_planes(struct omap_dss_device *dssdev,
-               u16 *xi, u16 *yi, u16 *wi, u16 *hi)
+               u16 *xi, u16 *yi, u16 *wi, u16 *hi, bool enlarge_update_area)
 {
        struct overlay_cache_data *oc;
        struct manager_cache_data *mc;
@@ -1015,6 +1022,9 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev,
 
                        oc->dirty = true;
 
+                       if (!enlarge_update_area)
+                               continue;
+
                        if (!oc->enabled)
                                continue;
 
@@ -1074,6 +1084,7 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev,
 
        mc = &dss_cache.manager_cache[mgr->id];
        mc->do_manual_update = true;
+       mc->enlarge_update_area = enlarge_update_area;
        mc->x = x;
        mc->y = y;
        mc->w = w;
index cc23f53cc62d49968055d62359218043b562a674..bbe62464e92df533309f20ea59f4e2dbbe6c6d3e 100644 (file)
@@ -886,7 +886,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
                return -EINVAL;
 
        if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) {
-               dss_setup_partial_planes(dssdev, x, y, w, h);
+               dss_setup_partial_planes(dssdev, x, y, w, h, true);
                dispc_set_lcd_size(*w, *h);
        }