aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-05-26 14:44:02 +0200
committerSimon Ser <contact@emersion.fr>2022-11-28 23:50:41 +0000
commitaaf828d3d24c79c2207e83d38a76c7f1cc33084f (patch)
treedf2db2c083766bce86e1b870909c7500859b3e73 /include
parent10f543d5792ec0a74688c4da3781f6f84fb2ed9d (diff)
render/dmabuf: add dmabuf_import_sync_file
References: https://lore.kernel.org/dri-devel/20220506180216.2095060-1-jason@jlekstrand.net/
Diffstat (limited to 'include')
-rw-r--r--include/render/dmabuf.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/render/dmabuf.h b/include/render/dmabuf.h
new file mode 100644
index 00000000..4e82a99f
--- /dev/null
+++ b/include/render/dmabuf.h
@@ -0,0 +1,26 @@
+#ifndef RENDER_DMABUF_H
+#define RENDER_DMABUF_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+// Copied from <linux/dma-buf.h> to avoid #ifdef soup
+#define DMA_BUF_SYNC_READ (1 << 0)
+#define DMA_BUF_SYNC_WRITE (2 << 0)
+#define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
+
+/**
+ * Check whether DMA-BUF import/export from/to sync_file is available.
+ *
+ * If this function returns true, dmabuf_import_sync_file() is supported.
+ */
+bool dmabuf_check_sync_file_import_export(void);
+
+/**
+ * Import a sync_file into a DMA-BUF with DMA_BUF_IOCTL_IMPORT_SYNC_FILE.
+ *
+ * This can be used to make explicit sync interoperate with implicit sync.
+ */
+bool dmabuf_import_sync_file(int dmabuf_fd, uint32_t flags, int sync_file_fd);
+
+#endif