summaryrefslogtreecommitdiff
path: root/packages/linux/linux-openmoko/glamo-report-vram-size-to-userspace.patch
blob: 563923e71cb9dc81f5c207ce7b9c7320a0ea77ce (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
From ff1564e5100eeccd53ee6b007813ea722f8cf8b6 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olv@openmoko.com>
Date: Mon, 1 Oct 2007 21:16:46 +0800
Subject: [PATCH] glamo: report vram size to userspace

Set fb_fix_screeninfo.smem_len to RESSIZE(fb_res).  This is not the real
vram size, as it is a hardcoded value in glamo-core.c for now.
---
 drivers/video/glamo/glamo-fb.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/video/glamo/glamo-fb.c b/drivers/video/glamo/glamo-fb.c
index 451de75..160a5b1 100644
--- a/drivers/video/glamo/glamo-fb.c
+++ b/drivers/video/glamo/glamo-fb.c
@@ -54,8 +54,6 @@
 
 #define RESSIZE(ressource) (((ressource)->end - (ressource)->start)+1)
 
-#define GLAMO_FB_ALLOC	(640*480*2)
-
 struct glamofb_handle {
 	struct fb_info *fb;
 	struct device *dev;
@@ -224,7 +222,6 @@ static int glamofb_set_par(struct fb_info *info)
 	}
 
 	glamo->fb->fix.line_length = (var->width * var->bits_per_pixel) / 8;
-	glamo->fb->fix.smem_len = info->fix.line_length * var->yres_virtual;
 
 	return 0;
 }
@@ -453,7 +450,7 @@ static int __init glamofb_probe(struct platform_device *pdev)
 	}
 
 	glamofb->fb_res = request_mem_region(glamofb->fb_res->start,
-					     GLAMO_FB_ALLOC, pdev->name);
+					     RESSIZE(glamofb->fb_res), pdev->name);
 	if (!glamofb->fb_res) {
 		dev_err(&pdev->dev, "failed to request vram region\n");
 		goto out_release_reg;
@@ -467,6 +464,7 @@ static int __init glamofb_probe(struct platform_device *pdev)
 		goto out_release_fb;
 	}
 	fbinfo->fix.smem_start = (unsigned long) glamofb->fb_res->start;
+	fbinfo->fix.smem_len = RESSIZE(glamofb->fb_res);
 
 	fbinfo->screen_base = ioremap(glamofb->fb_res->start,
 				       RESSIZE(glamofb->fb_res));
@@ -522,11 +520,10 @@ static int __init glamofb_probe(struct platform_device *pdev)
 	fbinfo->var.green.length = 6;
 	fbinfo->var.blue.length = 5;
 	fbinfo->var.transp.length = 0;
-	fbinfo->fix.smem_len = mach_info->xres.max *
-			       mach_info->yres.max *
-			       mach_info->bpp.max / 8;
 
-	memset(fbinfo->screen_base, 0, fbinfo->fix.smem_len);
+	memset(fbinfo->screen_base, 0, mach_info->xres.max *
+				       mach_info->yres.max *
+				       mach_info->bpp.max / 8);
 
 	glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD);
 	glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD);
-- 
1.5.3.1