diff options
author | Russell King <rmk@arm.linux.org.uk> | 2013-06-20 13:32:17 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2013-06-22 23:27:34 +0100 |
commit | f1383479463443d22cf9f730adf40679e59ea2fc (patch) | |
tree | fdb6f5596593a42990553cacb46a239583249817 /bmm_lib.c | |
parent | 399b0f5486bf1199b74a6eb043b3aed60723d1fe (diff) |
Add dma_buf export API
Add an API to allow bmm buffers to be exported as dma_buf objects, so
they can be imported into DRM without needing to resort to passing
physical addresses around.
Diffstat (limited to 'bmm_lib.c')
-rw-r--r-- | bmm_lib.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -34,6 +34,7 @@ #define API_COMP_MAX 0x0000 #define API_FEAT(x) ((x) >> 16) #define API_COMP(x) ((x) & 0xffff) +#define API_FEAT_GET_DMABUF_FD 0x0001 static unsigned bmm_api; static int bmm_fd = -1; @@ -207,6 +208,23 @@ unsigned long bmm_get_paddr(void *vaddr) return io.output; } +int bmm_get_dmabuf_fd(void *vaddr) +{ + int ret; + ioctl_arg_t io; + + if (bmm_init() < 0 || API_FEAT(bmm_api) < API_FEAT_GET_DMABUF_FD) + return -1; + + io.input = (unsigned long)vaddr; + io.output = 0; + io.arg = 0; + + ret = ioctl(bmm_fd, BMM_GET_DMABUF_FD, &io); + + return ret < 0 ? -1 : io.output; +} + unsigned long bmm_get_mem_size(void *vaddr) { int ret; |