1 From 7f0896fb74c200f0dd39c8f66cac510f511b60f7 Mon Sep 17 00:00:00 2001
2 From: Tim Yamin <plasm@roo.me.uk>
3 Date: Mon, 20 Apr 2009 20:29:11 -0700
4 Subject: [PATCH 08/16] DSS2: OMAPFB: Translate X/Y coordinates for the video planes when rotating.
6 When rotating the video planes, translate the X/Y coordinates such that
7 a [0,0] from userspace always maps to the correct upper left corner of
8 the display. This patch assumes that you rotate plane 0 before rotating
9 plane 1. Patch also corrects the scaling parameters so that the video is
10 displayed in the correct orientation (vertically, instead of horizontally)
11 when rotating by 90 / 270 degrees.
13 Signed-off-by: Tim Yamin <plasm@roo.me.uk>
15 drivers/video/omap2/dss/dispc.c | 16 ++++++++++++----
16 drivers/video/omap2/dss/manager.c | 2 +-
17 drivers/video/omap2/dss/overlay.c | 19 ++++++++++++++-----
18 3 files changed, 27 insertions(+), 10 deletions(-)
20 diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
21 index c6d5fc5..1b38c49 100644
22 --- a/drivers/video/omap2/dss/dispc.c
23 +++ b/drivers/video/omap2/dss/dispc.c
24 @@ -1685,10 +1685,18 @@ static int _dispc_setup_plane(enum omap_plane plane,
25 _dispc_set_pic_size(plane, width, height);
27 if (plane != OMAP_DSS_GFX) {
28 - _dispc_set_scaling(plane, width, height,
29 - out_width, out_height,
30 - ilace, five_taps, fieldmode);
31 - _dispc_set_vid_size(plane, out_width, out_height);
32 + if (rotation == 1 || rotation == 3) {
33 + _dispc_set_scaling(plane, width, height,
34 + out_height, out_width,
35 + ilace, five_taps, fieldmode);
36 + _dispc_set_vid_size(plane, out_height, out_width);
38 + _dispc_set_scaling(plane, width, height,
39 + out_width, out_height,
40 + ilace, five_taps, fieldmode);
41 + _dispc_set_vid_size(plane, out_width, out_height);
44 _dispc_set_vid_color_conv(plane, cconv);
47 diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
48 index 27d9c46..7c62dea 100644
49 --- a/drivers/video/omap2/dss/manager.c
50 +++ b/drivers/video/omap2/dss/manager.c
51 @@ -702,7 +702,7 @@ static int configure_overlay(enum omap_plane plane)
56 + int r, pos_x = 0, pos_y = 0;
60 diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
61 index b7f9a73..0bc0592 100644
62 --- a/drivers/video/omap2/dss/overlay.c
63 +++ b/drivers/video/omap2/dss/overlay.c
64 @@ -374,6 +374,20 @@ int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device *dssdev)
65 outh = info->out_height;
68 + if ((ovl->supported_modes & info->color_mode) == 0) {
69 + DSSERR("overlay doesn't support mode %d\n", info->color_mode);
73 + if (ovl->id != OMAP_DSS_GFX && (info->rotation == 1 ||
74 + info->rotation == 3)) {
75 + if(outw > dh || outh > dw)
78 + /* If coordinates are invalid, they will be clipped later... */
82 if (dw < info->pos_x + outw) {
83 DSSDBG("check_overlay failed 1: %d < %d + %d\n",
84 dw, info->pos_x, outw);
85 @@ -386,11 +400,6 @@ int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device *dssdev)
89 - if ((ovl->supported_modes & info->color_mode) == 0) {
90 - DSSERR("overlay doesn't support mode %d\n", info->color_mode);