summaryrefslogtreecommitdiffstats
path: root/src/compositor/hardware_integration
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-10-15 18:26:00 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-10-20 14:58:29 +0000
commit955ac0d0eeaf2f543676b649291558f4dcce37c3 (patch)
tree7217e1c805f1386d89f0dccbafbe2ae4f5e40409 /src/compositor/hardware_integration
parent3a584414d9df972721a4fbf4b1088bce5e95484b (diff)
Support EGLStream in wayland-egl
For Wayland on NVIDIA. Tested with a Jetson TK1 Pro and Vibrante Linux. With just the hw integration no compositors would work out of the box since EGL_KHR_stream_consumer_gltexture only allows connecting to the texture bound to GL_TEXTURE_EXTERNAL_OES, meaning that assumptions about the target always being GL_TEXTURE_2D break horribly both in C++ and in shader code. In addition, buffers have to be extended with an additional updateTexture() operation as EGLStream requires to call ConsumerAcquire on every frame. Previously there was no concept of this as calling createTexture() on attach() was sufficient. Qt Quick bits are omitted since the refactored compositor API is pretty different. This means that QML compositors will not currently function in this environment. The qwindow-compositor example is enhanced to support the external texture target, but this won't apply for the refactored branch either. It is provided for testing purposes for the time being, and to show how C++ compositors can support different texture targets and correct operation with EGLStreams. Done-with: Louai Al-Khanji <louai.al-khanji@theqtcompany.com> Change-Id: I0e209fc0cbcf435cca83528d938eb50e4bdceb82 Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
Diffstat (limited to 'src/compositor/hardware_integration')
-rw-r--r--src/compositor/hardware_integration/qwlclientbufferintegration_p.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
index e4bbb45b9..c19b90309 100644
--- a/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
+++ b/src/compositor/hardware_integration/qwlclientbufferintegration_p.h
@@ -75,14 +75,29 @@ public:
virtual void initializeHardware(QtWayland::Display *waylandDisplay) = 0;
- // Used when the hardware integration wants to provide its own texture for a given buffer.
- // In most cases the compositor creates and manages the texture so this is not needed.
- virtual GLuint textureForBuffer(struct ::wl_resource *buffer) { Q_UNUSED(buffer); return 0; }
- virtual void destroyTextureForBuffer(struct ::wl_resource *buffer) { Q_UNUSED(buffer); }
+ virtual void initialize(struct ::wl_resource *buffer) { Q_UNUSED(buffer); }
+
+ virtual GLenum textureTargetForBuffer(struct ::wl_resource *buffer) const { Q_UNUSED(buffer); return GL_TEXTURE_2D; }
+
+ virtual GLuint textureForBuffer(struct ::wl_resource *buffer) {
+ Q_UNUSED(buffer);
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ return texture;
+ }
+
+ virtual void destroyTextureForBuffer(struct ::wl_resource *buffer, GLuint texture)
+ {
+ Q_UNUSED(buffer);
+ glDeleteTextures(1, &texture);
+ }
// Called with the texture bound.
virtual void bindTextureToBuffer(struct ::wl_resource *buffer) = 0;
+ virtual void updateTextureForBuffer(struct ::wl_resource *buffer) { Q_UNUSED(buffer); }
+
virtual bool isYInverted(struct ::wl_resource *) const { return true; }
virtual void *lockNativeBuffer(struct ::wl_resource *) const { return 0; }