summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2016-09-22 10:24:03 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2016-10-03 08:34:01 +0000
commitdb9f2fc90ad1ae302846fa23d4955a8c07c444b7 (patch)
tree59033436a665dad6b8474a7c17ac57d532e99109 /src/compositor/compositor_api
parent844204b2b04d0f3477d069db326f0e70129c71e2 (diff)
Expose native buffer handles
This is required for making accelerated compositors that do not use OpenGL. Change-Id: I76c735a971dc62344080aececc087c0495925b87 Reviewed-by: Louai Al-Khanji <louai.al-khanji@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/compositor_api')
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.cpp20
-rw-r--r--src/compositor/compositor_api/qwaylandbufferref.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandbufferref.cpp b/src/compositor/compositor_api/qwaylandbufferref.cpp
index 8f7c63f40..90b3f1c46 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.cpp
+++ b/src/compositor/compositor_api/qwaylandbufferref.cpp
@@ -277,6 +277,26 @@ QOpenGLTexture *QWaylandBufferRef::toOpenGLTexture(int plane) const
return d->buffer->toOpenGlTexture(plane);
}
+/*!
+ * Returns the native handle for this buffer, and marks it as locked so it will not be
+ * released until unlockNativeBuffer() is called.
+ *
+ * Returns 0 if there is no native handle for this buffer, or if the lock was unsuccessful.
+ */
+quintptr QWaylandBufferRef::lockNativeBuffer()
+{
+ return d->buffer->lockNativeBuffer();
+}
+
+/*!
+ * Marks the native buffer as no longer in use. \a handle must correspond to the value returned by
+ * a previous call to lockNativeBuffer().
+ */
+void QWaylandBufferRef::unlockNativeBuffer(quintptr handle)
+{
+ d->buffer->unlockNativeBuffer(handle);
+}
+
#endif
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandbufferref.h b/src/compositor/compositor_api/qwaylandbufferref.h
index 549ea0a80..06486ef3a 100644
--- a/src/compositor/compositor_api/qwaylandbufferref.h
+++ b/src/compositor/compositor_api/qwaylandbufferref.h
@@ -103,6 +103,9 @@ public:
QOpenGLTexture *toOpenGLTexture(int plane = 0) const;
#endif
+ quintptr lockNativeBuffer();
+ void unlockNativeBuffer(quintptr handle);
+
private:
explicit QWaylandBufferRef(QtWayland::ClientBuffer *buffer);
QtWayland::ClientBuffer *buffer() const;