From fb4e66e115d4a75114bf602fbef0bf6314a00161 Mon Sep 17 00:00:00 2001 From: Zhen Chen Date: Wed, 27 Jan 2021 19:50:11 +0800 Subject: [PATCH] android: ion: pass in DMA_ATTR_SKIP_CPU_SYNC when calling dma_(un)map_sg_attrs() Imitate the behaviors of drm_gem_map_detach() and drm_gem_map_dma_buf(). Graphics performance of rk3399 device using ion without this modification, was quite poor. Change-Id: Ia0b8e2f3026a61ee4addee9c1715291886fa1c99 Signed-off-by: Zhen Chen --- drivers/staging/android/ion/ion.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index e2d00a8efb78..fb4dea3dc326 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -276,8 +276,11 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment, table = a->table; - if (!dma_map_sg(attachment->dev, table->sgl, table->nents, - direction)) + if (!dma_map_sg_attrs(attachment->dev, + table->sgl, + table->nents, + direction, + DMA_ATTR_SKIP_CPU_SYNC)) return ERR_PTR(-ENOMEM); a->mapped = true; @@ -293,7 +296,11 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment, a->mapped = false; - dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction); + dma_unmap_sg_attrs(attachment->dev, + table->sgl, + table->nents, + direction, + DMA_ATTR_SKIP_CPU_SYNC); } static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)