Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-qt/qtwayland/files/, dev-qt/qtwayland/
Date: Wed, 07 Feb 2018 14:17:40
Message-Id: 1518013038.4421b5d072f2f5d4a7694a0e40306e198927ec34.asturm@gentoo
1 commit: 4421b5d072f2f5d4a7694a0e40306e198927ec34
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 7 11:28:34 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 7 14:17:18 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4421b5d0
7
8 dev-qt/qtwayland: Don't recreate hidden egl surfaces
9
10 Fixing a runtime crash that affects many users.
11 Patch taken from 5.9 branch (fixed in 5.9.5).
12
13 KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=381630
14 Qt-Bug: https://bugreports.qt.io/browse/QTBUG-65553
15 See also: https://codereview.qt-project.org/#/c/210552/
16 Tested-by: Andrius Štikonas <andrius <AT> stikonas.eu>
17
18 Package-Manager: Portage-2.3.24, Repoman-2.3.6
19
20 .../files/qtwayland-5.9.4-qquickwindow-crash.patch | 109 +++++++++++++++++++++
21 dev-qt/qtwayland/qtwayland-5.9.4-r1.ebuild | 41 ++++++++
22 2 files changed, 150 insertions(+)
23
24 diff --git a/dev-qt/qtwayland/files/qtwayland-5.9.4-qquickwindow-crash.patch b/dev-qt/qtwayland/files/qtwayland-5.9.4-qquickwindow-crash.patch
25 new file mode 100644
26 index 00000000000..40f2a6dff4e
27 --- /dev/null
28 +++ b/dev-qt/qtwayland/files/qtwayland-5.9.4-qquickwindow-crash.patch
29 @@ -0,0 +1,109 @@
30 +From bf09c7a1493c01a65ee0f110b37a04e653edc08e Mon Sep 17 00:00:00 2001
31 +From: David Edmundson <davidedmundson@×××.org>
32 +Date: Wed, 3 Jan 2018 19:18:42 +0000
33 +Subject: [PATCH] Don't recreate hidden egl surfaces
34 +
35 +QWaylandEglWindow deletes surfaces when a window changes from hidden to
36 +visible, presumably as a result of us not having a valid wl_surface
37 +object. By extension it doesn't make sense to create a surface whilst a
38 +window is still hidden.
39 +
40 +This fixes a crash where a QQuickWindow hides and then is destroyed. In
41 +QQuickWindow destruction we have to create a valid context in order to
42 +delete any textures/assets owned by the scene graph; as the wl_surface
43 +has gone this causes an error in the EGL libs when we create an EGL
44 +surface.
45 +
46 +Task-number: QTBUG-65553
47 +Change-Id: I9b37a86326bf2cd7737c4e839c1aa8c74cf08116
48 +Reviewed-by: Johan Helsing <johan.helsing@××.io>
49 +---
50 + .../client/wayland-egl/qwaylandglcontext.cpp | 2 +-
51 + tests/auto/client/client/tst_client.cpp | 37 ++++++++++++++++++++++
52 + 2 files changed, 38 insertions(+), 1 deletion(-)
53 +
54 +diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
55 +index 2a9e39e..f4dd6f4 100644
56 +--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
57 ++++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
58 +@@ -407,7 +407,7 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
59 + window->createDecoration();
60 +
61 + if (eglSurface == EGL_NO_SURFACE) {
62 +- window->updateSurface(true);
63 ++ window->updateSurface(window->isExposed());
64 + eglSurface = window->eglSurface();
65 + }
66 +
67 +diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp
68 +index 3897bd3..aed601d 100644
69 +--- a/tests/auto/client/client/tst_client.cpp
70 ++++ b/tests/auto/client/client/tst_client.cpp
71 +@@ -35,6 +35,8 @@
72 + #include <QMimeData>
73 + #include <QPixmap>
74 + #include <QDrag>
75 ++#include <QWindow>
76 ++#include <QOpenGLWindow>
77 +
78 + #include <QtTest/QtTest>
79 + #include <QtWaylandClient/private/qwaylandintegration_p.h>
80 +@@ -112,6 +114,25 @@ public:
81 + QPoint mousePressPos;
82 + };
83 +
84 ++class TestGlWindow : public QOpenGLWindow
85 ++{
86 ++ Q_OBJECT
87 ++
88 ++public:
89 ++ TestGlWindow();
90 ++
91 ++protected:
92 ++ void paintGL() override;
93 ++};
94 ++
95 ++TestGlWindow::TestGlWindow()
96 ++{}
97 ++
98 ++void TestGlWindow::paintGL()
99 ++{
100 ++ glClear(GL_COLOR_BUFFER_BIT);
101 ++}
102 ++
103 + class tst_WaylandClient : public QObject
104 + {
105 + Q_OBJECT
106 +@@ -149,6 +170,7 @@ private slots:
107 + void dontCrashOnMultipleCommits();
108 + void hiddenTransientParent();
109 + void hiddenPopupParent();
110 ++ void glWindow();
111 +
112 + private:
113 + MockCompositor *compositor;
114 +@@ -409,6 +431,21 @@ void tst_WaylandClient::hiddenPopupParent()
115 + QTRY_VERIFY(compositor->surface());
116 + }
117 +
118 ++void tst_WaylandClient::glWindow()
119 ++{
120 ++ QSKIP("Skipping GL tests, as not supported by all CI systems: See https://bugreports.qt.io/browse/QTBUG-65802");
121 ++
122 ++ QScopedPointer<TestGlWindow> testWindow(new TestGlWindow);
123 ++ testWindow->show();
124 ++ QSharedPointer<MockSurface> surface;
125 ++ QTRY_VERIFY(surface = compositor->surface());
126 ++
127 ++ //confirm we don't crash when we delete an already hidden GL window
128 ++ //QTBUG-65553
129 ++ testWindow->setVisible(false);
130 ++ QTRY_VERIFY(!compositor->surface());
131 ++}
132 ++
133 + int main(int argc, char **argv)
134 + {
135 + setenv("XDG_RUNTIME_DIR", ".", 1);
136 +--
137 +2.7.4
138 +
139
140 diff --git a/dev-qt/qtwayland/qtwayland-5.9.4-r1.ebuild b/dev-qt/qtwayland/qtwayland-5.9.4-r1.ebuild
141 new file mode 100644
142 index 00000000000..16a5d921047
143 --- /dev/null
144 +++ b/dev-qt/qtwayland/qtwayland-5.9.4-r1.ebuild
145 @@ -0,0 +1,41 @@
146 +# Copyright 1999-2018 Gentoo Foundation
147 +# Distributed under the terms of the GNU General Public License v2
148 +
149 +EAPI=6
150 +inherit qt5-build
151 +
152 +DESCRIPTION="Wayland platform plugin for Qt"
153 +
154 +if [[ ${QT5_BUILD_TYPE} == release ]]; then
155 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
156 +fi
157 +
158 +IUSE="+libinput xcomposite"
159 +
160 +DEPEND="
161 + >=dev-libs/wayland-1.6.0
162 + ~dev-qt/qtcore-${PV}
163 + ~dev-qt/qtdeclarative-${PV}
164 + ~dev-qt/qtgui-${PV}[egl,libinput?]
165 + media-libs/mesa[egl]
166 + >=x11-libs/libxkbcommon-0.2.0
167 + xcomposite? (
168 + x11-libs/libX11
169 + x11-libs/libXcomposite
170 + )
171 +"
172 +RDEPEND="${DEPEND}"
173 +
174 +PATCHES=( "${FILESDIR}/${P}-qquickwindow-crash.patch" ) # 5.9 branch
175 +
176 +src_prepare() {
177 + qt_use_disable_config libinput xkbcommon-evdev \
178 + src/client/client.pro \
179 + src/compositor/wayland_wrapper/wayland_wrapper.pri \
180 + src/plugins/shellintegration/ivi-shell/ivi-shell.pro \
181 + tests/auto/compositor/compositor/compositor.pro
182 +
183 + use xcomposite || rm -r config.tests/xcomposite || die
184 +
185 + qt5-build_src_prepare
186 +}