dmabuf.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * SPDX-License-Identifier: GPL-2.0-or-later
  3. *
  4. * QemuDmaBuf struct and helpers used for accessing its data
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  7. * See the COPYING file in the top-level directory.
  8. */
  9. #ifndef DMABUF_H
  10. #define DMABUF_H
  11. typedef struct QemuDmaBuf QemuDmaBuf;
  12. QemuDmaBuf *qemu_dmabuf_new(uint32_t width, uint32_t height,
  13. uint32_t stride, uint32_t x,
  14. uint32_t y, uint32_t backing_width,
  15. uint32_t backing_height, uint32_t fourcc,
  16. uint64_t modifier, int dmabuf_fd,
  17. bool allow_fences, bool y0_top);
  18. void qemu_dmabuf_free(QemuDmaBuf *dmabuf);
  19. G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuDmaBuf, qemu_dmabuf_free);
  20. int qemu_dmabuf_get_fd(QemuDmaBuf *dmabuf);
  21. int qemu_dmabuf_dup_fd(QemuDmaBuf *dmabuf);
  22. void qemu_dmabuf_close(QemuDmaBuf *dmabuf);
  23. uint32_t qemu_dmabuf_get_width(QemuDmaBuf *dmabuf);
  24. uint32_t qemu_dmabuf_get_height(QemuDmaBuf *dmabuf);
  25. uint32_t qemu_dmabuf_get_stride(QemuDmaBuf *dmabuf);
  26. uint32_t qemu_dmabuf_get_fourcc(QemuDmaBuf *dmabuf);
  27. uint64_t qemu_dmabuf_get_modifier(QemuDmaBuf *dmabuf);
  28. uint32_t qemu_dmabuf_get_texture(QemuDmaBuf *dmabuf);
  29. uint32_t qemu_dmabuf_get_x(QemuDmaBuf *dmabuf);
  30. uint32_t qemu_dmabuf_get_y(QemuDmaBuf *dmabuf);
  31. uint32_t qemu_dmabuf_get_backing_width(QemuDmaBuf *dmabuf);
  32. uint32_t qemu_dmabuf_get_backing_height(QemuDmaBuf *dmabuf);
  33. bool qemu_dmabuf_get_y0_top(QemuDmaBuf *dmabuf);
  34. void *qemu_dmabuf_get_sync(QemuDmaBuf *dmabuf);
  35. int32_t qemu_dmabuf_get_fence_fd(QemuDmaBuf *dmabuf);
  36. bool qemu_dmabuf_get_allow_fences(QemuDmaBuf *dmabuf);
  37. bool qemu_dmabuf_get_draw_submitted(QemuDmaBuf *dmabuf);
  38. void qemu_dmabuf_set_texture(QemuDmaBuf *dmabuf, uint32_t texture);
  39. void qemu_dmabuf_set_fence_fd(QemuDmaBuf *dmabuf, int32_t fence_fd);
  40. void qemu_dmabuf_set_sync(QemuDmaBuf *dmabuf, void *sync);
  41. void qemu_dmabuf_set_draw_submitted(QemuDmaBuf *dmabuf, bool draw_submitted);
  42. void qemu_dmabuf_set_fd(QemuDmaBuf *dmabuf, int32_t fd);
  43. #endif