aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dispc.c
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-09-26 07:25:27 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-26 07:58:49 -0400
commit5b54ed3ec36ddc8ac25aff9233c7d3fb3e2b629a (patch)
tree31cd54f2e4c2bab238669cf9d10e4a8af196d846 /drivers/video/omap2/dss/dispc.c
parent78b687fc4ffa27d48c793f9669d53a6f4351e239 (diff)
OMAPDSS: DISPC: Pass overlay caps as a parameter to dispc plane functions
Currently, the functions below take the omap_plane parameter and derive the overlay caps within them. Pass the overlay caps as a parameter to the function to allow these to be used by writeback too. - dispc_ovl_set_zorder() - dispc_ovl_set_pre_mult_alpha() - dispc_ovl_setup_global_alpha() - dispc_ovl_calc_scaling() - dispc_ovl_setup() These functions will be used for writeback later, and the caps will help in deciding if they are to be used for writeback or not. This allows reuse of overlay caps for writeback. Using omap_overlay_caps for writeback seems a bit incorrect, but caps is something already in use by users of OMAPDSS(omapfb/omap_vout), so we use overlay caps for overlay like features of writeback too. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dispc.c')
-rw-r--r--drivers/video/omap2/dss/dispc.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 56e23040df08..334842a3b527 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -728,11 +728,10 @@ static void dispc_ovl_set_output_size(enum omap_plane plane, int width,
728 dispc_write_reg(DISPC_OVL_SIZE(plane), val); 728 dispc_write_reg(DISPC_OVL_SIZE(plane), val);
729} 729}
730 730
731static void dispc_ovl_set_zorder(enum omap_plane plane, u8 zorder) 731static void dispc_ovl_set_zorder(enum omap_plane plane,
732 enum omap_overlay_caps caps, u8 zorder)
732{ 733{
733 struct omap_overlay *ovl = omap_dss_get_overlay(plane); 734 if ((caps & OMAP_DSS_OVL_CAP_ZORDER) == 0)
734
735 if ((ovl->caps & OMAP_DSS_OVL_CAP_ZORDER) == 0)
736 return; 735 return;
737 736
738 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), zorder, 27, 26); 737 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), zorder, 27, 26);
@@ -749,23 +748,22 @@ static void dispc_ovl_enable_zorder_planes(void)
749 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25); 748 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25);
750} 749}
751 750
752static void dispc_ovl_set_pre_mult_alpha(enum omap_plane plane, bool enable) 751static void dispc_ovl_set_pre_mult_alpha(enum omap_plane plane,
752 enum omap_overlay_caps caps, bool enable)
753{ 753{
754 struct omap_overlay *ovl = omap_dss_get_overlay(plane); 754 if ((caps & OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA) == 0)
755
756 if ((ovl->caps & OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA) == 0)
757 return; 755 return;
758 756
759 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable ? 1 : 0, 28, 28); 757 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable ? 1 : 0, 28, 28);
760} 758}
761 759
762static void dispc_ovl_setup_global_alpha(enum omap_plane plane, u8 global_alpha) 760static void dispc_ovl_setup_global_alpha(enum omap_plane plane,
761 enum omap_overlay_caps caps, u8 global_alpha)
763{ 762{
764 static const unsigned shifts[] = { 0, 8, 16, 24, }; 763 static const unsigned shifts[] = { 0, 8, 16, 24, };
765 int shift; 764 int shift;
766 struct omap_overlay *ovl = omap_dss_get_overlay(plane);
767 765
768 if ((ovl->caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0) 766 if ((caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0)
769 return; 767 return;
770 768
771 shift = shifts[plane]; 769 shift = shifts[plane];
@@ -2193,14 +2191,13 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_channel channel,
2193} 2191}
2194 2192
2195static int dispc_ovl_calc_scaling(enum omap_plane plane, 2193static int dispc_ovl_calc_scaling(enum omap_plane plane,
2196 enum omap_channel channel, 2194 enum omap_overlay_caps caps, enum omap_channel channel,
2197 const struct omap_video_timings *mgr_timings, 2195 const struct omap_video_timings *mgr_timings,
2198 u16 width, u16 height, u16 out_width, u16 out_height, 2196 u16 width, u16 height, u16 out_width, u16 out_height,
2199 enum omap_color_mode color_mode, bool *five_taps, 2197 enum omap_color_mode color_mode, bool *five_taps,
2200 int *x_predecim, int *y_predecim, u16 pos_x, 2198 int *x_predecim, int *y_predecim, u16 pos_x,
2201 enum omap_dss_rotation_type rotation_type) 2199 enum omap_dss_rotation_type rotation_type)
2202{ 2200{
2203 struct omap_overlay *ovl = omap_dss_get_overlay(plane);
2204 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); 2201 const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
2205 const int max_decim_limit = 16; 2202 const int max_decim_limit = 16;
2206 unsigned long core_clk = 0; 2203 unsigned long core_clk = 0;
@@ -2209,7 +2206,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,
2209 if (width == out_width && height == out_height) 2206 if (width == out_width && height == out_height)
2210 return 0; 2207 return 0;
2211 2208
2212 if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) 2209 if ((caps & OMAP_DSS_OVL_CAP_SCALE) == 0)
2213 return -EINVAL; 2210 return -EINVAL;
2214 2211
2215 *x_predecim = max_decim_limit; 2212 *x_predecim = max_decim_limit;
@@ -2261,6 +2258,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
2261 bool replication, const struct omap_video_timings *mgr_timings) 2258 bool replication, const struct omap_video_timings *mgr_timings)
2262{ 2259{
2263 struct omap_overlay *ovl = omap_dss_get_overlay(plane); 2260 struct omap_overlay *ovl = omap_dss_get_overlay(plane);
2261 enum omap_overlay_caps caps = ovl->caps;
2264 bool five_taps = true; 2262 bool five_taps = true;
2265 bool fieldmode = 0; 2263 bool fieldmode = 0;
2266 int r, cconv = 0; 2264 int r, cconv = 0;
@@ -2309,7 +2307,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
2309 if (!dss_feat_color_mode_supported(plane, oi->color_mode)) 2307 if (!dss_feat_color_mode_supported(plane, oi->color_mode))
2310 return -EINVAL; 2308 return -EINVAL;
2311 2309
2312 r = dispc_ovl_calc_scaling(plane, channel, mgr_timings, in_width, 2310 r = dispc_ovl_calc_scaling(plane, caps, channel, mgr_timings, in_width,
2313 in_height, out_width, out_height, oi->color_mode, 2311 in_height, out_width, out_height, oi->color_mode,
2314 &five_taps, &x_predecim, &y_predecim, oi->pos_x, 2312 &five_taps, &x_predecim, &y_predecim, oi->pos_x,
2315 oi->rotation_type); 2313 oi->rotation_type);
@@ -2391,7 +2389,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
2391 2389
2392 dispc_ovl_set_input_size(plane, in_width, in_height); 2390 dispc_ovl_set_input_size(plane, in_width, in_height);
2393 2391
2394 if (ovl->caps & OMAP_DSS_OVL_CAP_SCALE) { 2392 if (caps & OMAP_DSS_OVL_CAP_SCALE) {
2395 dispc_ovl_set_scaling(plane, in_width, in_height, out_width, 2393 dispc_ovl_set_scaling(plane, in_width, in_height, out_width,
2396 out_height, ilace, five_taps, fieldmode, 2394 out_height, ilace, five_taps, fieldmode,
2397 oi->color_mode, oi->rotation); 2395 oi->color_mode, oi->rotation);
@@ -2403,9 +2401,9 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
2403 dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror, 2401 dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror,
2404 oi->color_mode); 2402 oi->color_mode);
2405 2403
2406 dispc_ovl_set_zorder(plane, oi->zorder); 2404 dispc_ovl_set_zorder(plane, caps, oi->zorder);
2407 dispc_ovl_set_pre_mult_alpha(plane, oi->pre_mult_alpha); 2405 dispc_ovl_set_pre_mult_alpha(plane, caps, oi->pre_mult_alpha);
2408 dispc_ovl_setup_global_alpha(plane, oi->global_alpha); 2406 dispc_ovl_setup_global_alpha(plane, caps, oi->global_alpha);
2409 2407
2410 dispc_ovl_enable_replication(plane, replication); 2408 dispc_ovl_enable_replication(plane, replication);
2411 2409