xref: /openbmc/qemu/include/ui/dmabuf.h (revision ee48fef0)
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 
10 #ifndef DMABUF_H
11 #define DMABUF_H
12 
13 typedef struct QemuDmaBuf QemuDmaBuf;
14 
15 QemuDmaBuf *qemu_dmabuf_new(uint32_t width, uint32_t height,
16                             uint32_t stride, uint32_t x,
17                             uint32_t y, uint32_t backing_width,
18                             uint32_t backing_height, uint32_t fourcc,
19                             uint64_t modifier, int dmabuf_fd,
20                             bool allow_fences, bool y0_top);
21 void qemu_dmabuf_free(QemuDmaBuf *dmabuf);
22 
23 G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuDmaBuf, qemu_dmabuf_free);
24 
25 int qemu_dmabuf_get_fd(QemuDmaBuf *dmabuf);
26 int qemu_dmabuf_dup_fd(QemuDmaBuf *dmabuf);
27 void qemu_dmabuf_close(QemuDmaBuf *dmabuf);
28 uint32_t qemu_dmabuf_get_width(QemuDmaBuf *dmabuf);
29 uint32_t qemu_dmabuf_get_height(QemuDmaBuf *dmabuf);
30 uint32_t qemu_dmabuf_get_stride(QemuDmaBuf *dmabuf);
31 uint32_t qemu_dmabuf_get_fourcc(QemuDmaBuf *dmabuf);
32 uint64_t qemu_dmabuf_get_modifier(QemuDmaBuf *dmabuf);
33 uint32_t qemu_dmabuf_get_texture(QemuDmaBuf *dmabuf);
34 uint32_t qemu_dmabuf_get_x(QemuDmaBuf *dmabuf);
35 uint32_t qemu_dmabuf_get_y(QemuDmaBuf *dmabuf);
36 uint32_t qemu_dmabuf_get_backing_width(QemuDmaBuf *dmabuf);
37 uint32_t qemu_dmabuf_get_backing_height(QemuDmaBuf *dmabuf);
38 bool qemu_dmabuf_get_y0_top(QemuDmaBuf *dmabuf);
39 void *qemu_dmabuf_get_sync(QemuDmaBuf *dmabuf);
40 int32_t qemu_dmabuf_get_fence_fd(QemuDmaBuf *dmabuf);
41 bool qemu_dmabuf_get_allow_fences(QemuDmaBuf *dmabuf);
42 bool qemu_dmabuf_get_draw_submitted(QemuDmaBuf *dmabuf);
43 void qemu_dmabuf_set_texture(QemuDmaBuf *dmabuf, uint32_t texture);
44 void qemu_dmabuf_set_fence_fd(QemuDmaBuf *dmabuf, int32_t fence_fd);
45 void qemu_dmabuf_set_sync(QemuDmaBuf *dmabuf, void *sync);
46 void qemu_dmabuf_set_draw_submitted(QemuDmaBuf *dmabuf, bool draw_submitted);
47 void qemu_dmabuf_set_fd(QemuDmaBuf *dmabuf, int32_t fd);
48 
49 #endif
50