summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-2.6.29/omap3-touchbook/dss2-fix-rotation-offsets.patch
blob: 959110bc1d4faa3af160d522c83e610f96da3bd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -661,13 +661,15 @@
 	u32 data_start_p;
 	void __iomem *data_start_v;
 	struct omap_overlay_info info;
-	int xres, yres;
+	int xres, yres, xoff, yoff;
 	int screen_width;
 	int mirror;
 
 	DBG("setup_overlay %d, posx %d, posy %d, outw %d, outh %d\n", ofbi->id,
 			posx, posy, outw, outh);
 
+	xoff = var->xoffset;
+	yoff = var->yoffset;
 	if (ofbi->rotation == FB_ROTATE_CW || ofbi->rotation == FB_ROTATE_CCW) {
 		xres = var->yres;
 		yres = var->xres;
@@ -676,8 +678,32 @@
 		yres = var->yres;
 	}
 
-	offset = ((var->yoffset * var->xres_virtual +
-				var->xoffset) * var->bits_per_pixel) >> 3;
+    if (ofbi->rotation == FB_ROTATE_CW || ofbi->rotation == FB_ROTATE_UD) {
+		if (var->yres < var->yres_virtual) {
+			if (var->yoffset)
+				yoff = 0;
+			else
+				yoff = var->yres_virtual - var->yres;
+		}
+	}
+
+	if (ofbi->rotation == FB_ROTATE_CCW || ofbi->rotation == FB_ROTATE_UD) {
+		if (var->xres < var->xres_virtual) {
+			if (var->xoffset)
+				xoff = 0;
+			else
+				xoff = var->xres_virtual - var->xres;
+		}
+	}
+
+	if (ofbi->rotation == FB_ROTATE_CW || ofbi->rotation == FB_ROTATE_CCW) {
+		offset = ((xoff * fix->line_length) >> 1) +
+				((yoff * var->bits_per_pixel) >> 2);
+	} else
+	{
+		offset = yoff * fix->line_length +
+				((xoff * var->bits_per_pixel) >> 3);
+	}
 
 	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 		data_start_p = omapfb_get_region_rot_paddr(ofbi);