SM501: Align PANEL fb to PAGE_SIZE

From: Ben Dooks <ben-linux@fluff.org>
Date: 2008-07-17 10:44:12

Some programs, such as anything linked with directfb get
the drawing wrong if given an screen start which is not
aligned to PAGE_SIZE. Change the allocator to always return
an properly aligned address when asked for PANEL memory.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.26-quilt1/drivers/video/sm501fb.c
===================================================================
--- linux-2.6.26-quilt1.orig/drivers/video/sm501fb.c	2008-07-16 15:02:59.000000000 +0100
+++ linux-2.6.26-quilt1/drivers/video/sm501fb.c	2008-07-16 15:06:12.000000000 +0100
@@ -162,6 +162,13 @@ static int sm501_alloc_mem(struct sm501f
 		ptr = inf->fbmem_len - size;
 		fbi = inf->fb[HEAD_CRT];
 
+		/* round down, some programs such as directfb do not draw
+		 * 0,0 correctly unless the start is aligned to a page start.
+		*/
+
+		if (ptr > 0)
+			ptr &= ~(PAGE_SIZE - 1);
+
 		if (fbi && ptr < fbi->fix.smem_len)
 			return -ENOMEM;
 
-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help