summaryrefslogtreecommitdiff
path: root/src/compositor.c
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-09-29 14:18:40 -0400
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-08-14 15:53:25 +0300
commit230f3b1bf896fcf3fa76b4d7093122b3361f7e36 (patch)
tree8a8627c2d4e31bff6f4cc30d534931c1268871d4 /src/compositor.c
parent23ab7159d200883cc0d21db8dc4efdd58e2d60a7 (diff)
downloadweston-230f3b1bf896fcf3fa76b4d7093122b3361f7e36.tar.gz
dmabuf: implement linux_dmabuf extension
v2 changes: - implement the revised protocol - add basic sanity checks when creating buffer and check for support - add way to attach user data to the dmabuf for renderer use - bump max number of planes to 4 to follow DRM AddFb2 ioctl - improve errors handling - use separate linux_dmabuf_buffer fields for the different wl_resource types - as SERVER_ERROR code is no more, use a wl_display "generic" error for emergency-disconneting a client we fail to process - more documentation - change y-invert from per-plane boolean to per-buffer flag Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'src/compositor.c')
-rw-r--r--src/compositor.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 0268afca..cbef4dc8 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4672,6 +4672,34 @@ weston_compositor_read_presentation_clock(
}
}
+/** Import dmabuf buffer into current renderer
+ *
+ * \param compositor
+ * \param buffer the dmabuf buffer to import
+ * \return true on usable buffers, false otherwise
+ *
+ * This function tests that the linux_dmabuf_buffer is usable
+ * for the current renderer. Returns false on unusable buffers. Usually
+ * usability is tested by importing the dmabufs for composition.
+ *
+ * This hook is also used for detecting if the renderer supports
+ * dmabufs at all. If the renderer hook is NULL, dmabufs are not
+ * supported.
+ * */
+WL_EXPORT bool
+weston_compositor_import_dmabuf(struct weston_compositor *compositor,
+ struct linux_dmabuf_buffer *buffer)
+{
+ struct weston_renderer *renderer;
+
+ renderer = compositor->renderer;
+
+ if (renderer->import_dmabuf == NULL)
+ return false;
+
+ return renderer->import_dmabuf(compositor, buffer);
+}
+
WL_EXPORT void
weston_version(int *major, int *minor, int *micro)
{