aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2012-12-14 00:34:31 -0500
committerInki Dae <inki.dae@samsung.com>2012-12-14 01:40:26 -0500
commit1169af218010ec7420c2f66c10284047774ba96c (patch)
tree1d1f7d9ce5ebab94ab49ec43540c149fb12eb1d8
parentf2c0095acbf250b0e7a714bc42f7f32ddb34cfdf (diff)
drm/exynos: fix allocation and cache mapping type
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 <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_buf.c18
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 9732043d91e..9601bad47a2 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,
34 unsigned int flags, struct exynos_drm_gem_buf *buf) 34 unsigned int flags, struct exynos_drm_gem_buf *buf)
35{ 35{
36 int ret = 0; 36 int ret = 0;
37 enum dma_attr attr = DMA_ATTR_FORCE_CONTIGUOUS; 37 enum dma_attr attr;
38 unsigned int nr_pages; 38 unsigned int nr_pages;
39 39
40 DRM_DEBUG_KMS("%s\n", __FILE__); 40 DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -46,8 +46,22 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
46 46
47 init_dma_attrs(&buf->dma_attrs); 47 init_dma_attrs(&buf->dma_attrs);
48 48
49 if (flags & EXYNOS_BO_NONCONTIG) 49 /*
50 * if EXYNOS_BO_CONTIG, fully physically contiguous memory
51 * region will be allocated else physically contiguous
52 * as possible.
53 */
54 if (flags & EXYNOS_BO_CONTIG)
55 dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
56
57 /*
58 * if EXYNOS_BO_WC or EXYNOS_BO_NONCACHABLE, writecombine mapping
59 * else cachable mapping.
60 */
61 if (flags & EXYNOS_BO_WC || !(flags & EXYNOS_BO_CACHABLE))
50 attr = DMA_ATTR_WRITE_COMBINE; 62 attr = DMA_ATTR_WRITE_COMBINE;
63 else
64 attr = DMA_ATTR_NON_CONSISTENT;
51 65
52 dma_set_attr(attr, &buf->dma_attrs); 66 dma_set_attr(attr, &buf->dma_attrs);
53 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs); 67 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs);