disp: msm: avoid begin/end cpu_access calls based on dma-coherent attribute

This change avoids unnecessary calls to dma_buf_end_cpu_access and
dma_buf_begin_cpu_access for context banks which have dma-coherent
attribute set.

Change-Id: I5120e55bed372d166d05da988714551428964b8b
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:
Samantha Tran
2021-08-23 14:39:49 -07:00
parent 3a2c526376
commit 9c771fe6e1

View File

@@ -744,10 +744,12 @@ static void *get_vaddr(struct drm_gem_object *obj, unsigned madv)
}
if (obj->import_attach) {
ret = dma_buf_begin_cpu_access(
obj->import_attach->dmabuf, DMA_BIDIRECTIONAL);
if (ret)
goto fail;
if (obj->dev && obj->dev->dev && !dev_is_dma_coherent(obj->dev->dev)) {
ret = dma_buf_begin_cpu_access(
obj->import_attach->dmabuf, DMA_BIDIRECTIONAL);
if (ret)
goto fail;
}
msm_obj->vaddr =
dma_buf_vmap(obj->import_attach->dmabuf);
@@ -870,8 +872,8 @@ static void msm_gem_vunmap_locked(struct drm_gem_object *obj)
if (obj->import_attach) {
dma_buf_vunmap(obj->import_attach->dmabuf, msm_obj->vaddr);
dma_buf_end_cpu_access(obj->import_attach->dmabuf,
DMA_BIDIRECTIONAL);
if (obj->dev && obj->dev->dev && !dev_is_dma_coherent(obj->dev->dev))
dma_buf_end_cpu_access(obj->import_attach->dmabuf, DMA_BIDIRECTIONAL);
} else {
vunmap(msm_obj->vaddr);
}