Skip to contentSkip to conversation

video: Allocate the MXSFB framebuffer aligned

PATCH New Marek Vasut 2 participants 2 messages Jul 10, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: Allocate the MXSFB framebuffer aligned

Allocate the framebuffer aligned so it can be flushed and the flush_dcache_range() function won't complain.

Cc Anatolij Gustschin <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Otavio Salvador <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/video/mxsfb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxsfb.c +2 -1
index a6d8ae9..35836e1 100644
@@ -202,7 +202,8 @@ void *video_hw_init(void)
 	panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
 
 	/* Allocate framebuffer */
-	fb = malloc(panel.memSize);
+	fb = memalign(ARCH_DMA_MINALIGN,
+		      roundup(panel.memSize, ARCH_DMA_MINALIGN));
 	if (!fb) {
 		printf("MXSFB: Error allocating framebuffer!\n");
 		return NULL;
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 video: Allocate the MXSFB framebuffer aligned

Quoted 18 lines · Marek Vasut

Allocate the framebuffer aligned so it can be flushed and the flush_dcache_range() function won't complain.

Cc Anatolij Gustschin <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Otavio Salvador <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/video/mxsfb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxsfb.c +0 -0
index a6d8ae9..35836e1 100644

drivers/video/mxsfb.c void *video_hw_init(void) · line 209

Quoted 9 lines
drivers/video/mxsfb.c +2 -1
@@ -202,7 +202,8 @@ void *video_hw_init(void)
 	panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
 
 	/* Allocate framebuffer */
-	fb = malloc(panel.memSize);
+	fb = memalign(ARCH_DMA_MINALIGN,
+		      roundup(panel.memSize, ARCH_DMA_MINALIGN));
 	if (!fb) {
 		printf("MXSFB: Error allocating framebuffer!\n");
 		return NULL;

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================