[PATCH 3/3] glamo: report vram size to userspace

Chia-I Wu olv at openmoko.com
Mon Oct 1 15:59:09 CEST 2007


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





More information about the openmoko-kernel mailing list