Commit 03577d6a authored by Marek Vasut's avatar Marek Vasut Committed by Tomi Valkeinen

video: mxsfb: Fix framebuffer corruption on mx6sx

Allocate the framebuffer memory as coherent, otherwise the framebuffer
will suffer from artifacts when displaying scrolling text or video.
This can be replicated on i.MX6SX (armv7), which has more complex memory
architecture compared to the i.MX23/28 (armv5).
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent b86acbef
...@@ -800,6 +800,7 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host, ...@@ -800,6 +800,7 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
struct fb_videomode *vmode) struct fb_videomode *vmode)
{ {
int ret; int ret;
struct device *dev = &host->pdev->dev;
struct fb_info *fb_info = &host->fb_info; struct fb_info *fb_info = &host->fb_info;
struct fb_var_screeninfo *var = &fb_info->var; struct fb_var_screeninfo *var = &fb_info->var;
dma_addr_t fb_phys; dma_addr_t fb_phys;
...@@ -825,12 +826,10 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host, ...@@ -825,12 +826,10 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
/* Memory allocation for framebuffer */ /* Memory allocation for framebuffer */
fb_size = SZ_2M; fb_size = SZ_2M;
fb_virt = alloc_pages_exact(fb_size, GFP_DMA); fb_virt = dma_alloc_wc(dev, PAGE_ALIGN(fb_size), &fb_phys, GFP_KERNEL);
if (!fb_virt) if (!fb_virt)
return -ENOMEM; return -ENOMEM;
fb_phys = virt_to_phys(fb_virt);
fb_info->fix.smem_start = fb_phys; fb_info->fix.smem_start = fb_phys;
fb_info->screen_base = fb_virt; fb_info->screen_base = fb_virt;
fb_info->screen_size = fb_info->fix.smem_len = fb_size; fb_info->screen_size = fb_info->fix.smem_len = fb_size;
...@@ -843,9 +842,11 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host, ...@@ -843,9 +842,11 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host,
static void mxsfb_free_videomem(struct mxsfb_info *host) static void mxsfb_free_videomem(struct mxsfb_info *host)
{ {
struct device *dev = &host->pdev->dev;
struct fb_info *fb_info = &host->fb_info; struct fb_info *fb_info = &host->fb_info;
free_pages_exact(fb_info->screen_base, fb_info->fix.smem_len); dma_free_wc(dev, fb_info->screen_size, fb_info->screen_base,
fb_info->fix.smem_start);
} }
static const struct platform_device_id mxsfb_devtype[] = { static const struct platform_device_id mxsfb_devtype[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment