From dac4fcd9b03e2f4ac5e07cf36fcdd06951ab955e Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 28 Nov 2014 11:41:36 +0100 Subject: Fix build without OpenGL Also fix a comment alongside. Change-Id: I0091a89ff8e7ed46e769ea47a0225bc87db2c1f5 Reviewed-by: Laszlo Agocs Reviewed-by: Giulio Camuffo --- src/compositor/wayland_wrapper/qwlcompositor.cpp | 8 +++++++- src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/compositor') diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp index 2fd91f30d..f057542ca 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor.cpp +++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp @@ -89,9 +89,11 @@ #include +#if defined (QT_COMPOSITOR_WAYLAND_GL) #include "hardware_integration/qwlhwintegration_p.h" #include "hardware_integration/qwlclientbufferintegration_p.h" #include "hardware_integration/qwlserverbufferintegration_p.h" +#endif #include "windowmanagerprotocol/waylandwindowmanagerintegration_p.h" #include "hardware_integration/qwlclientbufferintegrationfactory_p.h" @@ -470,6 +472,7 @@ void Compositor::bindGlobal(wl_client *client, void *data, uint32_t version, uin void Compositor::loadClientBufferIntegration() { +#ifdef QT_COMPOSITOR_WAYLAND_GL QStringList keys = ClientBufferIntegrationFactory::keys(); QString targetKey; QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION"); @@ -491,11 +494,13 @@ void Compositor::loadClientBufferIntegration() m_hw_integration->setClientBufferIntegration(targetKey); } } - //BUG: if there is no client buffer integration, bad things will when opengl is used + //BUG: if there is no client buffer integration, bad things will happen when opengl is used +#endif } void Compositor::loadServerBufferIntegration() { +#ifdef QT_COMPOSITOR_WAYLAND_GL QStringList keys = ServerBufferIntegrationFactory::keys(); QString targetKey; QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); @@ -507,6 +512,7 @@ void Compositor::loadServerBufferIntegration() if (m_hw_integration) m_hw_integration->setServerBufferIntegration(targetKey); } +#endif } void Compositor::registerInputDevice(QWaylandInputDevice *device) diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h index 8e07068bc..580e71d0b 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h @@ -95,7 +95,12 @@ public: bool isDestroyed() { return m_destroyed; } void createTexture(); +#ifdef QT_COMPOSITOR_WAYLAND_GL inline GLuint texture() const; +#else + inline uint texture() const; +#endif + void destroyTexture(); inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; } @@ -150,12 +155,19 @@ private: friend class ::QWaylandBufferRef; }; +#ifdef QT_COMPOSITOR_WAYLAND_GL GLuint SurfaceBuffer::texture() const { if (m_buffer) return m_texture; return 0; } +#else +uint SurfaceBuffer::texture() const +{ + return 0; +} +#endif } -- cgit v1.2.3 From 3fce7d79108fef745cad6232417eff7db15f98e3 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 4 May 2015 20:55:20 +0200 Subject: Fix QWaylandDrag leak in the compositor Make it a scoped pointer. Change-Id: Iaeef87cad2022496ebe3a7c746b02584fac9a485 Reviewed-by: Laszlo Agocs --- src/compositor/wayland_wrapper/qwlinputdevice.cpp | 2 +- src/compositor/wayland_wrapper/qwlinputdevice_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/compositor') diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp index cb27ab4e4..ea127ee74 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp +++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp @@ -352,7 +352,7 @@ QWaylandInputDevice *InputDevice::handle() const QWaylandDrag *InputDevice::dragHandle() const { - return m_dragHandle; + return m_dragHandle.data(); } const DataDevice *InputDevice::dataDevice() const diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h index 785c6d7e9..8444eaa50 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h +++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h @@ -128,7 +128,7 @@ public: private: QWaylandInputDevice *m_handle; - QWaylandDrag *m_dragHandle; + QScopedPointer m_dragHandle; Compositor *m_compositor; QWaylandInputDevice::CapabilityFlags m_capabilities; -- cgit v1.2.3 From e2bf8512c2363bb9f41d9357d4bf283ee5d58361 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 4 May 2015 17:30:31 +0200 Subject: Fix private object leak in surface op/interface classes Change-Id: I7ad508cb07a73d6699e9d2742ea029409f498a87 Reviewed-by: Giulio Camuffo --- src/compositor/compositor_api/qwaylandsurfaceinterface.cpp | 6 ++++++ src/compositor/compositor_api/qwaylandsurfaceinterface.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/compositor') diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp index 9fc7fd6ab..355777377 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp @@ -60,6 +60,7 @@ QWaylandSurfaceInterface::QWaylandSurfaceInterface(QWaylandSurface *surface) QWaylandSurfaceInterface::~QWaylandSurfaceInterface() { d->surface->removeInterface(this); + delete d; } QWaylandSurface *QWaylandSurfaceInterface::surface() const @@ -96,6 +97,11 @@ QWaylandSurfaceOp::QWaylandSurfaceOp(int t) d->type = t; } +QWaylandSurfaceOp::~QWaylandSurfaceOp() +{ + delete d; +} + int QWaylandSurfaceOp::type() const { return d->type; diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.h b/src/compositor/compositor_api/qwaylandsurfaceinterface.h index 60d8ae5fa..322037e6d 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.h +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.h @@ -62,6 +62,8 @@ public: }; QWaylandSurfaceOp(int t); + virtual ~QWaylandSurfaceOp(); + int type() const; private: -- cgit v1.2.3 From d00f517237775546c9a9e3ad49e972a37486514b Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 4 May 2015 20:54:58 +0200 Subject: Fix xkb keymap string leak in the compositor Change-Id: Ie02e6667e5867b729cf5a519705ded4f79b9f4b1 Reviewed-by: Laszlo Agocs --- src/compositor/wayland_wrapper/qwlkeyboard.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/compositor') diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp index a7889fd40..d80c4b1f3 100644 --- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp +++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp @@ -368,6 +368,7 @@ void Keyboard::createXKBKeymap() } strcpy(m_keymap_area, keymap_str); + free(keymap_str); m_state = xkb_state_new(keymap); -- cgit v1.2.3 From 05ea6b992f32443df27e38bdc8b21cf970755b57 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 25 Jun 2015 12:33:41 +0000 Subject: Prevent QWaylandQuickSurface from holding onto multiple buffers indefinitely. With a queue of just two buffers BufferAttacher can end up holding references to both after the renderer is stopped starving the client application and causing it to block in the glSwapBuffers until the renderer restarts or the surface is destroyed. Release the current buffer to the client when the renderer is stopped so it can continue. Change-Id: Ica0e13ef78f7e6058e273c26b517a88d07f958c7 Reviewed-by: Giulio Camuffo --- src/compositor/compositor_api/qwaylandquicksurface.cpp | 14 ++++++++++++-- src/compositor/compositor_api/qwaylandsurfaceitem.cpp | 7 ++++++- src/compositor/compositor_api/qwaylandsurfaceitem.h | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/compositor') diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index 44e0edf5d..ef78c8849 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -103,9 +103,12 @@ public: void invalidateTexture() { + if (bufferRef) + bufferRef.destroyTexture(); delete texture; texture = 0; update = true; + bufferRef = QWaylandBufferRef(); } QWaylandQuickSurface *surface; @@ -209,6 +212,8 @@ bool QWaylandQuickSurface::event(QEvent *e) this, &QWaylandQuickSurface::updateTexture); disconnect(oldWindow, &QQuickWindow::sceneGraphInvalidated, this, &QWaylandQuickSurface::invalidateTexture); + disconnect(oldWindow, &QQuickWindow::sceneGraphAboutToStop, + this, &QWaylandQuickSurface::invalidateTexture); } return true; @@ -225,6 +230,9 @@ bool QWaylandQuickSurface::event(QEvent *e) connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QWaylandQuickSurface::invalidateTexture, Qt::DirectConnection); + connect(window, &QQuickWindow::sceneGraphAboutToStop, + this, &QWaylandQuickSurface::invalidateTexture, + Qt::DirectConnection); } return true; @@ -236,10 +244,11 @@ bool QWaylandQuickSurface::event(QEvent *e) void QWaylandQuickSurface::updateTexture() { Q_D(QWaylandQuickSurface); + const bool update = d->buffer->update; if (d->buffer->update) d->buffer->createTexture(); foreach (QWaylandSurfaceView *view, views()) - static_cast(view)->updateTexture(); + static_cast(view)->updateTexture(update); } void QWaylandQuickSurface::invalidateTexture() @@ -247,7 +256,8 @@ void QWaylandQuickSurface::invalidateTexture() Q_D(QWaylandQuickSurface); d->buffer->invalidateTexture(); foreach (QWaylandSurfaceView *view, views()) - static_cast(view)->updateTexture(); + static_cast(view)->updateTexture(true); + emit redraw(); } bool QWaylandQuickSurface::clientRenderingEnabled() const diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 90a68c4f9..93cfaf008 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -355,6 +355,11 @@ void QWaylandSurfaceItem::updateBuffer(bool hasBuffer) } void QWaylandSurfaceItem::updateTexture() +{ + updateTexture(false); +} + +void QWaylandSurfaceItem::updateTexture(bool changed) { if (!m_provider) m_provider = new QWaylandSurfaceTextureProvider(); @@ -363,7 +368,7 @@ void QWaylandSurfaceItem::updateTexture() if (mapped) m_provider->t = static_cast(surface())->texture(); m_provider->smooth = smooth(); - if (m_newTexture) + if (m_newTexture || changed) emit m_provider->textureChanged(); m_newTexture = false; } diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h index 91dc6879b..cb51b6bfb 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.h +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h @@ -125,7 +125,9 @@ protected: private: friend class QWaylandSurfaceNode; + friend class QWaylandQuickSurface; void init(QWaylandQuickSurface *); + void updateTexture(bool changed); static QMutex *mutex; -- cgit v1.2.3