Skip to contentSkip to conversation

SM501: Align PANEL fb to PAGE_SIZE

PATCH Ben Dooks 1 participant 1 message Jul 17, 2008 Framebuffer layer

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

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.

drivers/video/sm501fb.c +7 -0
Index: linux-2.6.26-quilt1/drivers/video/sm501fb.c
===================================================================
@@ -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;
 
Signature · 9 lines
Ben ([email protected], 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=/