summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap/0009-DSS-OMAPFB-allocate-fbmem-only-for-fb0-or-if-spes.patch
blob: 89174909a001289a45bf065c29b9c1782f2bd144 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From bd4fd1dd3be7ff31a6cf779f0683d617280ac92e Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Date: Wed, 7 Jan 2009 16:44:17 +0200
Subject: [PATCH] DSS: OMAPFB: allocate fbmem only for fb0, or if spesified in vram arg

---
 drivers/video/omap2/omapfb-main.c |   65 +++++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/drivers/video/omap2/omapfb-main.c b/drivers/video/omap2/omapfb-main.c
index 76bd416..9dbff42 100644
--- a/drivers/video/omap2/omapfb-main.c
+++ b/drivers/video/omap2/omapfb-main.c
@@ -939,11 +939,12 @@ static int omapfb_alloc_fbmem_display(struct omapfb2_device *fbdev, int fbnum,
 		break;
 	}
 
-	size = display->panel->timings.x_res * display->panel->timings.y_res *
-		bytespp;
-
-	if (def_vram > size)
+	if (def_vram)
 		size = def_vram;
+	else
+		size = display->panel->timings.x_res *
+			display->panel->timings.y_res *
+			bytespp;
 
 	return omapfb_alloc_fbmem(fbdev, fbnum, size);
 }
@@ -956,13 +957,25 @@ static int omapfb_allocate_all_fbs(struct omapfb2_device *fbdev)
 	memset(vrams, 0, sizeof(vrams));
 
 	if (def_vram) {
-		char *p = def_vram;
+		char str[64];
+		char *tok, *s;
+
+		if (strlen(def_vram) > sizeof(str) - 1) {
+			dev_err(fbdev->dev, "Illegal vram parameters\n");
+			return -EINVAL;
+		}
+
+		strcpy(str, def_vram);
+
+		s = str;
 		i = 0;
 
-		while (true) {
+		while ((tok = strsep(&s, ","))) {
 			unsigned long size;
 
-			size = memparse(p, &p);
+			printk("param '%s'\n", tok);
+
+			size = memparse(tok, NULL);
 
 			if (size == 0) {
 				dev_err(fbdev->dev, "illegal vram size\n");
@@ -970,19 +983,18 @@ static int omapfb_allocate_all_fbs(struct omapfb2_device *fbdev)
 			}
 
 			vrams[i++] = size;
-
-			if (*p != ',')
-				break;
-
-			p++;
 		}
 	}
 
 	for (i = 0; i < fbdev->num_fbs; i++) {
-		r = omapfb_alloc_fbmem_display(fbdev, i, vrams[i]);
+		/* allocate memory automatically only for fb0, or if
+		 * excplicitly defined with vram option */
+		if (i == 0 || vrams[i] != 0) {
+			r = omapfb_alloc_fbmem_display(fbdev, i, vrams[i]);
 
-		if (r)
-			return r;
+			if (r)
+				return r;
+		}
 	}
 
 	for (i = 0; i < fbdev->num_fbs; i++) {
@@ -1167,24 +1179,15 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
 			dev_err(fbdev->dev, "failed to change mode\n");
 	}
 
-	/* Enable the first framebuffer that has overlay that is connected
-	 * to display. Usually this would be the GFX plane. */
-	r = 0;
-	for (i = 0; i < fbdev->num_fbs; i++) {
-		struct omapfb_info *ofbi = FB2OFB(fbdev->fbs[i]);
-		int t;
+	/* Enable fb0 */
+	if (fbdev->num_fbs > 0) {
+		struct omapfb_info *ofbi = FB2OFB(fbdev->fbs[0]);
 
-		for (t = 0; t < ofbi->num_overlays; t++) {
-			struct omap_overlay *ovl = ofbi->overlays[t];
-			if (ovl->manager && ovl->manager->display) {
-				ovl->enable(ovl, 1);
-				r = 1;
-				break;
-			}
-		}
+		if (ofbi->num_overlays > 0 ) {
+			struct omap_overlay *ovl = ofbi->overlays[0];
 
-		if (r)
-			break;
+			ovl->enable(ovl, 1);
+		}
 	}
 
 	DBG("create_framebuffers done\n");
-- 
1.5.6.3