Commit 5b54ed3e authored by Archit Taneja's avatar Archit Taneja Committed by Tomi Valkeinen

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: default avatarArchit Taneja <archit@ti.com>
parent 78b687fc
...@@ -728,11 +728,10 @@ static void dispc_ovl_set_output_size(enum omap_plane plane, int width, ...@@ -728,11 +728,10 @@ static void dispc_ovl_set_output_size(enum omap_plane plane, int width,
dispc_write_reg(DISPC_OVL_SIZE(plane), val); dispc_write_reg(DISPC_OVL_SIZE(plane), val);
} }
static void dispc_ovl_set_zorder(enum omap_plane plane, u8 zorder) static void dispc_ovl_set_zorder(enum omap_plane plane,
enum omap_overlay_caps caps, u8 zorder)
{ {
struct omap_overlay *ovl = omap_dss_get_overlay(plane); if ((caps & OMAP_DSS_OVL_CAP_ZORDER) == 0)
if ((ovl->caps & OMAP_DSS_OVL_CAP_ZORDER) == 0)
return; return;
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), zorder, 27, 26); REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), zorder, 27, 26);
...@@ -749,23 +748,22 @@ static void dispc_ovl_enable_zorder_planes(void) ...@@ -749,23 +748,22 @@ static void dispc_ovl_enable_zorder_planes(void)
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25); REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25);
} }
static void dispc_ovl_set_pre_mult_alpha(enum omap_plane plane, bool enable) static void dispc_ovl_set_pre_mult_alpha(enum omap_plane plane,
enum omap_overlay_caps caps, bool enable)
{ {
struct omap_overlay *ovl = omap_dss_get_overlay(plane); if ((caps & OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA) == 0)
if ((ovl->caps & OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA) == 0)
return; return;
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable ? 1 : 0, 28, 28); REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable ? 1 : 0, 28, 28);
} }
static void dispc_ovl_setup_global_alpha(enum omap_plane plane, u8 global_alpha) static void dispc_ovl_setup_global_alpha(enum omap_plane plane,
enum omap_overlay_caps caps, u8 global_alpha)
{ {
static const unsigned shifts[] = { 0, 8, 16, 24, }; static const unsigned shifts[] = { 0, 8, 16, 24, };
int shift; int shift;
struct omap_overlay *ovl = omap_dss_get_overlay(plane);
if ((ovl->caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0) if ((caps & OMAP_DSS_OVL_CAP_GLOBAL_ALPHA) == 0)
return; return;
shift = shifts[plane]; shift = shifts[plane];
...@@ -2193,14 +2191,13 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_channel channel, ...@@ -2193,14 +2191,13 @@ static int dispc_ovl_calc_scaling_44xx(enum omap_channel channel,
} }
static int dispc_ovl_calc_scaling(enum omap_plane plane, static int dispc_ovl_calc_scaling(enum omap_plane plane,
enum omap_channel channel, enum omap_overlay_caps caps, enum omap_channel channel,
const struct omap_video_timings *mgr_timings, const struct omap_video_timings *mgr_timings,
u16 width, u16 height, u16 out_width, u16 out_height, u16 width, u16 height, u16 out_width, u16 out_height,
enum omap_color_mode color_mode, bool *five_taps, enum omap_color_mode color_mode, bool *five_taps,
int *x_predecim, int *y_predecim, u16 pos_x, int *x_predecim, int *y_predecim, u16 pos_x,
enum omap_dss_rotation_type rotation_type) enum omap_dss_rotation_type rotation_type)
{ {
struct omap_overlay *ovl = omap_dss_get_overlay(plane);
const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE);
const int max_decim_limit = 16; const int max_decim_limit = 16;
unsigned long core_clk = 0; unsigned long core_clk = 0;
...@@ -2209,7 +2206,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, ...@@ -2209,7 +2206,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,
if (width == out_width && height == out_height) if (width == out_width && height == out_height)
return 0; return 0;
if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) if ((caps & OMAP_DSS_OVL_CAP_SCALE) == 0)
return -EINVAL; return -EINVAL;
*x_predecim = max_decim_limit; *x_predecim = max_decim_limit;
...@@ -2261,6 +2258,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, ...@@ -2261,6 +2258,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
bool replication, const struct omap_video_timings *mgr_timings) bool replication, const struct omap_video_timings *mgr_timings)
{ {
struct omap_overlay *ovl = omap_dss_get_overlay(plane); struct omap_overlay *ovl = omap_dss_get_overlay(plane);
enum omap_overlay_caps caps = ovl->caps;
bool five_taps = true; bool five_taps = true;
bool fieldmode = 0; bool fieldmode = 0;
int r, cconv = 0; int r, cconv = 0;
...@@ -2309,7 +2307,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, ...@@ -2309,7 +2307,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
if (!dss_feat_color_mode_supported(plane, oi->color_mode)) if (!dss_feat_color_mode_supported(plane, oi->color_mode))
return -EINVAL; return -EINVAL;
r = dispc_ovl_calc_scaling(plane, channel, mgr_timings, in_width, r = dispc_ovl_calc_scaling(plane, caps, channel, mgr_timings, in_width,
in_height, out_width, out_height, oi->color_mode, in_height, out_width, out_height, oi->color_mode,
&five_taps, &x_predecim, &y_predecim, oi->pos_x, &five_taps, &x_predecim, &y_predecim, oi->pos_x,
oi->rotation_type); oi->rotation_type);
...@@ -2391,7 +2389,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, ...@@ -2391,7 +2389,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
dispc_ovl_set_input_size(plane, in_width, in_height); dispc_ovl_set_input_size(plane, in_width, in_height);
if (ovl->caps & OMAP_DSS_OVL_CAP_SCALE) { if (caps & OMAP_DSS_OVL_CAP_SCALE) {
dispc_ovl_set_scaling(plane, in_width, in_height, out_width, dispc_ovl_set_scaling(plane, in_width, in_height, out_width,
out_height, ilace, five_taps, fieldmode, out_height, ilace, five_taps, fieldmode,
oi->color_mode, oi->rotation); oi->color_mode, oi->rotation);
...@@ -2403,9 +2401,9 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, ...@@ -2403,9 +2401,9 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror, dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror,
oi->color_mode); oi->color_mode);
dispc_ovl_set_zorder(plane, oi->zorder); dispc_ovl_set_zorder(plane, caps, oi->zorder);
dispc_ovl_set_pre_mult_alpha(plane, oi->pre_mult_alpha); dispc_ovl_set_pre_mult_alpha(plane, caps, oi->pre_mult_alpha);
dispc_ovl_setup_global_alpha(plane, oi->global_alpha); dispc_ovl_setup_global_alpha(plane, caps, oi->global_alpha);
dispc_ovl_enable_replication(plane, replication); dispc_ovl_enable_replication(plane, replication);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment