Patchwork [U-Boot] video: Allocate the MXSFB framebuffer aligned

login
register
mail settings
Submitter Marek Vasut
Date July 10, 2013, 12:52 a.m.
Message ID <1373417525-26947-1-git-send-email-marex@denx.de>
Download mbox | patch
Permalink /patch/257931/
State Superseded
Delegated to: Anatolij Gustschin
Headers show

Comments

Marek Vasut - July 10, 2013, 12:52 a.m.
Allocate the framebuffer aligned so it can be flushed
and the flush_dcache_range() function won't complain.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>
---
 drivers/video/mxsfb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Stefano Babic - July 10, 2013, 1:25 p.m.
On 10/07/2013 02:52, Marek Vasut wrote:
> Allocate the framebuffer aligned so it can be flushed
> and the flush_dcache_range() function won't complain.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  drivers/video/mxsfb.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
> index a6d8ae9..35836e1 100644
> --- a/drivers/video/mxsfb.c
> +++ b/drivers/video/mxsfb.c
> @@ -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;
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

Patch

diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index a6d8ae9..35836e1 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -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;