Skip to contentSkip to conversation

video: mxc_ipuv3: fix memory alignment of framebuffer

PATCH New Eric Nelson 2 participants 5 messages Jul 26, 2013 – Jul 27, 2013

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

PATCH 1/1 video: mxc_ipuv3: fix memory alignment of framebuffer

The frame-buffer on i.MX boards needs to be aligned for DMA.

---
 drivers/video/mxc_ipuv3_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxc_ipuv3_fb.c +2 -1
index ace226c..ad95831 100644
@@ -416,7 +416,8 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
 				    fbi->fix.line_length;
 	}
 
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);
 	fbi->fix.smem_start = (unsigned long)fbi->screen_base;
 	if (fbi->screen_base == 0) {
 		puts("Unable to allocate framebuffer memory\n");
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 video: mxc_ipuv3: fix memory alignment of framebuffer

Dear Eric Nelson,

Quoted 12 lines

The frame-buffer on i.MX boards needs to be aligned for DMA.

---
 drivers/video/mxc_ipuv3_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxc_ipuv3_fb.c +0 -0
index ace226c..ad95831 100644

drivers/video/mxc_ipuv3_fb.c static int mxcfb_map_video_memory(struct fb_info *fbi) · line 420

Quoted 6 lines
drivers/video/mxc_ipuv3_fb.c +2 -1
@@ -416,7 +416,8 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
 				    fbi->fix.line_length;
 	}
 
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);

You might want to round-up the length too, like I did in the MXS driver.

drivers/video/mxc_ipuv3_fb.c static int mxcfb_map_video_memory(struct fb_info *fbi) · line 423

Quoted 3 lines
drivers/video/mxc_ipuv3_fb.c +0 -0
 	fbi->fix.smem_start = (unsigned long)fbi->screen_base;
 	if (fbi->screen_base == 0) {
 		puts("Unable to allocate framebuffer memory\n");

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 video: mxc_ipuv3: fix memory alignment of framebuffer

Hi Marek,

Quoted 17 lines · Marek Vasut

Dear Eric Nelson,

Quoted 15 lines

The frame-buffer on i.MX boards needs to be aligned for DMA.

---
  drivers/video/mxc_ipuv3_fb.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxc_ipuv3_fb.c +0 -0
index ace226c..ad95831 100644
@@ -416,7 +416,8 @@ static int mxcfb_map_video_memory(struct fb_info *fbi)
  				    fbi->fix.line_length;
  	}
 
Quoted 6 lines

drivers/video/mxc_ipuv3_fb.c static int mxcfb_map_video_memory(struct fb_info *fbi) · line 420

Quoted 3 lines
drivers/video/mxc_ipuv3_fb.c +2 -1
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);

You might want to round-up the length too, like I did in the MXS driver.

Did you really run across a display whose size wasn't a multiple of 32, or is this rounding just in muscle-memory for you?

Regards,

Eric

#3 lore raw

PATCH 1/1 video: mxc_ipuv3: fix memory alignment of framebuffer

Dear Eric Nelson,

Quoted 24 lines

Hi Marek,

Quoted 21 lines · Marek Vasut

Dear Eric Nelson,

Quoted 19 lines

The frame-buffer on i.MX boards needs to be aligned for DMA.

---

  drivers/video/mxc_ipuv3_fb.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/mxc_ipuv3_fb.c +0 -0
index ace226c..ad95831 100644
@@ -416,7 +416,8 @@ static int mxcfb_map_video_memory(struct fb_info
 *fbi)
 
  				    fbi->fix.line_length;
 
  	}
 
Quoted 8 lines
Quoted 5 lines

drivers/video/mxc_ipuv3_fb.c static int mxcfb_map_video_memory(struct fb_info *fbi) · line 420

Quoted 3 lines
drivers/video/mxc_ipuv3_fb.c +2 -1
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);

You might want to round-up the length too, like I did in the MXS driver.

Did you really run across a display whose size wasn't a multiple of 32, or is this rounding just in muscle-memory for you?

Palm devices with PXA27x (PalmT5, PalmLD, PalmTX) had 484x324 LCDs ;-)

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 video: mxc_ipuv3: fix memory alignment of framebuffer

Quoted 8 lines · Marek Vasut

Dear Eric Nelson,

Quoted 6 lines
Quoted 5 lines

drivers/video/mxc_ipuv3_fb.c static int mxcfb_map_video_memory(struct fb_info *fbi) · line 420

Quoted 3 lines
drivers/video/mxc_ipuv3_fb.c +2 -1
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);

You might want to round-up the length too, like I did in the MXS driver.

Quoted 5 lines
Quoted 2 lines

Did you really run across a display whose size wasn't a multiple of 32, or is this rounding just in muscle-memory for you?

Palm devices with PXA27x (PalmT5, PalmLD, PalmTX) had 484x324 LCDs ;-)

With as much cache-enablement as you've done lately, I have a feeling you round up at the grocery store or pub ;)