From patchwork Fri Dec 14 05:53:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1877331 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 BB0123FC64 for ; Fri, 14 Dec 2012 05:54:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A322E66CD for ; Thu, 13 Dec 2012 21:54:00 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 36AACE5DC0 for ; Thu, 13 Dec 2012 21:53:48 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MF0003Z2AYSISN0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 14:53:46 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.44]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 5E.36.01231.AEEBAC05; Fri, 14 Dec 2012 14:53:46 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-37-50cabeead8a2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0D.36.01231.AEEBAC05; Fri, 14 Dec 2012 14:53:46 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MF00020WB1MDP90@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 14:53:46 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: drm/exynos: fix allocation and cache mapping type Date: Fri, 14 Dec 2012 14:53:45 +0900 Message-id: <1355464425-8871-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t8zHd1X+04FGEy6oWNx5et7NgdGj/vd x5kCGKO4bFJSczLLUov07RK4Mh70vmApOM5b8WDqW+YGxhXcXYwcHBICJhKTr1d3MXICmWIS F+6tZ+ti5OIQEljGKPHz1E8WiISJxMH7HSwQiUWMElsPzoFy1jNJ/G2awApSxSagKjFxxX02 EFtEwFSiY9JSsG5mgUKJhT1PWUC2CQtYSew/bQgSZgEq33rvLhOIzSvgLHHy6RZ2iGUKEgvu vWWDqBGQ+Db5EAvEobISmw4wg6yVENjBJjGz8worRL2kxMEVN1gmMAouYGRYxSiaWpBcUJyU nmuoV5yYW1yal66XnJ+7iRESUlI7GFc2WBxiFOBgVOLh/Sh0KkCINbGsuDL3EKMEB7OSCO+2 XUAh3pTEyqrUovz4otKc1OJDjD5Al0xklhJNzgeGe15JvKGxgbGhoaWhmamlqQEOYSVx3maP lAAhgfTEktTs1NSC1CKYcUwcnFINjPOlBH+EfomznFz7Y1JdtvDN7R1rogLZWqdzd8e9UbF8 L+3OYCjSrrPEq9nMTinizPv+i1ELV5jvesnVW2FquuILk++bww/XvNmx7oGgnUbZuUx7P7kD rNKTJ1/Q1rpZeNHmMqvAQ4dfi++9jnXiELn08CzP9oPTuhelPX42P/BF29dvsS1ZK5RYijMS DbWYi4oTARzZfSxWAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t9jAd1X+04FGOxv0LC48vU9mwOjx/3u 40wBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYR1jBkPel+wFBznrXgw9S1z A+MK7i5GTg4JAROJg/c7WCBsMYkL99azdTFycQgJLGKU2HpwDguEs55J4m/TBFaQKjYBVYmJ K+6zgdgiAqYSHZOWgnUzCxRKLOx5CmRzcAgLWEnsP20IEmYBKt967y4TiM0r4Cxx8ukWdohl ChIL7r1lm8DIvYCRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGcMg+k9rBuLLB4hCjAAej Eg/vR6FTAUKsiWXFlbmHGCU4mJVEeLftAgrxpiRWVqUW5ccXleakFh9i9AHaPpFZSjQ5HxhP eSXxhsYmZkaWRmbGJubGxjiElcR5mz1SAoQE0hNLUrNTUwtSi2DGMXFwSjUwljy6fPSEfq7l /SWJnj7VXFP3xtza8c2N4af6JK0fmzm+3OxedrhtIddjbd7UN+/zFzfLSzp6Pp19v2Jd78Qb KQ6pyzZVcJ1e6bEgOtamqfP5u/khvF9nvrihxvpEWeq3pNPDbUv5TtTnBoTe+NfJXvjlyLsq tuDlsbdMNh83rJ12Si4+54BMhBJLcUaioRZzUXEiALV1keSGAgAA 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. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 7dc1309..e05fcfe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -61,7 +61,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__); @@ -73,8 +73,24 @@ 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) { + attr = DMA_ATTR_FORCE_CONTIGUOUS; + dma_set_attr(attr, &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);