From 10fd51a3e69a0a2ee6b8cd151fa6c847f684253c Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Thu, 3 Sep 2015 11:14:18 +0200 Subject: Fix deadlock when hiding and showing EGL windows When hiding a window we attach a NULL buffer, which means that any frame callback that is still waiting will not be sent. In the SHM case we just destroy it, but we cannot do that in the EGL case, since we don't have a hold of it. So destroy the EGLSurface, which will in turn destroy the callback. Task-number: QTBUG-46921 Change-Id: I20e0d1ca7b53fb88096101d46979996dd944d429 Reviewed-by: Gunnar Sletta --- src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp | 7 +++++++ src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp index 2c3697bd8..efed808fb 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -149,6 +149,13 @@ QSurfaceFormat QWaylandEglWindow::format() const return m_format; } +void QWaylandEglWindow::setVisible(bool visible) +{ + QWaylandWindow::setVisible(visible); + if (!visible) + invalidateSurface(); +} + void QWaylandEglWindow::invalidateSurface() { if (m_eglSurface) { diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h index 60722d168..c6bb43445 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h @@ -66,6 +66,7 @@ public: void bindContentFBO(); void invalidateSurface() Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; private: QWaylandEglClientBufferIntegration *m_clientBufferIntegration; -- cgit v1.2.3 From cf91dd10ff02916bace9281b0bfce02933e92814 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 25 Sep 2015 10:07:34 +0300 Subject: Fix a segfault when the wayland connection is broken When calling ::exit() the socket notifier in the events thread may still fire before the process actually exits, using objects that are being destroyed and resulting in a segfault. Stop the events thread before calling ::exit(). Change-Id: I187762da2a7efa83db1e62b0e28dfab89f478c7d Reviewed-by: Pier Luigi Fiorini --- src/client/qwaylanddisplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index f197b3788..0bea9af65 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -194,6 +194,8 @@ void QWaylandDisplay::blockingReadEvents() void QWaylandDisplay::exitWithError() { + mEventThread->quit(); + mEventThread->wait(); ::exit(1); } -- cgit v1.2.3 From 2336c5d726892d38592bc2d0c3f1a3c5a3640a0c Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Wed, 23 Sep 2015 17:19:17 +0200 Subject: QWaylandSurfaceItem: ungrab the pointer on TouchEnd event. The unconditional grab from 498946d6e9c20d4e8af28ee942de5bf4cf5eaf78 did not have a corresponding ungrab. That only worked well as long as there were only QWaylandSurfaceItems in the scene. Each of them just stole the grab for itself at the first TouchBegin. Regular QML items (some people have UI in the compositor process...) do not participate in that mutual stealing so they'd sometimes not get any touch events because the events still went to the last QWaylandSurfaceItem to receive a TouchBegin. Note: The grab would also go away if touchEvent() didn't accept() the event. Without the accept(), QQuickWindowPrivate::translateTouchToMouse() would be called at TouchEnd and do the ungrab. Change-Id: Ia7d1b15fff366542d382eb97494b1e43dedb65a4 Reviewed-by: Andrew den Exter Reviewed-by: Giulio Camuffo --- src/compositor/compositor_api/qwaylandsurfaceitem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 93cfaf008..fddf34f5e 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -250,6 +250,10 @@ void QWaylandSurfaceItem::touchEvent(QTouchEvent *event) inputDevice->setMouseFocus(this, pointPos, pointPos); } inputDevice->sendFullTouchEvent(event); + + const bool isEnd = event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchCancel; + if (isEnd && window()->mouseGrabberItem() == this) + ungrabMouse(); } else { event->ignore(); } -- cgit v1.2.3 From 5dd83e3e1af568d75318af4ae11783a8e9f2ccea Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Fri, 25 Sep 2015 14:20:29 +0300 Subject: QtCompositor: Work around driver issue on iMX6 devices Change-Id: I75eda7e766182025b54f8df851ff1d5a72eefb17 Reviewed-by: Laszlo Agocs --- .../wayland-egl/waylandeglclientbufferintegration.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 85215f14b..2d5a182c7 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -151,12 +151,6 @@ void WaylandEglClientBufferIntegration::initializeHardware(QtWayland::Display *w return; } - d->gl_egl_image_target_texture_2d = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); - if (!d->gl_egl_image_target_texture_2d) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not find glEGLImageTargetTexture2DOES."); - return; - } - if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) { d->display_bound = d->egl_bind_wayland_display(d->egl_display, waylandDisplay->handle()); if (!d->display_bound) { @@ -175,11 +169,22 @@ void WaylandEglClientBufferIntegration::initializeHardware(QtWayland::Display *w void WaylandEglClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource *buffer) { Q_D(WaylandEglClientBufferIntegration); + if (!d->valid) { qWarning("QtCompositor: bindTextureToBuffer() failed"); return; } + // Vivante drivers on the iMX6 don't resolve this function early enough for us, they seem to require the EGL/GLES setup to be further + // along than they are in initializeHardware(), so do the lookup here instead. + if (!d->gl_egl_image_target_texture_2d) + d->gl_egl_image_target_texture_2d = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); + + if (!d->gl_egl_image_target_texture_2d) { + qWarning("QtCompositor: bindTextureToBuffer() failed. Could not find glEGLImageTargetTexture2DOES."); + return; + } + EGLImageKHR image = d->egl_create_image(d->egl_display, EGL_NO_CONTEXT, EGL_WAYLAND_BUFFER_WL, buffer, NULL); -- cgit v1.2.3 From 9d408649458a274864ae2e7c2d67b4fa3cabbfcd Mon Sep 17 00:00:00 2001 From: Julien Brianceau Date: Wed, 22 Jul 2015 12:33:58 +0200 Subject: Remove scoped enums to fix builds without C++11 support. Change-Id: I4f83fdb59a60bb1f1720047f0b442d70192be5da Reviewed-by: Laszlo Agocs --- src/compositor/compositor_api/qwaylandsurface.cpp | 2 +- src/compositor/compositor_api/qwaylandsurfaceinterface.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index e5ecb15b4..bae6468ca 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -71,7 +71,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate(wl_client *wlClient, quint32 id, , closing(false) , refCount(1) , client(QWaylandClient::fromWlClient(wlClient)) - , windowType(QWaylandSurface::WindowType::None) + , windowType(QWaylandSurface::None) {} diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp index 355777377..cddd231dd 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp @@ -110,7 +110,7 @@ int QWaylandSurfaceOp::type() const QWaylandSurfaceSetVisibilityOp::QWaylandSurfaceSetVisibilityOp(QWindow::Visibility visibility) - : QWaylandSurfaceOp(Type::SetVisibility) + : QWaylandSurfaceOp(QWaylandSurfaceOp::SetVisibility) , m_visibility(visibility) { } @@ -121,7 +121,7 @@ QWindow::Visibility QWaylandSurfaceSetVisibilityOp::visibility() const } QWaylandSurfaceResizeOp::QWaylandSurfaceResizeOp(const QSize &size) - : QWaylandSurfaceOp(Type::Resize) + : QWaylandSurfaceOp(QWaylandSurfaceOp::Resize) , m_size(size) { } @@ -132,7 +132,7 @@ QSize QWaylandSurfaceResizeOp::size() const } QWaylandSurfacePingOp::QWaylandSurfacePingOp(uint32_t serial) - : QWaylandSurfaceOp(Type::Ping) + : QWaylandSurfaceOp(QWaylandSurfaceOp::Ping) , m_serial(serial) { } -- cgit v1.2.3