diff --git a/0002-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch b/0002-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch new file mode 100644 index 0000000..9b30b8c --- /dev/null +++ b/0002-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch @@ -0,0 +1,38 @@ +From a825fb5f714fd79d16cc3ebbdd327e7961b07d0a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= +Date: Mon, 16 Nov 2020 19:37:33 +0100 +Subject: [PATCH 2/7] Make setting QT_SCALE_FACTOR work on Wayland + +Follow-up to 8cb1b07aea12d50b4fecc45c903705dfd368022a, +fixes one additional case (Use of minimum/maximum size). + +Fixes: QTBUG-87762 +Change-Id: I73e0df2529b0cadf25ad50ea7459cdbb92caf424 +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit 6ed363e3665f17d935f8636d9c958154c898f5c5) +Reviewed-by: Qt Cherry-pick Bot +--- + src/client/qwaylandwindow.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index bc031ed5..eb053406 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -332,9 +332,11 @@ void QWaylandWindow::setWindowIcon(const QIcon &icon) + + void QWaylandWindow::setGeometry_helper(const QRect &rect) + { ++ QSize minimum = windowMinimumSize(); ++ QSize maximum = windowMaximumSize(); + QPlatformWindow::setGeometry(QRect(rect.x(), rect.y(), +- qBound(window()->minimumWidth(), rect.width(), window()->maximumWidth()), +- qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight()))); ++ qBound(minimum.width(), rect.width(), maximum.width()), ++ qBound(minimum.height(), rect.height(), maximum.height()))); + + if (mSubSurfaceWindow) { + QMargins m = QPlatformWindow::parent()->frameMargins(); +-- +2.25.1 + diff --git a/0003-Do-not-try-to-eglMakeCurrent-for-unintended-case.patch b/0003-Do-not-try-to-eglMakeCurrent-for-unintended-case.patch new file mode 100644 index 0000000..5ccca8d --- /dev/null +++ b/0003-Do-not-try-to-eglMakeCurrent-for-unintended-case.patch @@ -0,0 +1,62 @@ +From 2c0a03e9aea13831d05ac03996949f888afd5085 Mon Sep 17 00:00:00 2001 +From: Jaehak Lee +Date: Sun, 8 Nov 2020 11:40:06 +0900 +Subject: [PATCH 3/7] Do not try to eglMakeCurrent for unintended case + +The QSGThreadedRenderLoop::hide can be called at twice, +when the QWindowPrivate::setVisible(false) is called. + +The eglSurface is EGL_NO_SURFACE when the second QSGThreadedRenderLoop::hide is +called. And if EGL_KHR_surfaceless_context is supported, the eglMakeCurrent +don't return the false. + +But this case is not intended. So, add the defence code for above case. + +Fixes: QTBUG-88277 +Change-Id: Ia9e5990303e98f0eedc48531e5af62ff9961f419 +Reviewed-by: Laszlo Agocs +Reviewed-by: Eskil Abrahamsen Blomfeldt +--- + .../client/wayland-egl/qwaylandglcontext.cpp | 6 ++++++ + .../client/wayland-egl/qwaylandglcontext.h | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +index ccebf43d..681f82f4 100644 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +@@ -336,6 +336,8 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis + << "It may also cause the event loop to freeze in some situations"; + } + ++ m_supportSurfaceLessContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"); ++ + updateGLFormat(); + } + +@@ -439,6 +441,10 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) + eglSurface = window->eglSurface(); + } + ++ if (eglSurface == EGL_NO_SURFACE && m_supportSurfaceLessContext) { ++ return false; ++ } ++ + if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) { + qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this); + window->setCanResize(true); +diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h +index 46c7bb76..93edaec0 100644 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h +@@ -93,6 +93,7 @@ private: + DecorationsBlitter *m_blitter = nullptr; + uint m_api; + bool m_supportNonBlockingSwap = true; ++ bool m_supportSurfaceLessContext = false; + }; + + } +-- +2.25.1 + diff --git a/0004-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch b/0004-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch new file mode 100644 index 0000000..2f38d41 --- /dev/null +++ b/0004-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch @@ -0,0 +1,112 @@ +From 10005185e06857ce119c50fe710f9eedde06ec5e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= +Date: Fri, 13 Nov 2020 11:21:50 +0100 +Subject: [PATCH 4/7] Make setting QT_SCALE_FACTOR work on Wayland + +QWindow geometry accessors return geometry in device +independent pixels. Normally this coordinate system +is equivalent to the Wayland native coordinate system, +but this is not the case when QT_SCALE_FACTOR is set. + +Replace QWindow geometry calls with the helpers from +QPlatformWindow which return geometry in the native +coordinate system: + +QWindow::geometry() -> QPlatformWindow::windowGeometry() +QWindow::frameGeometry() -> QPlatformWindow::windowFrameGeometry() + +Task-number: QTBUG-87762 +Fixes: QTBUG-88064 +(cherry-picked from commit 8cb1b07aea12d50b4fecc45c903705dfd368022a) +Change-Id: I6e2029bc6210f12441ae7c9d8b678271e9922dde +Reviewed-by: Eskil Abrahamsen Blomfeldt +--- + src/client/qwaylandwindow.cpp | 7 ++++--- + .../shellintegration/wl-shell/qwaylandwlshellsurface.cpp | 2 +- + .../shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp | 2 +- + .../shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp | 2 +- + .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 2 +- + 5 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index eb053406..9b343702 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -194,10 +194,11 @@ void QWaylandWindow::initWindow() + if (QScreen *s = window()->screen()) + setOrientationMask(s->orientationUpdateMask()); + setWindowFlags(window()->flags()); +- if (window()->geometry().isEmpty()) ++ QRect geometry = windowGeometry(); ++ if (geometry.isEmpty()) + setGeometry_helper(QRect(QPoint(), QSize(500,500))); + else +- setGeometry_helper(window()->geometry()); ++ setGeometry_helper(geometry); + setMask(window()->mask()); + if (mShellSurface) + mShellSurface->requestWindowStates(window()->windowStates()); +@@ -431,7 +432,7 @@ void QWaylandWindow::setVisible(bool visible) + initWindow(); + mDisplay->flushRequests(); + +- setGeometry(window()->geometry()); ++ setGeometry(windowGeometry()); + // Don't flush the events here, or else the newly visible window may start drawing, but since + // there was no frame before it will be stuck at the waitForFrameSync() in + // QWaylandShmBackingStore::beginPaint(). +diff --git a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +index 245fec19..8f41118d 100644 +--- a/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp ++++ b/src/plugins/shellintegration/wl-shell/qwaylandwlshellsurface.cpp +@@ -134,7 +134,7 @@ void QWaylandWlShellSurface::applyConfigure() + { + if ((m_pending.states & (Qt::WindowMaximized|Qt::WindowFullScreen)) + && !(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) { +- m_normalSize = m_window->window()->frameGeometry().size(); ++ m_normalSize = m_window->windowFrameGeometry().size(); + } + + if (m_pending.states != m_applied.states) +diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +index 770fad7e..73aba1ee 100644 +--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp ++++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgsurfacev5.cpp +@@ -157,7 +157,7 @@ void QWaylandXdgSurfaceV5::applyConfigure() + if (m_pending.isResizing) + m_normalSize = m_pending.size; + else if (!(m_acked.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) +- m_normalSize = m_window->window()->frameGeometry().size(); ++ m_normalSize = m_window->windowFrameGeometry().size(); + + if ((m_pending.states & Qt::WindowActive) && !(m_acked.states & Qt::WindowActive)) + m_window->display()->handleWindowActivated(m_window); +diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +index c137b308..8c371661 100644 +--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp ++++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +@@ -72,7 +72,7 @@ QWaylandXdgSurfaceV6::Toplevel::~Toplevel() + void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() + { + if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) +- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); ++ m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); + + if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); +diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +index b6d23ac1..1c762944 100644 +--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp ++++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +@@ -83,7 +83,7 @@ QWaylandXdgSurface::Toplevel::~Toplevel() + void QWaylandXdgSurface::Toplevel::applyConfigure() + { + if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen))) +- m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size(); ++ m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size(); + + if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)) + m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window); +-- +2.25.1 + diff --git a/0005-Ensure-that-grabbing-is-performed-in-correct-context.patch b/0005-Ensure-that-grabbing-is-performed-in-correct-context.patch new file mode 100644 index 0000000..4049ee8 --- /dev/null +++ b/0005-Ensure-that-grabbing-is-performed-in-correct-context.patch @@ -0,0 +1,35 @@ +From dba4bc4f1d6dfee9fe9433c55b15653d703bed4f Mon Sep 17 00:00:00 2001 +From: Andreas Cord-Landwehr +Date: Wed, 2 Dec 2020 20:55:52 +0100 +Subject: [PATCH 5/7] Ensure that grabbing is performed in correct context + +For multi-display rendering on EGL, it is mandatory that the grabbing of +the surface happens in the same EGL context as the surface belongs to. +By adding the grabbing to the rendering stage of the image, this +relation is forced. + +Task-number: QTBUG-87597 +Change-Id: I50f40df1215aa771d714065e942c5a738ba6269f +Reviewed-by: Eskil Abrahamsen Blomfeldt +(cherry picked from commit ab3a1a07f3d1e0d5a9e9d97b6b3b587180e2f4c8) +Reviewed-by: Qt Cherry-pick Bot +--- + src/compositor/compositor_api/qwaylandquickcompositor.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp +index 49f0860e..db1cf00f 100644 +--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp ++++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp +@@ -161,7 +161,7 @@ void QWaylandQuickCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const + GrabState *state = new GrabState; + state->grabber = grabber; + state->buffer = buffer; +- static_cast(output->window())->scheduleRenderJob(state, QQuickWindow::NoStage); ++ static_cast(output->window())->scheduleRenderJob(state, QQuickWindow::AfterRenderingStage); + #else + emit grabber->failed(QWaylandSurfaceGrabber::UnknownBufferType); + #endif +-- +2.25.1 + diff --git a/0006-Fix-leaked-subsurface-wayland-items.patch b/0006-Fix-leaked-subsurface-wayland-items.patch new file mode 100644 index 0000000..67b7d0e --- /dev/null +++ b/0006-Fix-leaked-subsurface-wayland-items.patch @@ -0,0 +1,36 @@ +From a8d35b3c18bdb05a0da3ed50a554a7b7bd4ebed3 Mon Sep 17 00:00:00 2001 +From: Eskil Abrahamsen Blomfeldt +Date: Mon, 30 Nov 2020 13:13:18 +0100 +Subject: [PATCH 6/7] Fix leaked subsurface wayland items + +Whenever a subsurface was added we would create a QWaylandQuickItem, +but this was never deleted. It is one-to-one with the surface, so it +should be deleted at the same time. + +[ChangeLog][QtWaylandCompositor] Fixed a memory leak when creating +subsurfaces. + +Task-number: QTBUG-88782 +Change-Id: If4b3f15200ce3bd123ff73847d3593d174a39229 +Reviewed-by: Paul Olav Tvete +(cherry picked from commit 38fc568b30bf916165324c2cd2db127d2a9aa68c) +Reviewed-by: Qt Cherry-pick Bot +--- + src/compositor/compositor_api/qwaylandquickitem.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp +index 15f0195c..2218f43a 100644 +--- a/src/compositor/compositor_api/qwaylandquickitem.cpp ++++ b/src/compositor/compositor_api/qwaylandquickitem.cpp +@@ -737,6 +737,7 @@ void QWaylandQuickItem::handleSubsurfaceAdded(QWaylandSurface *childSurface) + childItem->setVisible(true); + childItem->setParentItem(this); + connect(childSurface, &QWaylandSurface::subsurfacePositionChanged, childItem, &QWaylandQuickItem::handleSubsurfacePosition); ++ connect(childSurface, &QWaylandSurface::destroyed, childItem, &QObject::deleteLater); + } else { + bool success = QMetaObject::invokeMethod(d->subsurfaceHandler, "handleSubsurfaceAdded", Q_ARG(QWaylandSurface *, childSurface)); + if (!success) +-- +2.25.1 + diff --git a/0007-Use-qWarning-and-_exit-instead-of-qFatal-for-wayland.patch b/0007-Use-qWarning-and-_exit-instead-of-qFatal-for-wayland.patch new file mode 100644 index 0000000..d773d60 --- /dev/null +++ b/0007-Use-qWarning-and-_exit-instead-of-qFatal-for-wayland.patch @@ -0,0 +1,38 @@ +From 9ee2ea141adc7765f6c212e63839ef23a4494b30 Mon Sep 17 00:00:00 2001 +From: Weng Xuetian +Date: Tue, 9 Mar 2021 10:43:59 -0800 +Subject: [PATCH 7/7] Use qWarning and _exit() instead of qFatal for wayland + error + +This type of error is likely to happen upon system logout. qFatal would +trigger sigabrt and leave unnecessary coredump on the system. Using +qWarning here would make it consistent with xcb's io error. + +Pick-to: 5.15 6.0 6.1 +Change-Id: I571ba007bf2453486b81837cccdbefa5f181b63d +Reviewed-by: David Edmundson +--- + src/client/qwaylanddisplay.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp +index fe094f6f..f10c1f79 100644 +--- a/src/client/qwaylanddisplay.cpp ++++ b/src/client/qwaylanddisplay.cpp +@@ -206,10 +206,11 @@ void QWaylandDisplay::checkError() const + int ecode = wl_display_get_error(mDisplay); + if ((ecode == EPIPE || ecode == ECONNRESET)) { + // special case this to provide a nicer error +- qFatal("The Wayland connection broke. Did the Wayland compositor die?"); ++ qWarning("The Wayland connection broke. Did the Wayland compositor die?"); + } else { +- qFatal("The Wayland connection experienced a fatal error: %s", strerror(ecode)); ++ qWarning("The Wayland connection experienced a fatal error: %s", strerror(ecode)); + } ++ _exit(1); + } + + void QWaylandDisplay::flushRequests() +-- +2.25.1 + diff --git a/libqt5-qtwayland.changes b/libqt5-qtwayland.changes index 12baaac..2cbec04 100644 --- a/libqt5-qtwayland.changes +++ b/libqt5-qtwayland.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Wed Apr 7 06:55:22 UTC 2021 - Fabian Vogt + +- Add commits from upstream's 5.15 branch: + * 0002-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch (QTBUG-87762) + * 0003-Do-not-try-to-eglMakeCurrent-for-unintended-case.patch (QTBUG-88277) + * 0004-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch (QTBUG-87762, QTBUG-88064) + * 0005-Ensure-that-grabbing-is-performed-in-correct-context.patch (QTBUG-87597) + * 0006-Fix-leaked-subsurface-wayland-items.patch (QTBUG-88782) +- Add commit from KDE's 5.15 branch: + * 0007-Use-qWarning-and-_exit-instead-of-qFatal-for-wayland.patch + ------------------------------------------------------------------- Sat Jan 16 16:25:39 UTC 2021 - Fabian Vogt diff --git a/libqt5-qtwayland.spec b/libqt5-qtwayland.spec index 353bb04..8e30002 100644 --- a/libqt5-qtwayland.spec +++ b/libqt5-qtwayland.spec @@ -36,7 +36,13 @@ URL: https://www.qt.io Source: https://download.qt.io/official_releases/qt/5.15/%{real_version}/submodules/%{tar_version}.tar.xz Source1: baselibs.conf # PATCH-FIX-UPSTREAM -Patch0: 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch +Patch1: 0001-Scanner-Avoid-accessing-dangling-pointers-in-destroy.patch +Patch2: 0002-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch +Patch3: 0003-Do-not-try-to-eglMakeCurrent-for-unintended-case.patch +Patch4: 0004-Make-setting-QT_SCALE_FACTOR-work-on-Wayland.patch +Patch5: 0005-Ensure-that-grabbing-is-performed-in-correct-context.patch +Patch6: 0006-Fix-leaked-subsurface-wayland-items.patch +Patch7: 0007-Use-qWarning-and-_exit-instead-of-qFatal-for-wayland.patch BuildRequires: fdupes BuildRequires: libqt5-qtbase-private-headers-devel >= %{version} BuildRequires: libqt5-qtdeclarative-private-headers-devel >= %{version}