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/qtgui/files/, dev-qt/qtgui/
Date: Thu, 22 Feb 2018 20:09:26
Message-Id: 1519330122.037aded72a13031ce659eaaf6a40c43d2e5e3380.asturm@gentoo
1 commit: 037aded72a13031ce659eaaf6a40c43d2e5e3380
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 22 09:37:12 2018 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 22 20:08:42 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=037aded7
7
8 dev-qt/qtgui: Bail if cached shader fails to load
9
10 Qt-Bug: https://bugreports.qt.io/browse/QTBUG-66420
11 See also: https://codereview.qt-project.org/#/c/221098
12 Package-Manager: Portage-2.3.24, Repoman-2.3.6
13
14 dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch | 87 ++++++++++++++
15 dev-qt/qtgui/qtgui-5.9.4-r3.ebuild | 175 ++++++++++++++++++++++++++++
16 2 files changed, 262 insertions(+)
17
18 diff --git a/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch b/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch
19 new file mode 100644
20 index 00000000000..2a447414c21
21 --- /dev/null
22 +++ b/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch
23 @@ -0,0 +1,87 @@
24 +From b63aeba4a88088c7de61c1664a510c02d38ade84 Mon Sep 17 00:00:00 2001
25 +From: Antonio Larrosa <alarrosa@××××.com>
26 +Date: Fri, 16 Feb 2018 13:18:42 +0100
27 +Subject: [PATCH] opengl: Bail if cached shader fails to load
28 +
29 +QOpenGLProgramBinaryCache::setProgramBinary() should check
30 +GL_LINK_STATUS after glProgramBinary(), but doesn't.
31 +
32 +In practice, this means that SDDM is a white screen, and KDE is just
33 +a gray task bar.
34 +
35 +So far, Qt tries to check this using its internal ::link() function.
36 +But in case the cached binary fails to load, Qt currently attempts to
37 +link the inexistent program, resulting in a zero-length, fixed
38 +pipeline shader.
39 +
40 +Checking this already in ::setProgramBinary() makes the call to
41 +::link() superfluous, so we remove that as well.
42 +
43 +Done-with: Max Staudt <mstaudt@××××.com>
44 +Done-with: Michal Srb <msrb@××××.com>
45 +Done-with: Fabian Vogt <fvogt@××××.de>
46 +Task-number: QTBUG-66420
47 +Change-Id: Iabb51d0eb2c0c16bde696efff623e57d15f28d82
48 +Reviewed-by: Jesus Fernandez <Jesus.Fernandez@××.io>
49 +Reviewed-by: Laszlo Agocs <laszlo.agocs@××.io>
50 +(cherry picked from commit fa091640134b3ff99a9eb92df8286d15203122bf)
51 +---
52 + src/gui/opengl/qopenglprogrambinarycache.cpp | 20 ++++++++++++++++++--
53 + src/gui/opengl/qopenglshaderprogram.cpp | 8 +-------
54 + 2 files changed, 19 insertions(+), 9 deletions(-)
55 +
56 +diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp
57 +index 06373e1..d16173d 100644
58 +--- a/src/gui/opengl/qopenglprogrambinarycache.cpp
59 ++++ b/src/gui/opengl/qopenglprogrambinarycache.cpp
60 +@@ -161,10 +161,26 @@ bool QOpenGLProgramBinaryCache::setProgramBinary(uint programId, uint blobFormat
61 + QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions();
62 + while (funcs->glGetError() != GL_NO_ERROR) { }
63 + funcs->glProgramBinary(programId, blobFormat, p, blobSize);
64 +- int err = funcs->glGetError();
65 ++
66 ++ GLenum err = funcs->glGetError();
67 ++ if (err != GL_NO_ERROR) {
68 ++ qCDebug(DBG_SHADER_CACHE, "Program binary failed to load for program %u, size %d, "
69 ++ "format 0x%x, err = 0x%x",
70 ++ programId, blobSize, blobFormat, err);
71 ++ return false;
72 ++ }
73 ++ GLint linkStatus = 0;
74 ++ funcs->glGetProgramiv(programId, GL_LINK_STATUS, &linkStatus);
75 ++ if (linkStatus != GL_TRUE) {
76 ++ qCDebug(DBG_SHADER_CACHE, "Program binary failed to load for program %u, size %d, "
77 ++ "format 0x%x, linkStatus = 0x%x, err = 0x%x",
78 ++ programId, blobSize, blobFormat, linkStatus, err);
79 ++ return false;
80 ++ }
81 ++
82 + qCDebug(DBG_SHADER_CACHE, "Program binary set for program %u, size %d, format 0x%x, err = 0x%x",
83 + programId, blobSize, blobFormat, err);
84 +- return err == 0;
85 ++ return true;
86 + }
87 +
88 + #ifdef Q_OS_UNIX
89 +diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
90 +index cc8af16..3b82bac 100644
91 +--- a/src/gui/opengl/qopenglshaderprogram.cpp
92 ++++ b/src/gui/opengl/qopenglshaderprogram.cpp
93 +@@ -3824,13 +3824,7 @@ bool QOpenGLShaderProgramPrivate::linkBinary()
94 + bool needsCompile = true;
95 + if (binCache.load(cacheKey, q->programId())) {
96 + qCDebug(DBG_SHADER_CACHE, "Program binary received from cache");
97 +- linkBinaryRecursion = true;
98 +- bool ok = q->link();
99 +- linkBinaryRecursion = false;
100 +- if (ok)
101 +- needsCompile = false;
102 +- else
103 +- qCDebug(DBG_SHADER_CACHE, "Link failed after glProgramBinary");
104 ++ needsCompile = false;
105 + }
106 +
107 + bool needsSave = false;
108 +--
109 +2.7.4
110 +
111
112 diff --git a/dev-qt/qtgui/qtgui-5.9.4-r3.ebuild b/dev-qt/qtgui/qtgui-5.9.4-r3.ebuild
113 new file mode 100644
114 index 00000000000..91c5ac088c3
115 --- /dev/null
116 +++ b/dev-qt/qtgui/qtgui-5.9.4-r3.ebuild
117 @@ -0,0 +1,175 @@
118 +# Copyright 1999-2018 Gentoo Foundation
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=6
122 +QT5_MODULE="qtbase"
123 +inherit qt5-build
124 +
125 +DESCRIPTION="The GUI module and platform plugins for the Qt5 framework"
126 +
127 +if [[ ${QT5_BUILD_TYPE} == release ]]; then
128 + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
129 +fi
130 +
131 +# TODO: linuxfb
132 +
133 +IUSE="accessibility dbus egl eglfs evdev +gif gles2 ibus
134 + jpeg +libinput +png tslib tuio +udev vnc +xcb"
135 +REQUIRED_USE="
136 + || ( eglfs xcb )
137 + accessibility? ( dbus xcb )
138 + eglfs? ( egl )
139 + ibus? ( dbus )
140 + libinput? ( udev )
141 + xcb? ( gles2? ( egl ) )
142 +"
143 +
144 +RDEPEND="
145 + dev-libs/glib:2
146 + ~dev-qt/qtcore-${PV}
147 + media-libs/fontconfig
148 + >=media-libs/freetype-2.6.1:2
149 + >=media-libs/harfbuzz-1.0.6:=
150 + >=sys-libs/zlib-1.2.5
151 + virtual/opengl
152 + dbus? ( ~dev-qt/qtdbus-${PV} )
153 + egl? ( media-libs/mesa[egl] )
154 + eglfs? (
155 + media-libs/mesa[gbm]
156 + x11-libs/libdrm
157 + )
158 + evdev? ( sys-libs/mtdev )
159 + gles2? ( media-libs/mesa[gles2] )
160 + jpeg? ( virtual/jpeg:0 )
161 + libinput? (
162 + dev-libs/libinput:=
163 + x11-libs/libxkbcommon
164 + )
165 + png? ( media-libs/libpng:0= )
166 + tslib? ( x11-libs/tslib )
167 + tuio? ( ~dev-qt/qtnetwork-${PV} )
168 + udev? ( virtual/libudev:= )
169 + vnc? ( ~dev-qt/qtnetwork-${PV} )
170 + xcb? (
171 + x11-libs/libICE
172 + x11-libs/libSM
173 + x11-libs/libX11
174 + >=x11-libs/libXi-1.7.5
175 + >=x11-libs/libxcb-1.10:=[xkb]
176 + >=x11-libs/libxkbcommon-0.4.1[X]
177 + x11-libs/xcb-util-image
178 + x11-libs/xcb-util-keysyms
179 + x11-libs/xcb-util-renderutil
180 + x11-libs/xcb-util-wm
181 + )
182 +"
183 +DEPEND="${RDEPEND}
184 + evdev? ( sys-kernel/linux-headers )
185 + udev? ( sys-kernel/linux-headers )
186 +"
187 +PDEPEND="
188 + ibus? ( app-i18n/ibus )
189 +"
190 +
191 +PATCHES=(
192 + "${FILESDIR}/${P}-qsimpledrag.patch" # QTBUG-66103
193 + "${FILESDIR}/${P}-libinput-pixeldelta.patch" # QTBUG-59261
194 + "${FILESDIR}/${P}-opengl.patch" # QTBUG-66420
195 +)
196 +
197 +QT5_TARGET_SUBDIRS=(
198 + src/gui
199 + src/openglextensions
200 + src/platformheaders
201 + src/platformsupport
202 + src/plugins/generic
203 + src/plugins/imageformats
204 + src/plugins/platforms
205 + src/plugins/platforminputcontexts
206 +)
207 +
208 +QT5_GENTOO_CONFIG=(
209 + accessibility:accessibility-atspi-bridge
210 + egl
211 + eglfs
212 + eglfs:eglfs_egldevice:
213 + eglfs:eglfs_gbm:
214 + evdev
215 + evdev:mtdev:
216 + :fontconfig
217 + :system-freetype:FREETYPE
218 + !:no-freetype:
219 + !gif:no-gif:
220 + gles2::OPENGL_ES
221 + gles2:opengles2:OPENGL_ES_2
222 + !:no-gui:
223 + :system-harfbuzz:HARFBUZZ
224 + !:no-harfbuzz:
225 + jpeg:system-jpeg:IMAGEFORMAT_JPEG
226 + !jpeg:no-jpeg:
227 + libinput
228 + libinput:xkbcommon-evdev:
229 + :opengl
230 + png:png:
231 + png:system-png:IMAGEFORMAT_PNG
232 + !png:no-png:
233 + tslib
234 + udev:libudev:
235 + xcb:xcb:
236 + xcb:xcb-glx:
237 + xcb:xcb-plugin:
238 + xcb:xcb-render:
239 + xcb:xcb-sm:
240 + xcb:xcb-xlib:
241 + xcb:xinput2:
242 + xcb::XKB
243 +)
244 +
245 +QT5_GENTOO_PRIVATE_CONFIG=(
246 + :gui
247 +)
248 +
249 +src_prepare() {
250 + # egl_x11 is activated when both egl and xcb are enabled
251 + use egl && QT5_GENTOO_CONFIG+=(xcb:egl_x11) || QT5_GENTOO_CONFIG+=(egl:egl_x11)
252 +
253 + qt_use_disable_config dbus dbus \
254 + src/platformsupport/themes/genericunix/genericunix.pri
255 +
256 + qt_use_disable_config tuio udpsocket src/plugins/generic/generic.pro
257 +
258 + qt_use_disable_mod ibus dbus \
259 + src/plugins/platforminputcontexts/platforminputcontexts.pro
260 +
261 + use vnc || sed -i -e '/SUBDIRS += vnc/d' \
262 + src/plugins/platforms/platforms.pro || die
263 +
264 + qt5-build_src_prepare
265 +}
266 +
267 +src_configure() {
268 + local myconf=(
269 + $(usex dbus -dbus-linked '')
270 + $(qt_use egl)
271 + $(qt_use eglfs)
272 + $(usex eglfs '-gbm -kms' '')
273 + $(qt_use evdev)
274 + $(qt_use evdev mtdev)
275 + -fontconfig
276 + -system-freetype
277 + $(usex gif '' -no-gif)
278 + -gui
279 + -system-harfbuzz
280 + $(qt_use jpeg libjpeg system)
281 + $(qt_use libinput)
282 + $(qt_use libinput xkbcommon-evdev)
283 + -opengl $(usex gles2 es2 desktop)
284 + $(qt_use png libpng system)
285 + $(qt_use tslib)
286 + $(qt_use udev libudev)
287 + $(qt_use xcb xcb system)
288 + $(qt_use xcb xkbcommon-x11 system)
289 + $(usex xcb '-xcb-xlib -xinput2 -xkb' '')
290 + )
291 + qt5-build_src_configure
292 +}