1 |
commit: aef30f8ce96a91339b398b0092b64f397fed1333 |
2 |
Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Feb 22 10:05:40 2018 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 22 22:13:30 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/qt.git/commit/?id=aef30f8c |
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 |
...-5.11.0_alpha.ebuild => qtgui-5.10.1-r1.ebuild} | 4 +- |
16 |
dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild | 2 + |
17 |
3 files changed, 92 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch b/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch |
20 |
new file mode 100644 |
21 |
index 00000000..2a447414 |
22 |
--- /dev/null |
23 |
+++ b/dev-qt/qtgui/files/qtgui-5.9.4-opengl.patch |
24 |
@@ -0,0 +1,87 @@ |
25 |
+From b63aeba4a88088c7de61c1664a510c02d38ade84 Mon Sep 17 00:00:00 2001 |
26 |
+From: Antonio Larrosa <alarrosa@××××.com> |
27 |
+Date: Fri, 16 Feb 2018 13:18:42 +0100 |
28 |
+Subject: [PATCH] opengl: Bail if cached shader fails to load |
29 |
+ |
30 |
+QOpenGLProgramBinaryCache::setProgramBinary() should check |
31 |
+GL_LINK_STATUS after glProgramBinary(), but doesn't. |
32 |
+ |
33 |
+In practice, this means that SDDM is a white screen, and KDE is just |
34 |
+a gray task bar. |
35 |
+ |
36 |
+So far, Qt tries to check this using its internal ::link() function. |
37 |
+But in case the cached binary fails to load, Qt currently attempts to |
38 |
+link the inexistent program, resulting in a zero-length, fixed |
39 |
+pipeline shader. |
40 |
+ |
41 |
+Checking this already in ::setProgramBinary() makes the call to |
42 |
+::link() superfluous, so we remove that as well. |
43 |
+ |
44 |
+Done-with: Max Staudt <mstaudt@××××.com> |
45 |
+Done-with: Michal Srb <msrb@××××.com> |
46 |
+Done-with: Fabian Vogt <fvogt@××××.de> |
47 |
+Task-number: QTBUG-66420 |
48 |
+Change-Id: Iabb51d0eb2c0c16bde696efff623e57d15f28d82 |
49 |
+Reviewed-by: Jesus Fernandez <Jesus.Fernandez@××.io> |
50 |
+Reviewed-by: Laszlo Agocs <laszlo.agocs@××.io> |
51 |
+(cherry picked from commit fa091640134b3ff99a9eb92df8286d15203122bf) |
52 |
+--- |
53 |
+ src/gui/opengl/qopenglprogrambinarycache.cpp | 20 ++++++++++++++++++-- |
54 |
+ src/gui/opengl/qopenglshaderprogram.cpp | 8 +------- |
55 |
+ 2 files changed, 19 insertions(+), 9 deletions(-) |
56 |
+ |
57 |
+diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp |
58 |
+index 06373e1..d16173d 100644 |
59 |
+--- a/src/gui/opengl/qopenglprogrambinarycache.cpp |
60 |
++++ b/src/gui/opengl/qopenglprogrambinarycache.cpp |
61 |
+@@ -161,10 +161,26 @@ bool QOpenGLProgramBinaryCache::setProgramBinary(uint programId, uint blobFormat |
62 |
+ QOpenGLExtraFunctions *funcs = QOpenGLContext::currentContext()->extraFunctions(); |
63 |
+ while (funcs->glGetError() != GL_NO_ERROR) { } |
64 |
+ funcs->glProgramBinary(programId, blobFormat, p, blobSize); |
65 |
+- int err = funcs->glGetError(); |
66 |
++ |
67 |
++ GLenum err = funcs->glGetError(); |
68 |
++ if (err != GL_NO_ERROR) { |
69 |
++ qCDebug(DBG_SHADER_CACHE, "Program binary failed to load for program %u, size %d, " |
70 |
++ "format 0x%x, err = 0x%x", |
71 |
++ programId, blobSize, blobFormat, err); |
72 |
++ return false; |
73 |
++ } |
74 |
++ GLint linkStatus = 0; |
75 |
++ funcs->glGetProgramiv(programId, GL_LINK_STATUS, &linkStatus); |
76 |
++ if (linkStatus != GL_TRUE) { |
77 |
++ qCDebug(DBG_SHADER_CACHE, "Program binary failed to load for program %u, size %d, " |
78 |
++ "format 0x%x, linkStatus = 0x%x, err = 0x%x", |
79 |
++ programId, blobSize, blobFormat, linkStatus, err); |
80 |
++ return false; |
81 |
++ } |
82 |
++ |
83 |
+ qCDebug(DBG_SHADER_CACHE, "Program binary set for program %u, size %d, format 0x%x, err = 0x%x", |
84 |
+ programId, blobSize, blobFormat, err); |
85 |
+- return err == 0; |
86 |
++ return true; |
87 |
+ } |
88 |
+ |
89 |
+ #ifdef Q_OS_UNIX |
90 |
+diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp |
91 |
+index cc8af16..3b82bac 100644 |
92 |
+--- a/src/gui/opengl/qopenglshaderprogram.cpp |
93 |
++++ b/src/gui/opengl/qopenglshaderprogram.cpp |
94 |
+@@ -3824,13 +3824,7 @@ bool QOpenGLShaderProgramPrivate::linkBinary() |
95 |
+ bool needsCompile = true; |
96 |
+ if (binCache.load(cacheKey, q->programId())) { |
97 |
+ qCDebug(DBG_SHADER_CACHE, "Program binary received from cache"); |
98 |
+- linkBinaryRecursion = true; |
99 |
+- bool ok = q->link(); |
100 |
+- linkBinaryRecursion = false; |
101 |
+- if (ok) |
102 |
+- needsCompile = false; |
103 |
+- else |
104 |
+- qCDebug(DBG_SHADER_CACHE, "Link failed after glProgramBinary"); |
105 |
++ needsCompile = false; |
106 |
+ } |
107 |
+ |
108 |
+ bool needsSave = false; |
109 |
+-- |
110 |
+2.7.4 |
111 |
+ |
112 |
|
113 |
diff --git a/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild b/dev-qt/qtgui/qtgui-5.10.1-r1.ebuild |
114 |
similarity index 97% |
115 |
copy from dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild |
116 |
copy to dev-qt/qtgui/qtgui-5.10.1-r1.ebuild |
117 |
index 9c89728d..3ab13c62 100644 |
118 |
--- a/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild |
119 |
+++ b/dev-qt/qtgui/qtgui-5.10.1-r1.ebuild |
120 |
@@ -29,7 +29,7 @@ RDEPEND=" |
121 |
~dev-qt/qtcore-${PV} |
122 |
media-libs/fontconfig |
123 |
>=media-libs/freetype-2.6.1:2 |
124 |
- >=media-libs/harfbuzz-1.6.0:= |
125 |
+ >=media-libs/harfbuzz-1.0.6:= |
126 |
>=sys-libs/zlib-1.2.5 |
127 |
virtual/opengl |
128 |
dbus? ( ~dev-qt/qtdbus-${PV} ) |
129 |
@@ -71,6 +71,8 @@ PDEPEND=" |
130 |
ibus? ( app-i18n/ibus ) |
131 |
" |
132 |
|
133 |
+PATCHES=( "${FILESDIR}/${PN}-5.9.4-opengl.patch" ) # QTBUG-66420 |
134 |
+ |
135 |
QT5_TARGET_SUBDIRS=( |
136 |
src/tools/qvkgen |
137 |
src/gui |
138 |
|
139 |
diff --git a/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild b/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild |
140 |
index 9c89728d..1d2abec0 100644 |
141 |
--- a/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild |
142 |
+++ b/dev-qt/qtgui/qtgui-5.11.0_alpha.ebuild |
143 |
@@ -71,6 +71,8 @@ PDEPEND=" |
144 |
ibus? ( app-i18n/ibus ) |
145 |
" |
146 |
|
147 |
+PATCHES=( "${FILESDIR}/${PN}-5.9.4-opengl.patch" ) # QTBUG-66420 |
148 |
+ |
149 |
QT5_TARGET_SUBDIRS=( |
150 |
src/tools/qvkgen |
151 |
src/gui |