diff options
author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-06-09 08:31:34 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-08-05 09:52:03 -0400 |
commit | 26a8c2507a224d39003665cd6e7678520c733c04 (patch) | |
tree | a8063c2ecffe9e90f6fb719d62b5b0343eaa67ea | |
parent | ab83b14c829e35436b423947bb5b151133314346 (diff) |
OMAP: DSS2: change manual update scaling setup
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>
-rw-r--r-- | arch/arm/plat-omap/include/plat/display.h | 3 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 6 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 3 | ||||
-rw-r--r-- | drivers/video/omap2/dss/manager.c | 69 | ||||
-rw-r--r-- | drivers/video/omap2/dss/rfbi.c | 2 |
6 files changed, 50 insertions, 35 deletions
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h index b8de70479313..8bd15bdb4132 100644 --- a/arch/arm/plat-omap/include/plat/display.h +++ b/arch/arm/plat-omap/include/plat/display.h | |||
@@ -560,7 +560,8 @@ void omapdss_dsi_vc_enable_hs(int channel, bool enable); | |||
560 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); | 560 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); |
561 | 561 | ||
562 | int omap_dsi_prepare_update(struct omap_dss_device *dssdev, | 562 | int omap_dsi_prepare_update(struct omap_dss_device *dssdev, |
563 | u16 *x, u16 *y, u16 *w, u16 *h); | 563 | u16 *x, u16 *y, u16 *w, u16 *h, |
564 | bool enlarge_update_area); | ||
564 | int omap_dsi_update(struct omap_dss_device *dssdev, | 565 | int omap_dsi_update(struct omap_dss_device *dssdev, |
565 | int channel, | 566 | int channel, |
566 | u16 x, u16 y, u16 w, u16 h, | 567 | u16 x, u16 y, u16 w, u16 h, |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 2a91d5662c07..6848e3633ed9 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -1135,7 +1135,7 @@ static int taal_update(struct omap_dss_device *dssdev, | |||
1135 | goto err; | 1135 | goto err; |
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | r = omap_dsi_prepare_update(dssdev, &x, &y, &w, &h); | 1138 | r = omap_dsi_prepare_update(dssdev, &x, &y, &w, &h, true); |
1139 | if (r) | 1139 | if (r) |
1140 | goto err; | 1140 | goto err; |
1141 | 1141 | ||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 32297b4f7abb..d0881e948bcf 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -2860,7 +2860,8 @@ static void dsi_framedone_irq_callback(void *data, u32 mask) | |||
2860 | } | 2860 | } |
2861 | 2861 | ||
2862 | int omap_dsi_prepare_update(struct omap_dss_device *dssdev, | 2862 | int omap_dsi_prepare_update(struct omap_dss_device *dssdev, |
2863 | u16 *x, u16 *y, u16 *w, u16 *h) | 2863 | u16 *x, u16 *y, u16 *w, u16 *h, |
2864 | bool enlarge_update_area) | ||
2864 | { | 2865 | { |
2865 | u16 dw, dh; | 2866 | u16 dw, dh; |
2866 | 2867 | ||
@@ -2884,7 +2885,8 @@ int omap_dsi_prepare_update(struct omap_dss_device *dssdev, | |||
2884 | dsi_perf_mark_setup(); | 2885 | dsi_perf_mark_setup(); |
2885 | 2886 | ||
2886 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 2887 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
2887 | dss_setup_partial_planes(dssdev, x, y, w, h); | 2888 | dss_setup_partial_planes(dssdev, x, y, w, h, |
2889 | enlarge_update_area); | ||
2888 | dispc_set_lcd_size(*w, *h); | 2890 | dispc_set_lcd_size(*w, *h); |
2889 | } | 2891 | } |
2890 | 2892 | ||
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 66e8e97d06a7..5c7940d5f282 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -199,7 +199,8 @@ int dss_init_overlay_managers(struct platform_device *pdev); | |||
199 | void dss_uninit_overlay_managers(struct platform_device *pdev); | 199 | void dss_uninit_overlay_managers(struct platform_device *pdev); |
200 | int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl); | 200 | int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl); |
201 | void dss_setup_partial_planes(struct omap_dss_device *dssdev, | 201 | void dss_setup_partial_planes(struct omap_dss_device *dssdev, |
202 | u16 *x, u16 *y, u16 *w, u16 *h); | 202 | u16 *x, u16 *y, u16 *w, u16 *h, |
203 | bool enlarge_update_area); | ||
203 | void dss_start_update(struct omap_dss_device *dssdev); | 204 | void dss_start_update(struct omap_dss_device *dssdev); |
204 | 205 | ||
205 | /* overlay */ | 206 | /* overlay */ |
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index a1d84ef65904..4b09fcb432b3 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -440,6 +440,10 @@ struct manager_cache_data { | |||
440 | 440 | ||
441 | /* manual update region */ | 441 | /* manual update region */ |
442 | u16 x, y, w, h; | 442 | u16 x, y, w, h; |
443 | |||
444 | /* enlarge the update area if the update area contains scaled | ||
445 | * overlays */ | ||
446 | bool enlarge_update_area; | ||
443 | }; | 447 | }; |
444 | 448 | ||
445 | static struct { | 449 | static struct { |
@@ -721,6 +725,7 @@ static int configure_overlay(enum omap_plane plane) | |||
721 | u16 x, y, w, h; | 725 | u16 x, y, w, h; |
722 | u32 paddr; | 726 | u32 paddr; |
723 | int r; | 727 | int r; |
728 | u16 orig_w, orig_h, orig_outw, orig_outh; | ||
724 | 729 | ||
725 | DSSDBGF("%d", plane); | 730 | DSSDBGF("%d", plane); |
726 | 731 | ||
@@ -741,8 +746,16 @@ static int configure_overlay(enum omap_plane plane) | |||
741 | outh = c->out_height == 0 ? c->height : c->out_height; | 746 | outh = c->out_height == 0 ? c->height : c->out_height; |
742 | paddr = c->paddr; | 747 | paddr = c->paddr; |
743 | 748 | ||
749 | orig_w = w; | ||
750 | orig_h = h; | ||
751 | orig_outw = outw; | ||
752 | orig_outh = outh; | ||
753 | |||
744 | if (c->manual_update && mc->do_manual_update) { | 754 | if (c->manual_update && mc->do_manual_update) { |
745 | unsigned bpp; | 755 | unsigned bpp; |
756 | unsigned scale_x_m = w, scale_x_d = outw; | ||
757 | unsigned scale_y_m = h, scale_y_d = outh; | ||
758 | |||
746 | /* If the overlay is outside the update region, disable it */ | 759 | /* If the overlay is outside the update region, disable it */ |
747 | if (!rectangle_intersects(mc->x, mc->y, mc->w, mc->h, | 760 | if (!rectangle_intersects(mc->x, mc->y, mc->w, mc->h, |
748 | x, y, outw, outh)) { | 761 | x, y, outw, outh)) { |
@@ -773,39 +786,33 @@ static int configure_overlay(enum omap_plane plane) | |||
773 | BUG(); | 786 | BUG(); |
774 | } | 787 | } |
775 | 788 | ||
776 | if (dispc_is_overlay_scaled(c)) { | 789 | if (mc->x > c->pos_x) { |
777 | /* If the overlay is scaled, the update area has | 790 | x = 0; |
778 | * already been enlarged to cover the whole overlay. We | 791 | outw -= (mc->x - c->pos_x); |
779 | * only need to adjust x/y here */ | 792 | paddr += (mc->x - c->pos_x) * |
780 | x = c->pos_x - mc->x; | 793 | scale_x_m / scale_x_d * bpp / 8; |
781 | y = c->pos_y - mc->y; | ||
782 | } else { | 794 | } else { |
783 | if (mc->x > c->pos_x) { | 795 | x = c->pos_x - mc->x; |
784 | x = 0; | 796 | } |
785 | w -= (mc->x - c->pos_x); | ||
786 | paddr += (mc->x - c->pos_x) * bpp / 8; | ||
787 | } else { | ||
788 | x = c->pos_x - mc->x; | ||
789 | } | ||
790 | 797 | ||
791 | if (mc->y > c->pos_y) { | 798 | if (mc->y > c->pos_y) { |
792 | y = 0; | 799 | y = 0; |
793 | h -= (mc->y - c->pos_y); | 800 | outh -= (mc->y - c->pos_y); |
794 | paddr += (mc->y - c->pos_y) * c->screen_width * | 801 | paddr += (mc->y - c->pos_y) * |
795 | bpp / 8; | 802 | scale_y_m / scale_y_d * |
796 | } else { | 803 | c->screen_width * bpp / 8; |
797 | y = c->pos_y - mc->y; | 804 | } else { |
798 | } | 805 | y = c->pos_y - mc->y; |
806 | } | ||
799 | 807 | ||
800 | if (mc->w < (x+w)) | 808 | if (mc->w < (x + outw)) |
801 | w -= (x+w) - (mc->w); | 809 | outw -= (x + outw) - (mc->w); |
802 | 810 | ||
803 | if (mc->h < (y+h)) | 811 | if (mc->h < (y + outh)) |
804 | h -= (y+h) - (mc->h); | 812 | outh -= (y + outh) - (mc->h); |
805 | 813 | ||
806 | outw = w; | 814 | w = w * outw / orig_outw; |
807 | outh = h; | 815 | h = h * outh / orig_outh; |
808 | } | ||
809 | } | 816 | } |
810 | 817 | ||
811 | r = dispc_setup_plane(plane, | 818 | r = dispc_setup_plane(plane, |
@@ -963,7 +970,7 @@ static void make_even(u16 *x, u16 *w) | |||
963 | /* Configure dispc for partial update. Return possibly modified update | 970 | /* Configure dispc for partial update. Return possibly modified update |
964 | * area */ | 971 | * area */ |
965 | void dss_setup_partial_planes(struct omap_dss_device *dssdev, | 972 | void dss_setup_partial_planes(struct omap_dss_device *dssdev, |
966 | u16 *xi, u16 *yi, u16 *wi, u16 *hi) | 973 | u16 *xi, u16 *yi, u16 *wi, u16 *hi, bool enlarge_update_area) |
967 | { | 974 | { |
968 | struct overlay_cache_data *oc; | 975 | struct overlay_cache_data *oc; |
969 | struct manager_cache_data *mc; | 976 | struct manager_cache_data *mc; |
@@ -1015,6 +1022,9 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev, | |||
1015 | 1022 | ||
1016 | oc->dirty = true; | 1023 | oc->dirty = true; |
1017 | 1024 | ||
1025 | if (!enlarge_update_area) | ||
1026 | continue; | ||
1027 | |||
1018 | if (!oc->enabled) | 1028 | if (!oc->enabled) |
1019 | continue; | 1029 | continue; |
1020 | 1030 | ||
@@ -1074,6 +1084,7 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev, | |||
1074 | 1084 | ||
1075 | mc = &dss_cache.manager_cache[mgr->id]; | 1085 | mc = &dss_cache.manager_cache[mgr->id]; |
1076 | mc->do_manual_update = true; | 1086 | mc->do_manual_update = true; |
1087 | mc->enlarge_update_area = enlarge_update_area; | ||
1077 | mc->x = x; | 1088 | mc->x = x; |
1078 | mc->y = y; | 1089 | mc->y = y; |
1079 | mc->w = w; | 1090 | mc->w = w; |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index cc23f53cc62d..bbe62464e92d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -886,7 +886,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev, | |||
886 | return -EINVAL; | 886 | return -EINVAL; |
887 | 887 | ||
888 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 888 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
889 | dss_setup_partial_planes(dssdev, x, y, w, h); | 889 | dss_setup_partial_planes(dssdev, x, y, w, h, true); |
890 | dispc_set_lcd_size(*w, *h); | 890 | dispc_set_lcd_size(*w, *h); |
891 | } | 891 | } |
892 | 892 | ||