| 123456789101112131415161718192021 |
- #ifndef __DMA_UTIL_H__
- #define __DMA_UTIL_H__
- #include <stddef.h>
- #include <stdint.h>
- #include <sys/ioctl.h>
- #include <linux/dma-buf.h>
- /* Allocate one dma-buf from /dev/dma_heap/<heap_name>, falling back to
- * "system-uncached" when the named heap does not exist. Returns 0 and sets
- * *fd on success, -1 on failure. Shared by main/decoder/display/detector. */
- int dma_heap_alloc(const char *heap_name, size_t size, int *fd);
- /* Convenience wrapper for the DMA_BUF_IOCTL_SYNC START/END handshake,
- * e.g. dmabuf_sync(fd, DMA_BUF_SYNC_START | DMA_BUF_SYNC_WRITE). */
- static inline void dmabuf_sync(int fd, int flags) {
- struct dma_buf_sync s = { .flags = (uint64_t)flags };
- ioctl(fd, DMA_BUF_IOCTL_SYNC, &s);
- }
- #endif
|