aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-29 21:01:11 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-07-01 14:57:52 -0400
commit08e5b909f94a0f8661e1455575bacbad8c79ae77 (patch)
tree4b48fd2b2572f982caf10a1873a06c4b1d3fab80 /include
parent18adb43a44cbb31eeeb3d6845690d2cb5c9dc61b (diff)
buffer: add wlr_dmabuf_buffer
Diffstat (limited to 'include')
-rw-r--r--include/types/wlr_buffer.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h
index 85a8d8b4..b5210bfb 100644
--- a/include/types/wlr_buffer.h
+++ b/include/types/wlr_buffer.h
@@ -53,6 +53,25 @@ struct wlr_readonly_data_buffer *readonly_data_buffer_create(uint32_t format,
*/
bool readonly_data_buffer_drop(struct wlr_readonly_data_buffer *buffer);
+struct wlr_dmabuf_buffer {
+ struct wlr_buffer base;
+ struct wlr_dmabuf_attributes dmabuf;
+ bool saved;
+};
+
+/**
+ * Wraps a DMA-BUF into a wlr_buffer. The DMA-BUF may be accessed until
+ * dmabuf_buffer_drop() is called.
+ */
+struct wlr_dmabuf_buffer *dmabuf_buffer_create(
+ struct wlr_dmabuf_attributes *dmabuf);
+/**
+ * Drops ownership of the buffer (see wlr_buffer_drop() for more details) and
+ * takes a reference to the DMA-BUF (by dup'ing its file descriptors) if a
+ * consumer still has the buffer locked.
+ */
+bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer);
+
/**
* Buffer capabilities.
*