From patchwork Fri Aug 26 14:30:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 9301387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22E96601C0 for ; Fri, 26 Aug 2016 14:31:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 156302960E for ; Fri, 26 Aug 2016 14:31:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09C7529619; Fri, 26 Aug 2016 14:31:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74ED72960E for ; Fri, 26 Aug 2016 14:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751742AbcHZObU (ORCPT ); Fri, 26 Aug 2016 10:31:20 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:35638 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbcHZObT (ORCPT ); Fri, 26 Aug 2016 10:31:19 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3sLNkj21WBz3hjQZ; Fri, 26 Aug 2016 16:30:53 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3sLNkj1LRvzvlDd; Fri, 26 Aug 2016 16:30:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id pIA4aabpr-kX; Fri, 26 Aug 2016 16:30:51 +0200 (CEST) X-Auth-Info: yeaJswxQnso9Ixs25bpLxtPM7wUF1EEV79xPgevLRg0= Received: from chi.lan (unknown [195.140.253.167]) by mail.mnet-online.de (Postfix) with ESMTPA; Fri, 26 Aug 2016 16:30:51 +0200 (CEST) From: Marek Vasut To: linux-fbdev@vger.kernel.org Cc: Marek Vasut , Tomi Valkeinen , Fabio Estevam , Lucas Stach , Shawn Guo Subject: [PATCH] video: mxsfb: Fix framebuffer corruption on mx6sx Date: Fri, 26 Aug 2016 16:30:45 +0200 Message-Id: <20160826143045.7386-1-marex@denx.de> X-Mailer: git-send-email 2.9.3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Tomi Valkeinen Cc: Fabio Estevam Cc: Lucas Stach Cc: Shawn Guo --- drivers/video/fbdev/mxsfb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c index 4e6608c..bd1a310 100644 --- a/drivers/video/fbdev/mxsfb.c +++ b/drivers/video/fbdev/mxsfb.c @@ -800,6 +800,7 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host, struct fb_videomode *vmode) { int ret; + struct device *dev = &host->pdev->dev; struct fb_info *fb_info = &host->fb_info; struct fb_var_screeninfo *var = &fb_info->var; dma_addr_t fb_phys; @@ -825,12 +826,11 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host, /* Memory allocation for framebuffer */ fb_size = SZ_2M; - fb_virt = alloc_pages_exact(fb_size, GFP_DMA); + fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fb_size), &fb_phys, + GFP_KERNEL); if (!fb_virt) return -ENOMEM; - fb_phys = virt_to_phys(fb_virt); - fb_info->fix.smem_start = fb_phys; fb_info->screen_base = fb_virt; fb_info->screen_size = fb_info->fix.smem_len = fb_size; @@ -843,9 +843,11 @@ static int mxsfb_init_fbinfo(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; - free_pages_exact(fb_info->screen_base, fb_info->fix.smem_len); + dma_free_coherent(dev, fb_info->screen_size, fb_info->screen_base, + fb_info->fix.smem_start); } static const struct platform_device_id mxsfb_devtype[] = {