From patchwork Mon Jul 9 11:41:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathyush K X-Patchwork-Id: 1176181 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id E2E1C40B37 for ; Tue, 10 Jul 2012 07:06:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3D719EB5E for ; Tue, 10 Jul 2012 00:06:11 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 601 seconds by postgrey-1.32 at gabe; Mon, 09 Jul 2012 13:37:26 CEST Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B16C9F5AF for ; Mon, 9 Jul 2012 04:37:25 -0700 (PDT) Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M6W00EGB55NLG30@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 09 Jul 2012 20:27:23 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-de-4ffac01be1f5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 24.60.19326.B10CAFF4; Mon, 09 Jul 2012 20:27:23 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M6W00MF155IAY50@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 09 Jul 2012 20:27:23 +0900 (KST) From: Prathyush K To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: Add exynos drm specific fb_mmap function Date: Mon, 09 Jul 2012 17:11:22 +0530 Message-id: <1341834082-14775-1-git-send-email-prathyush.k@samsung.com> X-Mailer: git-send-email 1.7.0.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLJMWRmVeSWpSXmKPExsVy+t9jQV3pA7/8DZ5Ns7S48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGQ93b2EqWMhT8XinVAPjPK4uRg4OCQETibY7Yl2MnECmmMSF e+vZuhi5OIQEpjNKnP13khnCWc0kcXDiRBaQKjYBbYlfc+6ygtgiAsoSfyeuYgSxhQVcJW7P awarYRFQlXjwp50ZxOYVcJf4tPQsG8QGBYnWZYfYJzByLWBkWMUomlqQXFCclJ5rqFecmFtc mpeul5yfu4kR7KlnUjsYVzZYHGIU4GBU4uHduPOXvxBrYllxZe4hRgkOZiUR3gedQCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8xt5f/YUE0hNLUrNTUwtSi2CyTBycQK9LbL9+Pi7fn8143/9j XD/i8i6y/WyMPn6k7uK3KKvV7+1dJxaLmjaJb9t8W/UgU+3Six4nQ+ZFGpg+2yLAYCty++SP gvaEOjlRuz7TbPZ8JesbK+b1r3IO/XtQXFhWqv23vpiX4SSOGdbXSzYyvu8w9PfnPPc+6+zT qSkxFrypJ95yyLd37FJiKc5INNRiLipOBADtvoAf0AEAAA== X-TM-AS-MML: No X-Mailman-Approved-At: Mon, 09 Jul 2012 23:09:21 -0700 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org This patch adds a exynos drm specific implementation of fb_mmap which supports mapping a non-contiguous buffer to user space. This new function does not assume that the frame buffer is contiguous and calls dma_mmap_writecombine for mapping the buffer to user space. dma_mmap_writecombine will be able to map a contiguous buffer as well as non-contig buffer depending on whether an IOMMU mapping is created for drm or not. Signed-off-by: Prathyush K --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d5586cc..b53e638 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -46,8 +46,24 @@ struct exynos_drm_fbdev { struct exynos_drm_gem_obj *exynos_gem_obj; }; +static int exynos_drm_fb_mmap(struct fb_info *info, + struct vm_area_struct *vma) +{ + if ((vma->vm_end - vma->vm_start) > info->fix.smem_len) + return -EINVAL; + + vma->vm_pgoff = 0; + vma->vm_flags |= VM_IO | VM_RESERVED; + if (dma_mmap_writecombine(info->device, vma, info->screen_base, + info->fix.smem_start, vma->vm_end - vma->vm_start)) + return -EAGAIN; + + return 0; +} + static struct fb_ops exynos_drm_fb_ops = { .owner = THIS_MODULE, + .fb_mmap = exynos_drm_fb_mmap, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit,