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 <chenzhen@rock-chips.com>
This commit is contained in:
Zhen Chen
2021-01-27 19:50:11 +08:00
committed by Tao Huang
parent 8c59d20b75
commit fb4e66e115

View File

@@ -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)