dma-buf.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Framework for buffer objects that can be shared across devices/subsystems.
  4. *
  5. * Copyright(C) 2015 Intel Ltd
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _DMA_BUF_UAPI_H_
  20. #define _DMA_BUF_UAPI_H_
  21. #include <linux/types.h>
  22. /* begin/end dma-buf functions used for userspace mmap. */
  23. struct dma_buf_sync {
  24. __u64 flags;
  25. };
  26. #define DMA_BUF_SYNC_READ (1 << 0)
  27. #define DMA_BUF_SYNC_WRITE (2 << 0)
  28. #define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
  29. #define DMA_BUF_SYNC_START (0 << 2)
  30. #define DMA_BUF_SYNC_END (1 << 2)
  31. #define DMA_BUF_SYNC_VALID_FLAGS_MASK \
  32. (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
  33. #define DMA_BUF_NAME_LEN 32
  34. #define DMA_BUF_BASE 'b'
  35. #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
  36. /* 32/64bitness of this uapi was botched in android, there's no difference
  37. * between them in actual uapi, they're just different numbers.
  38. */
  39. #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
  40. #define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
  41. #define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
  42. #endif