From patchwork Fri Dec 14 06:42:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1877431 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 F30F73FC64 for ; Fri, 14 Dec 2012 06:42:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7A27E67E5 for ; Thu, 13 Dec 2012 22:42:55 -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 80DC4E5CF6 for ; Thu, 13 Dec 2012 22:42:43 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MF000ML0DAWVGN0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 15:42:41 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.42]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 4A.28.01231.16ACAC05; Fri, 14 Dec 2012 15:42:41 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-1f-50caca61c428 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0A.28.01231.16ACAC05; Fri, 14 Dec 2012 15:42:41 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MF000FR5DB5VVA2@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 15:42:41 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/exynos: fix allocation and cache mapping type Date: Fri, 14 Dec 2012 15:42:40 +0900 Message-id: <1355467360-29850-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1355464425-8871-1-git-send-email-inki.dae@samsung.com> References: <1355464425-8871-1-git-send-email-inki.dae@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t8zLd3EU6cCDKZ9ULO48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGV0HjrMXXOGt2L8ks4FxK3cXIyeHhICJxKSbc5khbDGJC/fW s3UxcnEICSxjlJjYM5sdpmjl5sfMEInpjBLz1+8ESwgJrGeS+PTTAMRmE1CVmLjiPhuILSJg KtExaSkLiM0sUCixsOcpmC0s4Cpx6f53sG0sQPWT+yeBzeEVcJE4uPItE8QyBYkF996CzeEE ir/ffRtql7PEjMeboHoFJL5NPgQ0kwOoXlZi0wGw2yQEzrBJ/Fx7HeobSYmDK26wTGAUXsDI sIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/dxMjJASldjCubLA4xCjAwajEw/tR6FSAEGtiWXFl 7iFGCQ5mJRFeySNAId6UxMqq1KL8+KLSnNTiQ4w+QJdMZJYSTc4HxkdeSbyhsYGxoaGloZmp pakBDmElcd5mj5QAIYH0xJLU7NTUgtQimHFMHJxSDYxyaRkbMu6v3zDJcr78gVCdQyIvTt+6 2HSun8lfPk3BVXkPy6Rzrh2KNZFlKV//sh+XNfzF8slF9nizZ6bK9bUn+L9NWl3hUHBEOaSH 3ffSb+6HUs9mJa/86GSq/sueZ13aydNLH3UcZ2bj+LnBvfOe51q+bvcfNTFlWvZPXNy3F+Re fciUt1SJpTgj0VCLuag4EQBQkIwubgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xoG7iqVMBBluvy1lc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xoyuA8fZC67wVuxfktnA uJW7i5GTQ0LARGLl5sfMELaYxIV769m6GLk4hASmM0rMX7+THSQhJLCeSeLTTwMQm01AVWLi ivtsILaIgKlEx6SlLCA2s0ChxMKep2C2sICrxKX738GGsgDVT+6fBDaHV8BF4uDKt0wQyxQk Ftx7CzaHEyj+fvdtqF3OEjMeb2KewMi7gJFhFaNoakFyQXFSeq6hXnFibnFpXrpecn7uJkZw gD+T2sG4ssHiEKMAB6MSD+9HoVMBQqyJZcWVuYcYJTiYlUR4JY8AhXhTEiurUovy44tKc1KL DzH6AF01kVlKNDkfGH15JfGGxiZmRpZGZsYm5sbGOISVxHmbPVIChATSE0tSs1NTC1KLYMYx cXBKNTDO+X33rJy/sPzcq9+srvZt/X344Eqd3Y1/Xk+K3LR3lc0y7q9vi3gW/p3OEvvY9rCT /LlV12KfXlkiXR2+ZoKyWMOsM1uXWaxie/DU4+Slb98Od36rnbnFMs5kFnfbThEd4dyqbzkh 7vXrfcXOR25cFHmxsX9/m/rteZuuvg4vvGclldP6hJUxSYmlOCPRUIu5qDgRAAyT69OdAgAA X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@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 This patch fixes memory alloction(contiguous or not) and cache mapping types(cachable or not). For this, it converts each type from user request into dma attribute properly. Changelog v2: - just code cleanup. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 9732043..9601bad 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -34,7 +34,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, unsigned int flags, struct exynos_drm_gem_buf *buf) { int ret = 0; - enum dma_attr attr = DMA_ATTR_FORCE_CONTIGUOUS; + enum dma_attr attr; unsigned int nr_pages; DRM_DEBUG_KMS("%s\n", __FILE__); @@ -46,8 +46,22 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, init_dma_attrs(&buf->dma_attrs); - if (flags & EXYNOS_BO_NONCONTIG) + /* + * if EXYNOS_BO_CONTIG, fully physically contiguous memory + * region will be allocated else physically contiguous + * as possible. + */ + if (flags & EXYNOS_BO_CONTIG) + dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs); + + /* + * if EXYNOS_BO_WC or EXYNOS_BO_NONCACHABLE, writecombine mapping + * else cachable mapping. + */ + if (flags & EXYNOS_BO_WC || !(flags & EXYNOS_BO_CACHABLE)) attr = DMA_ATTR_WRITE_COMBINE; + else + attr = DMA_ATTR_NON_CONSISTENT; dma_set_attr(attr, &buf->dma_attrs); dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs);