summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorNishant Kamat <nskamat@ti.com>2011-06-20 11:09:28 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-07-01 05:07:12 -0400
commit4df9d104d5bbe356b26bcf221d61f92f1948850e (patch)
tree644b218fc477df7b83e7dff80c5075bd9d116583 /drivers/video
parent332e9d70518b55a70068739bc7ea134e1d8a269b (diff)
OMAP: DSS: Minor cleanup in ovl and mgr cache structs
The overlay_cache_data and manager_cache_data structs include the elements of omap_overlay_info and omap_overlay_manager_info structs respectively. Include the structs instead of the individual elements to reduce code. Signed-off-by: Nishant Kamat <nskamat@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/manager.c158
1 files changed, 62 insertions, 96 deletions
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 18a1b9286c44..665992d8cc9e 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -391,23 +391,7 @@ struct overlay_cache_data {
391 391
392 bool enabled; 392 bool enabled;
393 393
394 u32 paddr; 394 struct omap_overlay_info info;
395 void __iomem *vaddr;
396 u32 p_uv_addr; /* relevant for NV12 format only */
397 u16 screen_width;
398 u16 width;
399 u16 height;
400 enum omap_color_mode color_mode;
401 u8 rotation;
402 enum omap_dss_rotation_type rotation_type;
403 bool mirror;
404
405 u16 pos_x;
406 u16 pos_y;
407 u16 out_width; /* if 0, out_width == width */
408 u16 out_height; /* if 0, out_height == height */
409 u8 global_alpha;
410 u8 pre_mult_alpha;
411 395
412 enum omap_channel channel; 396 enum omap_channel channel;
413 bool replication; 397 bool replication;
@@ -427,13 +411,7 @@ struct manager_cache_data {
427 * VSYNC/EVSYNC */ 411 * VSYNC/EVSYNC */
428 bool shadow_dirty; 412 bool shadow_dirty;
429 413
430 u32 default_color; 414 struct omap_overlay_manager_info info;
431
432 enum omap_dss_trans_key_type trans_key_type;
433 u32 trans_key;
434 bool trans_enabled;
435
436 bool alpha_enabled;
437 415
438 bool manual_update; 416 bool manual_update;
439 bool do_manual_update; 417 bool do_manual_update;
@@ -699,10 +677,12 @@ static bool rectangle_intersects(int x1, int y1, int w1, int h1,
699 677
700static bool dispc_is_overlay_scaled(struct overlay_cache_data *oc) 678static bool dispc_is_overlay_scaled(struct overlay_cache_data *oc)
701{ 679{
702 if (oc->out_width != 0 && oc->width != oc->out_width) 680 struct omap_overlay_info *oi = &oc->info;
681
682 if (oi->out_width != 0 && oi->width != oi->out_width)
703 return true; 683 return true;
704 684
705 if (oc->out_height != 0 && oc->height != oc->out_height) 685 if (oi->out_height != 0 && oi->height != oi->out_height)
706 return true; 686 return true;
707 687
708 return false; 688 return false;
@@ -712,6 +692,8 @@ static int configure_overlay(enum omap_plane plane)
712{ 692{
713 struct overlay_cache_data *c; 693 struct overlay_cache_data *c;
714 struct manager_cache_data *mc; 694 struct manager_cache_data *mc;
695 struct omap_overlay_info *oi;
696 struct omap_overlay_manager_info *mi;
715 u16 outw, outh; 697 u16 outw, outh;
716 u16 x, y, w, h; 698 u16 x, y, w, h;
717 u32 paddr; 699 u32 paddr;
@@ -721,6 +703,7 @@ static int configure_overlay(enum omap_plane plane)
721 DSSDBGF("%d", plane); 703 DSSDBGF("%d", plane);
722 704
723 c = &dss_cache.overlay_cache[plane]; 705 c = &dss_cache.overlay_cache[plane];
706 oi = &c->info;
724 707
725 if (!c->enabled) { 708 if (!c->enabled) {
726 dispc_enable_plane(plane, 0); 709 dispc_enable_plane(plane, 0);
@@ -728,14 +711,15 @@ static int configure_overlay(enum omap_plane plane)
728 } 711 }
729 712
730 mc = &dss_cache.manager_cache[c->channel]; 713 mc = &dss_cache.manager_cache[c->channel];
714 mi = &mc->info;
731 715
732 x = c->pos_x; 716 x = oi->pos_x;
733 y = c->pos_y; 717 y = oi->pos_y;
734 w = c->width; 718 w = oi->width;
735 h = c->height; 719 h = oi->height;
736 outw = c->out_width == 0 ? c->width : c->out_width; 720 outw = oi->out_width == 0 ? oi->width : oi->out_width;
737 outh = c->out_height == 0 ? c->height : c->out_height; 721 outh = oi->out_height == 0 ? oi->height : oi->out_height;
738 paddr = c->paddr; 722 paddr = oi->paddr;
739 723
740 orig_w = w; 724 orig_w = w;
741 orig_h = h; 725 orig_h = h;
@@ -754,7 +738,7 @@ static int configure_overlay(enum omap_plane plane)
754 return 0; 738 return 0;
755 } 739 }
756 740
757 switch (c->color_mode) { 741 switch (oi->color_mode) {
758 case OMAP_DSS_COLOR_NV12: 742 case OMAP_DSS_COLOR_NV12:
759 bpp = 8; 743 bpp = 8;
760 break; 744 break;
@@ -784,23 +768,23 @@ static int configure_overlay(enum omap_plane plane)
784 BUG(); 768 BUG();
785 } 769 }
786 770
787 if (mc->x > c->pos_x) { 771 if (mc->x > oi->pos_x) {
788 x = 0; 772 x = 0;
789 outw -= (mc->x - c->pos_x); 773 outw -= (mc->x - oi->pos_x);
790 paddr += (mc->x - c->pos_x) * 774 paddr += (mc->x - oi->pos_x) *
791 scale_x_m / scale_x_d * bpp / 8; 775 scale_x_m / scale_x_d * bpp / 8;
792 } else { 776 } else {
793 x = c->pos_x - mc->x; 777 x = oi->pos_x - mc->x;
794 } 778 }
795 779
796 if (mc->y > c->pos_y) { 780 if (mc->y > oi->pos_y) {
797 y = 0; 781 y = 0;
798 outh -= (mc->y - c->pos_y); 782 outh -= (mc->y - oi->pos_y);
799 paddr += (mc->y - c->pos_y) * 783 paddr += (mc->y - oi->pos_y) *
800 scale_y_m / scale_y_d * 784 scale_y_m / scale_y_d *
801 c->screen_width * bpp / 8; 785 oi->screen_width * bpp / 8;
802 } else { 786 } else {
803 y = c->pos_y - mc->y; 787 y = oi->pos_y - mc->y;
804 } 788 }
805 789
806 if (mc->w < (x + outw)) 790 if (mc->w < (x + outw))
@@ -819,8 +803,8 @@ static int configure_overlay(enum omap_plane plane)
819 * the width if the original width was bigger. 803 * the width if the original width was bigger.
820 */ 804 */
821 if ((w & 1) && 805 if ((w & 1) &&
822 (c->color_mode == OMAP_DSS_COLOR_YUV2 || 806 (oi->color_mode == OMAP_DSS_COLOR_YUV2 ||
823 c->color_mode == OMAP_DSS_COLOR_UYVY)) { 807 oi->color_mode == OMAP_DSS_COLOR_UYVY)) {
824 if (orig_w > w) 808 if (orig_w > w)
825 w += 1; 809 w += 1;
826 else 810 else
@@ -830,19 +814,19 @@ static int configure_overlay(enum omap_plane plane)
830 814
831 r = dispc_setup_plane(plane, 815 r = dispc_setup_plane(plane,
832 paddr, 816 paddr,
833 c->screen_width, 817 oi->screen_width,
834 x, y, 818 x, y,
835 w, h, 819 w, h,
836 outw, outh, 820 outw, outh,
837 c->color_mode, 821 oi->color_mode,
838 c->ilace, 822 c->ilace,
839 c->rotation_type, 823 oi->rotation_type,
840 c->rotation, 824 oi->rotation,
841 c->mirror, 825 oi->mirror,
842 c->global_alpha, 826 oi->global_alpha,
843 c->pre_mult_alpha, 827 oi->pre_mult_alpha,
844 c->channel, 828 c->channel,
845 c->p_uv_addr); 829 oi->p_uv_addr);
846 830
847 if (r) { 831 if (r) {
848 /* this shouldn't happen */ 832 /* this shouldn't happen */
@@ -863,16 +847,17 @@ static int configure_overlay(enum omap_plane plane)
863 847
864static void configure_manager(enum omap_channel channel) 848static void configure_manager(enum omap_channel channel)
865{ 849{
866 struct manager_cache_data *c; 850 struct omap_overlay_manager_info *mi;
867 851
868 DSSDBGF("%d", channel); 852 DSSDBGF("%d", channel);
869 853
870 c = &dss_cache.manager_cache[channel]; 854 /* picking info from the cache */
855 mi = &dss_cache.manager_cache[channel].info;
871 856
872 dispc_set_default_color(channel, c->default_color); 857 dispc_set_default_color(channel, mi->default_color);
873 dispc_set_trans_key(channel, c->trans_key_type, c->trans_key); 858 dispc_set_trans_key(channel, mi->trans_key_type, mi->trans_key);
874 dispc_enable_trans_key(channel, c->trans_enabled); 859 dispc_enable_trans_key(channel, mi->trans_enabled);
875 dispc_enable_alpha_blending(channel, c->alpha_enabled); 860 dispc_enable_alpha_blending(channel, mi->alpha_enabled);
876} 861}
877 862
878/* configure_dispc() tries to write values from cache to shadow registers. 863/* configure_dispc() tries to write values from cache to shadow registers.
@@ -990,6 +975,7 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev,
990{ 975{
991 struct overlay_cache_data *oc; 976 struct overlay_cache_data *oc;
992 struct manager_cache_data *mc; 977 struct manager_cache_data *mc;
978 struct omap_overlay_info *oi;
993 const int num_ovls = dss_feat_get_num_ovls(); 979 const int num_ovls = dss_feat_get_num_ovls();
994 struct omap_overlay_manager *mgr; 980 struct omap_overlay_manager *mgr;
995 int i; 981 int i;
@@ -1032,6 +1018,7 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev,
1032 unsigned outw, outh; 1018 unsigned outw, outh;
1033 1019
1034 oc = &dss_cache.overlay_cache[i]; 1020 oc = &dss_cache.overlay_cache[i];
1021 oi = &oc->info;
1035 1022
1036 if (oc->channel != mgr->id) 1023 if (oc->channel != mgr->id)
1037 continue; 1024 continue;
@@ -1047,39 +1034,39 @@ void dss_setup_partial_planes(struct omap_dss_device *dssdev,
1047 if (!dispc_is_overlay_scaled(oc)) 1034 if (!dispc_is_overlay_scaled(oc))
1048 continue; 1035 continue;
1049 1036
1050 outw = oc->out_width == 0 ? 1037 outw = oi->out_width == 0 ?
1051 oc->width : oc->out_width; 1038 oi->width : oi->out_width;
1052 outh = oc->out_height == 0 ? 1039 outh = oi->out_height == 0 ?
1053 oc->height : oc->out_height; 1040 oi->height : oi->out_height;
1054 1041
1055 /* is the overlay outside the update region? */ 1042 /* is the overlay outside the update region? */
1056 if (!rectangle_intersects(x, y, w, h, 1043 if (!rectangle_intersects(x, y, w, h,
1057 oc->pos_x, oc->pos_y, 1044 oi->pos_x, oi->pos_y,
1058 outw, outh)) 1045 outw, outh))
1059 continue; 1046 continue;
1060 1047
1061 /* if the overlay totally inside the update region? */ 1048 /* if the overlay totally inside the update region? */
1062 if (rectangle_subset(oc->pos_x, oc->pos_y, outw, outh, 1049 if (rectangle_subset(oi->pos_x, oi->pos_y, outw, outh,
1063 x, y, w, h)) 1050 x, y, w, h))
1064 continue; 1051 continue;
1065 1052
1066 if (x > oc->pos_x) 1053 if (x > oi->pos_x)
1067 x1 = oc->pos_x; 1054 x1 = oi->pos_x;
1068 else 1055 else
1069 x1 = x; 1056 x1 = x;
1070 1057
1071 if (y > oc->pos_y) 1058 if (y > oi->pos_y)
1072 y1 = oc->pos_y; 1059 y1 = oi->pos_y;
1073 else 1060 else
1074 y1 = y; 1061 y1 = y;
1075 1062
1076 if ((x + w) < (oc->pos_x + outw)) 1063 if ((x + w) < (oi->pos_x + outw))
1077 x2 = oc->pos_x + outw; 1064 x2 = oi->pos_x + outw;
1078 else 1065 else
1079 x2 = x + w; 1066 x2 = x + w;
1080 1067
1081 if ((y + h) < (oc->pos_y + outh)) 1068 if ((y + h) < (oi->pos_y + outh))
1082 y2 = oc->pos_y + outh; 1069 y2 = oi->pos_y + outh;
1083 else 1070 else
1084 y2 = y + h; 1071 y2 = y + h;
1085 1072
@@ -1254,23 +1241,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
1254 1241
1255 ovl->info_dirty = false; 1242 ovl->info_dirty = false;
1256 oc->dirty = true; 1243 oc->dirty = true;
1257 1244 oc->info = ovl->info;
1258 oc->paddr = ovl->info.paddr;
1259 oc->vaddr = ovl->info.vaddr;
1260 oc->p_uv_addr = ovl->info.p_uv_addr;
1261 oc->screen_width = ovl->info.screen_width;
1262 oc->width = ovl->info.width;
1263 oc->height = ovl->info.height;
1264 oc->color_mode = ovl->info.color_mode;
1265 oc->rotation = ovl->info.rotation;
1266 oc->rotation_type = ovl->info.rotation_type;
1267 oc->mirror = ovl->info.mirror;
1268 oc->pos_x = ovl->info.pos_x;
1269 oc->pos_y = ovl->info.pos_y;
1270 oc->out_width = ovl->info.out_width;
1271 oc->out_height = ovl->info.out_height;
1272 oc->global_alpha = ovl->info.global_alpha;
1273 oc->pre_mult_alpha = ovl->info.pre_mult_alpha;
1274 1245
1275 oc->replication = 1246 oc->replication =
1276 dss_use_replication(dssdev, ovl->info.color_mode); 1247 dss_use_replication(dssdev, ovl->info.color_mode);
@@ -1308,12 +1279,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
1308 1279
1309 mgr->info_dirty = false; 1280 mgr->info_dirty = false;
1310 mc->dirty = true; 1281 mc->dirty = true;
1311 1282 mc->info = mgr->info;
1312 mc->default_color = mgr->info.default_color;
1313 mc->trans_key_type = mgr->info.trans_key_type;
1314 mc->trans_key = mgr->info.trans_key;
1315 mc->trans_enabled = mgr->info.trans_enabled;
1316 mc->alpha_enabled = mgr->info.alpha_enabled;
1317 1283
1318 mc->manual_update = 1284 mc->manual_update =
1319 dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; 1285 dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;