diff options
author | Archit Taneja <archit@ti.com> | 2012-09-26 07:27:37 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-26 07:58:49 -0400 |
commit | 84a880fd51cb528ae7499d0e971a3d4f4587401a (patch) | |
tree | fbac3d4ecb1ff78761fab90e5f92179f7c6f4bb9 | |
parent | d79db853000c271fbfc944dc1d4f527805109b0c (diff) |
OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_ovl_setup_common
Add a new static function called dispc_ovl_setup_common(). This function is used by
dispc_ovl_setup() to configure the overlay registers. This split is done so that
dispc_wb_setup() can reuse overlay register configuration related code.
Signed-off-by: Archit Taneja <archit@ti.com>
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 130 |
1 files changed, 72 insertions, 58 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 3e1007810f83..9c23ce8aed49 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -2264,43 +2264,35 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, | |||
2264 | return 0; | 2264 | return 0; |
2265 | } | 2265 | } |
2266 | 2266 | ||
2267 | int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, | 2267 | static int dispc_ovl_setup_common(enum omap_plane plane, |
2268 | enum omap_channel channel, enum omap_overlay_caps caps, | ||
2269 | u32 paddr, u32 p_uv_addr, u16 screen_width, int pos_x, | ||
2270 | int pos_y, u16 width, u16 height, u16 out_width, u16 out_height, | ||
2271 | enum omap_color_mode color_mode, u8 rotation, bool mirror, | ||
2272 | u8 zorder, u8 pre_mult_alpha, u8 global_alpha, | ||
2273 | enum omap_dss_rotation_type rotation_type, | ||
2268 | bool replication, const struct omap_video_timings *mgr_timings) | 2274 | bool replication, const struct omap_video_timings *mgr_timings) |
2269 | { | 2275 | { |
2270 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); | ||
2271 | enum omap_overlay_caps caps = ovl->caps; | ||
2272 | bool five_taps = true; | 2276 | bool five_taps = true; |
2273 | bool fieldmode = 0; | 2277 | bool fieldmode = 0; |
2274 | int r, cconv = 0; | 2278 | int r, cconv = 0; |
2275 | unsigned offset0, offset1; | 2279 | unsigned offset0, offset1; |
2276 | s32 row_inc; | 2280 | s32 row_inc; |
2277 | s32 pix_inc; | 2281 | s32 pix_inc; |
2278 | u16 frame_height = oi->height; | 2282 | u16 frame_height = height; |
2279 | unsigned int field_offset = 0; | 2283 | unsigned int field_offset = 0; |
2280 | u16 in_height = oi->height; | 2284 | u16 in_height = height; |
2281 | u16 in_width = oi->width; | 2285 | u16 in_width = width; |
2282 | u16 out_width, out_height; | ||
2283 | enum omap_channel channel; | ||
2284 | int x_predecim = 1, y_predecim = 1; | 2286 | int x_predecim = 1, y_predecim = 1; |
2285 | bool ilace = mgr_timings->interlace; | 2287 | bool ilace = mgr_timings->interlace; |
2286 | u16 pos_y = oi->pos_y; | ||
2287 | |||
2288 | channel = dispc_ovl_get_channel_out(plane); | ||
2289 | |||
2290 | DSSDBG("dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d -> " | ||
2291 | "%dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d repl %d\n", | ||
2292 | plane, oi->paddr, oi->p_uv_addr, | ||
2293 | oi->screen_width, oi->pos_x, oi->pos_y, oi->width, oi->height, | ||
2294 | oi->out_width, oi->out_height, oi->color_mode, oi->rotation, | ||
2295 | oi->mirror, ilace, channel, replication); | ||
2296 | 2288 | ||
2297 | if (oi->paddr == 0) | 2289 | if (paddr == 0) |
2298 | return -EINVAL; | 2290 | return -EINVAL; |
2299 | 2291 | ||
2300 | out_width = oi->out_width == 0 ? oi->width : oi->out_width; | 2292 | out_width = out_width == 0 ? width : out_width; |
2301 | out_height = oi->out_height == 0 ? oi->height : oi->out_height; | 2293 | out_height = out_height == 0 ? height : out_height; |
2302 | 2294 | ||
2303 | if (ilace && oi->height == out_height) | 2295 | if (ilace && height == out_height) |
2304 | fieldmode = 1; | 2296 | fieldmode = 1; |
2305 | 2297 | ||
2306 | if (ilace) { | 2298 | if (ilace) { |
@@ -2310,26 +2302,26 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, | |||
2310 | out_height /= 2; | 2302 | out_height /= 2; |
2311 | 2303 | ||
2312 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " | 2304 | DSSDBG("adjusting for ilace: height %d, pos_y %d, " |
2313 | "out_height %d\n", | 2305 | "out_height %d\n", in_height, pos_y, |
2314 | in_height, pos_y, out_height); | 2306 | out_height); |
2315 | } | 2307 | } |
2316 | 2308 | ||
2317 | if (!dss_feat_color_mode_supported(plane, oi->color_mode)) | 2309 | if (!dss_feat_color_mode_supported(plane, color_mode)) |
2318 | return -EINVAL; | 2310 | return -EINVAL; |
2319 | 2311 | ||
2320 | r = dispc_ovl_calc_scaling(plane, caps, channel, mgr_timings, in_width, | 2312 | r = dispc_ovl_calc_scaling(plane, caps, channel, mgr_timings, in_width, |
2321 | in_height, out_width, out_height, oi->color_mode, | 2313 | in_height, out_width, out_height, color_mode, |
2322 | &five_taps, &x_predecim, &y_predecim, oi->pos_x, | 2314 | &five_taps, &x_predecim, &y_predecim, pos_x, |
2323 | oi->rotation_type); | 2315 | rotation_type); |
2324 | if (r) | 2316 | if (r) |
2325 | return r; | 2317 | return r; |
2326 | 2318 | ||
2327 | in_width = DIV_ROUND_UP(in_width, x_predecim); | 2319 | in_width = DIV_ROUND_UP(in_width, x_predecim); |
2328 | in_height = DIV_ROUND_UP(in_height, y_predecim); | 2320 | in_height = DIV_ROUND_UP(in_height, y_predecim); |
2329 | 2321 | ||
2330 | if (oi->color_mode == OMAP_DSS_COLOR_YUV2 || | 2322 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
2331 | oi->color_mode == OMAP_DSS_COLOR_UYVY || | 2323 | color_mode == OMAP_DSS_COLOR_UYVY || |
2332 | oi->color_mode == OMAP_DSS_COLOR_NV12) | 2324 | color_mode == OMAP_DSS_COLOR_NV12) |
2333 | cconv = 1; | 2325 | cconv = 1; |
2334 | 2326 | ||
2335 | if (ilace && !fieldmode) { | 2327 | if (ilace && !fieldmode) { |
@@ -2355,71 +2347,93 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, | |||
2355 | row_inc = 0; | 2347 | row_inc = 0; |
2356 | pix_inc = 0; | 2348 | pix_inc = 0; |
2357 | 2349 | ||
2358 | if (oi->rotation_type == OMAP_DSS_ROT_TILER) | 2350 | if (rotation_type == OMAP_DSS_ROT_TILER) |
2359 | calc_tiler_rotation_offset(oi->screen_width, in_width, | 2351 | calc_tiler_rotation_offset(screen_width, in_width, |
2360 | oi->color_mode, fieldmode, field_offset, | 2352 | color_mode, fieldmode, field_offset, |
2361 | &offset0, &offset1, &row_inc, &pix_inc, | 2353 | &offset0, &offset1, &row_inc, &pix_inc, |
2362 | x_predecim, y_predecim); | 2354 | x_predecim, y_predecim); |
2363 | else if (oi->rotation_type == OMAP_DSS_ROT_DMA) | 2355 | else if (rotation_type == OMAP_DSS_ROT_DMA) |
2364 | calc_dma_rotation_offset(oi->rotation, oi->mirror, | 2356 | calc_dma_rotation_offset(rotation, mirror, |
2365 | oi->screen_width, in_width, frame_height, | 2357 | screen_width, in_width, frame_height, |
2366 | oi->color_mode, fieldmode, field_offset, | 2358 | color_mode, fieldmode, field_offset, |
2367 | &offset0, &offset1, &row_inc, &pix_inc, | 2359 | &offset0, &offset1, &row_inc, &pix_inc, |
2368 | x_predecim, y_predecim); | 2360 | x_predecim, y_predecim); |
2369 | else | 2361 | else |
2370 | calc_vrfb_rotation_offset(oi->rotation, oi->mirror, | 2362 | calc_vrfb_rotation_offset(rotation, mirror, |
2371 | oi->screen_width, in_width, frame_height, | 2363 | screen_width, in_width, frame_height, |
2372 | oi->color_mode, fieldmode, field_offset, | 2364 | color_mode, fieldmode, field_offset, |
2373 | &offset0, &offset1, &row_inc, &pix_inc, | 2365 | &offset0, &offset1, &row_inc, &pix_inc, |
2374 | x_predecim, y_predecim); | 2366 | x_predecim, y_predecim); |
2375 | 2367 | ||
2376 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", | 2368 | DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", |
2377 | offset0, offset1, row_inc, pix_inc); | 2369 | offset0, offset1, row_inc, pix_inc); |
2378 | 2370 | ||
2379 | dispc_ovl_set_color_mode(plane, oi->color_mode); | 2371 | dispc_ovl_set_color_mode(plane, color_mode); |
2380 | 2372 | ||
2381 | dispc_ovl_configure_burst_type(plane, oi->rotation_type); | 2373 | dispc_ovl_configure_burst_type(plane, rotation_type); |
2382 | 2374 | ||
2383 | dispc_ovl_set_ba0(plane, oi->paddr + offset0); | 2375 | dispc_ovl_set_ba0(plane, paddr + offset0); |
2384 | dispc_ovl_set_ba1(plane, oi->paddr + offset1); | 2376 | dispc_ovl_set_ba1(plane, paddr + offset1); |
2385 | 2377 | ||
2386 | if (OMAP_DSS_COLOR_NV12 == oi->color_mode) { | 2378 | if (OMAP_DSS_COLOR_NV12 == color_mode) { |
2387 | dispc_ovl_set_ba0_uv(plane, oi->p_uv_addr + offset0); | 2379 | dispc_ovl_set_ba0_uv(plane, p_uv_addr + offset0); |
2388 | dispc_ovl_set_ba1_uv(plane, oi->p_uv_addr + offset1); | 2380 | dispc_ovl_set_ba1_uv(plane, p_uv_addr + offset1); |
2389 | } | 2381 | } |
2390 | 2382 | ||
2391 | |||
2392 | dispc_ovl_set_row_inc(plane, row_inc); | 2383 | dispc_ovl_set_row_inc(plane, row_inc); |
2393 | dispc_ovl_set_pix_inc(plane, pix_inc); | 2384 | dispc_ovl_set_pix_inc(plane, pix_inc); |
2394 | 2385 | ||
2395 | DSSDBG("%d,%d %dx%d -> %dx%d\n", oi->pos_x, oi->pos_y, in_width, | 2386 | DSSDBG("%d,%d %dx%d -> %dx%d\n", pos_x, pos_y, in_width, |
2396 | in_height, out_width, out_height); | 2387 | in_height, out_width, out_height); |
2397 | 2388 | ||
2398 | dispc_ovl_set_pos(plane, caps, oi->pos_x, pos_y); | 2389 | dispc_ovl_set_pos(plane, caps, pos_x, pos_y); |
2399 | 2390 | ||
2400 | dispc_ovl_set_input_size(plane, in_width, in_height); | 2391 | dispc_ovl_set_input_size(plane, in_width, in_height); |
2401 | 2392 | ||
2402 | if (caps & OMAP_DSS_OVL_CAP_SCALE) { | 2393 | if (caps & OMAP_DSS_OVL_CAP_SCALE) { |
2403 | dispc_ovl_set_scaling(plane, in_width, in_height, out_width, | 2394 | dispc_ovl_set_scaling(plane, in_width, in_height, out_width, |
2404 | out_height, ilace, five_taps, fieldmode, | 2395 | out_height, ilace, five_taps, fieldmode, |
2405 | oi->color_mode, oi->rotation); | 2396 | color_mode, rotation); |
2406 | |||
2407 | dispc_ovl_set_output_size(plane, out_width, out_height); | 2397 | dispc_ovl_set_output_size(plane, out_width, out_height); |
2408 | dispc_ovl_set_vid_color_conv(plane, cconv); | 2398 | dispc_ovl_set_vid_color_conv(plane, cconv); |
2409 | } | 2399 | } |
2410 | 2400 | ||
2411 | dispc_ovl_set_rotation_attrs(plane, oi->rotation, oi->mirror, | 2401 | dispc_ovl_set_rotation_attrs(plane, rotation, mirror, color_mode); |
2412 | oi->color_mode); | ||
2413 | 2402 | ||
2414 | dispc_ovl_set_zorder(plane, caps, oi->zorder); | 2403 | dispc_ovl_set_zorder(plane, caps, zorder); |
2415 | dispc_ovl_set_pre_mult_alpha(plane, caps, oi->pre_mult_alpha); | 2404 | dispc_ovl_set_pre_mult_alpha(plane, caps, pre_mult_alpha); |
2416 | dispc_ovl_setup_global_alpha(plane, caps, oi->global_alpha); | 2405 | dispc_ovl_setup_global_alpha(plane, caps, global_alpha); |
2417 | 2406 | ||
2418 | dispc_ovl_enable_replication(plane, caps, replication); | 2407 | dispc_ovl_enable_replication(plane, caps, replication); |
2419 | 2408 | ||
2420 | return 0; | 2409 | return 0; |
2421 | } | 2410 | } |
2422 | 2411 | ||
2412 | int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, | ||
2413 | bool replication, const struct omap_video_timings *mgr_timings) | ||
2414 | { | ||
2415 | int r; | ||
2416 | struct omap_overlay *ovl = omap_dss_get_overlay(plane); | ||
2417 | enum omap_channel channel; | ||
2418 | |||
2419 | channel = dispc_ovl_get_channel_out(plane); | ||
2420 | |||
2421 | DSSDBG("dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d -> " | ||
2422 | "%dx%d, cmode %x, rot %d, mir %d, chan %d repl %d\n", | ||
2423 | plane, oi->paddr, oi->p_uv_addr, oi->screen_width, oi->pos_x, | ||
2424 | oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height, | ||
2425 | oi->color_mode, oi->rotation, oi->mirror, channel, replication); | ||
2426 | |||
2427 | r = dispc_ovl_setup_common(plane, channel, ovl->caps, oi->paddr, | ||
2428 | oi->p_uv_addr, oi->screen_width, oi->pos_x, oi->pos_y, | ||
2429 | oi->width, oi->height, oi->out_width, oi->out_height, | ||
2430 | oi->color_mode, oi->rotation, oi->mirror, oi->zorder, | ||
2431 | oi->pre_mult_alpha, oi->global_alpha, oi->rotation_type, | ||
2432 | replication, mgr_timings); | ||
2433 | |||
2434 | return r; | ||
2435 | } | ||
2436 | |||
2423 | int dispc_ovl_enable(enum omap_plane plane, bool enable) | 2437 | int dispc_ovl_enable(enum omap_plane plane, bool enable) |
2424 | { | 2438 | { |
2425 | DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); | 2439 | DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); |