From patchwork Wed Nov 7 11:08:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1710171 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 0E40A3FC8F for ; Wed, 7 Nov 2012 11:41:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 072B39EF92 for ; Wed, 7 Nov 2012 03:41:59 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 15D479E76A for ; Wed, 7 Nov 2012 02:49:01 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD400EC261L5EL0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 07 Nov 2012 19:48:59 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 97.1B.12699.B9C3A905; Wed, 07 Nov 2012 19:48:59 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-76-509a3c9b87ae Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 37.1B.12699.B9C3A905; Wed, 07 Nov 2012 19:48:59 +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 <0MD4006I25YUOJ50@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 07 Nov 2012 19:48:59 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: Add exynos drm specific fb_mmap function Date: Wed, 07 Nov 2012 16:38:10 +0530 Message-id: <1352286490-10797-1-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsWyRsSkSne2zawAg3ML9CyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxrEF6xkLfvFVXH+o2MC4g6eLkZNDQsBE4uKaeywQtpjEhXvr 2UBsIYGljBLtkz1hat6/3QsU5wKKT2eUmDz5PhOEs5pJovfpCnaQKjYBXYnZB58xgtgiAsoS fyeuArOZBVYzSqx9VwhiCwu4Stye1wy2jUVAVaJj3Ucwm1fAQ+LWw3msENsUJFqXHWKHqBGQ +Db5EFANB1BcVmLTAWaQvRICO9gkmh6fhLpaUuLgihssExgFFzAyrGIUTS1ILihOSs810itO zC0uzUvXS87P3cQIDKnT/55J72Bc1WBxiFGAg1GJh9cidWaAEGtiWXFl7iFGCQ5mJRHe5Uaz AoR4UxIrq1KL8uOLSnNSiw8x+gBdMpFZSjQ5HxjueSXxhsYm5qbGppZGRmampjiElcR5mz1S AoQE0hNLUrNTUwtSi2DGMXFwSjUwbjglI6We7mOykfcYTxxrq7VmfvyPBp5qBX9BgX0rDB/E PDv1RyPk7gvdnB8fF6xxfVXRlbgwVzs9qibjwnvXaWsCDpXkt076efnYERGbffefLzm7zm9O lu/2pGfOcWJGGx5eyUxN3/TLPPf8q9XTK9L+9Z64w6p/OVDC10wybuNdnRXMEWV/lFiKMxIN tZiLihMByo8B7VYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t9jQd3ZNrMCDD6dlbe48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYQ1jBnHFqxnLPjFV3H9oWID 4w6eLkZODgkBE4n3b/eyQdhiEhfurQeyuTiEBKYzSkyefJ8JwlnNJNH7dAU7SBWbgK7E7IPP GEFsEQFlib8TV4HZzAKrGSXWvisEsYUFXCVuz2tmAbFZBFQlOtZ9BLN5BTwkbj2cxwqxTUGi ddkh9gmM3AsYGVYxiqYWJBcUJ6XnGukVJ+YWl+al6yXn525iBIfsM+kdjKsaLA4xCnAwKvHw WqTODBBiTSwrrsw9xCjBwawkwrvcaFaAEG9KYmVValF+fFFpTmrxIUYfoO0TmaVEk/OB8ZRX Em9obGJuamxqaWJhYmaJQ1hJnLfZIyVASCA9sSQ1OzW1ILUIZhwTB6dUAyPzJcdK39ef1knM Uf3zwfP5zu6iiNQLZ2bMKZu/20ZL4DMTs9ofNj7r5rhn1cnp1/NWF78//WXhtYI9rkVpUh9N 7+scKpG/O016r8+9tKYnYQ9410UcWb6LcdnyzyJJfzjyFiZ6z3RrFuWaJ7CPqWO99broad6N 3pvDc9UmhOns9b0/6+/Z3z5KLMUZiYZazEXFiQDzUjZbhgIAAA== X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 07 Nov 2012 03:37:27 -0800 Cc: prathyush.k@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, prashanth.g@samsung.com, rahul.sharma@samsung.com 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 From: Prathyush K 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 Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 67eb6ba..3939f7f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -46,8 +46,34 @@ 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) +{ + DRM_DEBUG_KMS("%s\n", __func__); + + if (!vma || !info) { + DRM_ERROR("invalid arguments vma 0x%x, info 0x%x.\n", + (unsigned int)vma, (unsigned int)info); + return -EINVAL; + } + + if (!info->screen_base || info->screen_size == 0) { + DRM_ERROR("invalid screen information.\n"); + return -EINVAL; + } + + vma->vm_pgoff = 0; + vma->vm_flags |= VM_IO; + 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,