Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Marek 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: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Marek Vasut and committed by
Tomi Valkeinen
03577d6a b86acbef

+5 -4
+5 -4
drivers/video/fbdev/mxsfb.c
··· 800 800 struct fb_videomode *vmode) 801 801 { 802 802 int ret; 803 + struct device *dev = &host->pdev->dev; 803 804 struct fb_info *fb_info = &host->fb_info; 804 805 struct fb_var_screeninfo *var = &fb_info->var; 805 806 dma_addr_t fb_phys; ··· 826 825 827 826 /* Memory allocation for framebuffer */ 828 827 fb_size = SZ_2M; 829 - fb_virt = alloc_pages_exact(fb_size, GFP_DMA); 828 + fb_virt = dma_alloc_wc(dev, PAGE_ALIGN(fb_size), &fb_phys, GFP_KERNEL); 830 829 if (!fb_virt) 831 830 return -ENOMEM; 832 - 833 - fb_phys = virt_to_phys(fb_virt); 834 831 835 832 fb_info->fix.smem_start = fb_phys; 836 833 fb_info->screen_base = fb_virt; ··· 842 843 843 844 static void mxsfb_free_videomem(struct mxsfb_info *host) 844 845 { 846 + struct device *dev = &host->pdev->dev; 845 847 struct fb_info *fb_info = &host->fb_info; 846 848 847 - free_pages_exact(fb_info->screen_base, fb_info->fix.smem_len); 849 + dma_free_wc(dev, fb_info->screen_size, fb_info->screen_base, 850 + fb_info->fix.smem_start); 848 851 } 849 852 850 853 static const struct platform_device_id mxsfb_devtype[] = {