From 489fedaa320a4941a9fc6a17df1a791c93270bb8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 12 Mar 2019 13:46:21 +0100 Subject: Compositor: Call eglUnbindWaylandDisplayWL when destroying the compositor If unbind is not called, some drivers may try to do cleanup that depends on a valid wl_display in eglTerminate. Arguably, this could/should also have been fixed in the affected drivers. There is a display_destroy signal that the driver should listen to, to avoid using dangling wl_display and wl_global pointers. However, by using eglUnbindWaylandDisplayWL we can force the cleanup to happen before wl_display_destroy. Which is what this patch does. Change-Id: Id9062de896b723838bcecac3902031e6b172a6de Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- src/compositor/compositor_api/qwaylandcompositor.cpp | 3 +++ .../compositor/wayland-egl/waylandeglclientbufferintegration.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 173b50ce0..a0d69c52e 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -243,6 +243,9 @@ QWaylandCompositorPrivate::~QWaylandCompositorPrivate() delete data_device_manager; #endif + // Some client buffer integrations need to clean up before the destroying the wl_display + client_buffer_integration.reset(); + wl_display_destroy(display); } diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 2cadf8503..88dab2ab2 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -186,6 +186,7 @@ public: EGLDisplay egl_display = EGL_NO_DISPLAY; bool valid = false; bool display_bound = false; + ::wl_display *wlDisplay = nullptr; QOffscreenSurface *offscreenSurface = nullptr; QOpenGLContext *localContext = nullptr; QVector orphanedTextures; @@ -394,6 +395,12 @@ WaylandEglClientBufferIntegration::WaylandEglClientBufferIntegration() WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration() { WaylandEglClientBufferIntegrationPrivate::shuttingDown = true; + Q_D(WaylandEglClientBufferIntegration); + if (d->egl_unbind_wayland_display && d->display_bound) { + Q_ASSERT(d->wlDisplay); + if (!d->egl_unbind_wayland_display(d->egl_display, d->wlDisplay)) + qWarning() << "Qt Wayland Compositor: eglUnbindWaylandDisplayWL failed"; + } } void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *display) @@ -450,6 +457,7 @@ void WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di qWarning("QtCompositor: Could not bind Wayland display. Ignoring."); } } + d->wlDisplay = display; } d->funcs = new QEGLStreamConvenience; -- cgit v1.2.3 From 3200e86cefd9a83cea45c7cab589bfbf1ff63f4f Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 14 Mar 2019 09:37:41 +0100 Subject: Client: Fix incorrect damage region for window decorations The previous implementation had gaps in several places. [ChangeLog][QPA plugin] Fixed a bug where the window decoration's damaged area didn't cover the entire decoration. This meant some compositors would not redraw those areas. Change-Id: Ic72663dde301936635b2a1cfa90570a53227e8ea Fixes: QTBUG-74341 Reviewed-by: Paul Olav Tvete Reviewed-by: Pier Luigi Fiorini --- src/client/qwaylandabstractdecoration.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/qwaylandabstractdecoration.cpp b/src/client/qwaylandabstractdecoration.cpp index 6a8f1d92d..98a0b17d5 100644 --- a/src/client/qwaylandabstractdecoration.cpp +++ b/src/client/qwaylandabstractdecoration.cpp @@ -100,14 +100,19 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window) d->m_wayland_window = window; } -// \a size is without margins +// Creates regions like this on the outside of a rectangle with inner size \a size +// ----- +// | | +// ----- +// I.e. the top and bottom extends into the corners static QRegion marginsRegion(const QSize &size, const QMargins &margins) { QRegion r; - r += QRect(0, 0, size.width(), margins.top()); // top - r += QRect(0, size.height()+margins.top(), size.width(), margins.bottom()); //bottom - r += QRect(0, 0, margins.left(), size.height()); //left - r += QRect(size.width()+margins.left(), 0, margins.right(), size.height()); // right + const int widthWithMargins = margins.left() + size.width() + margins.right(); + r += QRect(0, 0, widthWithMargins, margins.top()); // top + r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom + r += QRect(0, margins.top(), margins.left(), size.height()); //left + r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right return r; } -- cgit v1.2.3