mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
ANDROID: GKI: dma-buf: Add support to get flags associated with a buffer
Allow kernel clients to get the flags associated with a buffer that is wrapped by a dma-buf. This information can be used to communicate the type of memory associated with the buffer(e.g. uncached vs cached memory). Bug: 133508579 Test: ion-unit-tests Change-Id: I82eab8beb738b258616c22a01080615d7ffb6ad5 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org> Signed-off-by: Sandeep Patil <sspatil@google.com> [surenb: cherry-picked from ACK 5.4 branch] Bug: 150611569 Test: build Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: I6f094f625f38b363fe7815bb5b0ab33273a4a3a5
This commit is contained in:
committed by
Suren Baghdasaryan
parent
12846026d0
commit
e4237786f4
@@ -1165,6 +1165,20 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dma_buf_vunmap);
|
||||
|
||||
int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (WARN_ON(!dmabuf) || !flags)
|
||||
return -EINVAL;
|
||||
|
||||
if (dmabuf->ops->get_flags)
|
||||
ret = dmabuf->ops->get_flags(dmabuf, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dma_buf_get_flags);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static int dma_buf_debug_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
|
||||
@@ -305,6 +305,20 @@ struct dma_buf_ops {
|
||||
|
||||
void *(*vmap)(struct dma_buf *);
|
||||
void (*vunmap)(struct dma_buf *, void *vaddr);
|
||||
|
||||
/**
|
||||
* @get_flags:
|
||||
*
|
||||
* This is called by dma_buf_get_flags and is used to get the buffer's
|
||||
* flags.
|
||||
* This callback is optional.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* 0 on success or a negative error code on failure. On success flags
|
||||
* will be populated with the buffer's flags.
|
||||
*/
|
||||
int (*get_flags)(struct dma_buf *dmabuf, unsigned long *flags);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -469,4 +483,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
|
||||
unsigned long);
|
||||
void *dma_buf_vmap(struct dma_buf *);
|
||||
void dma_buf_vunmap(struct dma_buf *, void *vaddr);
|
||||
int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags);
|
||||
#endif /* __DMA_BUF_H__ */
|
||||
|
||||
Reference in New Issue
Block a user