mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
ANDROID: staging: ion: implement vmap for built-in heaps
dma_buf_vmap() on ION buffers returns -EOPNOTSUPP if the heap of ION buffer does not implement its own vmap callback. Even the default system heap does not implement vmap callback, so vmap attempt of ION buffer will always fail. However vmap of ION buffer is much more reasonable to be supported by default than errors, so this patch implements vmap callback. Bug: 150258007 Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com> Change-Id: I243eb7ded49843e719532ad1b1cb7ab37e84460d
This commit is contained in:
parent
fa04c81b9e
commit
2a84b66a5d
1 changed files with 14 additions and 5 deletions
|
|
@ -287,11 +287,16 @@ static void *ion_dma_buf_vmap(struct dma_buf *dmabuf)
|
|||
{
|
||||
struct ion_buffer *buffer = dmabuf->priv;
|
||||
struct ion_heap *heap = buffer->heap;
|
||||
void *vaddr;
|
||||
|
||||
if (!heap->buf_ops.vmap)
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
if (heap->buf_ops.vmap)
|
||||
return heap->buf_ops.vmap(dmabuf);
|
||||
|
||||
return heap->buf_ops.vmap(dmabuf);
|
||||
mutex_lock(&buffer->lock);
|
||||
vaddr = ion_buffer_kmap_get(buffer);
|
||||
mutex_unlock(&buffer->lock);
|
||||
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
static void ion_dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
|
||||
|
|
@ -299,10 +304,14 @@ static void ion_dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
|
|||
struct ion_buffer *buffer = dmabuf->priv;
|
||||
struct ion_heap *heap = buffer->heap;
|
||||
|
||||
if (!heap->buf_ops.vunmap)
|
||||
if (heap->buf_ops.vunmap) {
|
||||
heap->buf_ops.vunmap(dmabuf, vaddr);
|
||||
return;
|
||||
}
|
||||
|
||||
return heap->buf_ops.vunmap(dmabuf, vaddr);
|
||||
mutex_lock(&buffer->lock);
|
||||
ion_buffer_kmap_put(buffer);
|
||||
mutex_unlock(&buffer->lock);
|
||||
}
|
||||
|
||||
static int ion_dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags)
|
||||
|
|
|
|||
Loading…
Reference in a new issue