From 51873329cbcb95117e29988061faad32a7913dc9 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Fri, 25 Mar 2016 08:21:16 -0500 Subject: [PATCH] 5.6.0-4 - backport upstream fixes - drop -fno-delete-null-pointer-checks hack (included in qt5-rpm-macros as needed now) --- ...-Canvas-has-negative-width-or-height.patch | 33 +++++ ...-Fix-crash-on-QQmlEngine-destruction.patch | 60 +++++++++ ...div-by-zero-when-nothing-is-rendered.patch | 30 +++++ Check-for-NULL-from-glGetString.patch | 116 ++++++++++++++++++ qt5-qtdeclarative.spec | 21 +++- 5 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 0008-Fix-crash-when-Canvas-has-negative-width-or-height.patch create mode 100644 0019-Revert-Fix-crash-on-QQmlEngine-destruction.patch create mode 100644 0029-Avoid-div-by-zero-when-nothing-is-rendered.patch create mode 100644 Check-for-NULL-from-glGetString.patch diff --git a/0008-Fix-crash-when-Canvas-has-negative-width-or-height.patch b/0008-Fix-crash-when-Canvas-has-negative-width-or-height.patch new file mode 100644 index 0000000..80f2497 --- /dev/null +++ b/0008-Fix-crash-when-Canvas-has-negative-width-or-height.patch @@ -0,0 +1,33 @@ +From 9783991b615484d2926e9648b10ea090af81d93f Mon Sep 17 00:00:00 2001 +From: Mitch Curtis +Date: Wed, 3 Feb 2016 12:57:05 +0100 +Subject: [PATCH 08/61] Fix crash when Canvas has negative width or height + +m_fbo is null when using a threaded render loop. + +Change-Id: I297ba651f9605f1718dbe9d09bd30e9682fb8401 +Task-number: QTBUG-50085 +Reviewed-by: Laszlo Agocs +--- + src/quick/items/context2d/qquickcontext2dtexture.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp +index 73b0b55..5ac971d 100644 +--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp ++++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp +@@ -599,6 +599,11 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting() + void QQuickContext2DFBOTexture::endPainting() + { + QQuickContext2DTexture::endPainting(); ++ ++ // There may not be an FBO due to zero width or height. ++ if (!m_fbo) ++ return; ++ + if (m_multisampledFbo) + QOpenGLFramebufferObject::blitFramebuffer(m_fbo, m_multisampledFbo); + +-- +1.9.3 + diff --git a/0019-Revert-Fix-crash-on-QQmlEngine-destruction.patch b/0019-Revert-Fix-crash-on-QQmlEngine-destruction.patch new file mode 100644 index 0000000..966ad11 --- /dev/null +++ b/0019-Revert-Fix-crash-on-QQmlEngine-destruction.patch @@ -0,0 +1,60 @@ +From 427ca15418c05e628bae3451c263be198e721ba9 Mon Sep 17 00:00:00 2001 +From: Robin Burchell +Date: Wed, 17 Feb 2016 01:35:29 +0100 +Subject: [PATCH 19/61] Revert "Fix crash on QQmlEngine destruction." + +This reverts commit 2e75be5f64fb21cbbdff3353dbd507c2ca26946a. + +This patch was originally written by Andrew den Exter in +222e06bf4ed509e72c1533cbe1d4859ca96933f3, externally from the main Qt tree. I +upstreamed this as part of our porting efforts. + +Some time later, this was accidentally reverted in +2e75be5f64fb21cbbdff3353dbd507c2ca26946a: we can't go back in time to examine +exactly what happened, but presumably Andrew didn't notice that I had upstreamed +this, attempted to apply the patch and ignored the "already applied" warning by +accident - and continued on dutifully with the patch accidentally reverted. + +This change is correct, though, and is thus reinstated. + +Change-Id: Idfe6ab39ad011f0401de25fe056aa3eb3fb8b424 +Reviewed-by: Andrew den Exter +Reviewed-by: Simon Hausmann +--- + src/qml/qml/qqmlengine.cpp | 4 ++-- + src/qml/qml/qqmlengine_p.h | 3 +-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp +index 109cfac..2cfe468 100644 +--- a/src/qml/qml/qqmlengine.cpp ++++ b/src/qml/qml/qqmlengine.cpp +@@ -598,8 +598,8 @@ QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) + workerScriptEngine(0), + activeObjectCreator(0), + networkAccessManager(0), networkAccessManagerFactory(0), urlInterceptor(0), +- scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1), +- incubatorCount(0), incubationController(0) ++ scarceResourcesRefCount(0), importDatabase(e), typeLoader(e), ++ uniqueId(1), incubatorCount(0), incubationController(0) + { + } + +diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h +index 26ee3bd..072a6c4 100644 +--- a/src/qml/qml/qqmlengine_p.h ++++ b/src/qml/qml/qqmlengine_p.h +@@ -166,9 +166,8 @@ public: + void referenceScarceResources(); + void dereferenceScarceResources(); + +- QQmlTypeLoader typeLoader; + QQmlImportDatabase importDatabase; +- ++ QQmlTypeLoader typeLoader; + + QString offlineStoragePath; + +-- +1.9.3 + diff --git a/0029-Avoid-div-by-zero-when-nothing-is-rendered.patch b/0029-Avoid-div-by-zero-when-nothing-is-rendered.patch new file mode 100644 index 0000000..8138b7a --- /dev/null +++ b/0029-Avoid-div-by-zero-when-nothing-is-rendered.patch @@ -0,0 +1,30 @@ +From e01bed44bca9bd0919f70dfc14f8297415d61bd9 Mon Sep 17 00:00:00 2001 +From: Gunnar Sletta +Date: Mon, 15 Feb 2016 08:02:50 +0100 +Subject: [PATCH 29/61] Avoid div-by-zero when nothing is rendered. + +Change-Id: I3eb57baf1812f831335429cc7d2b4424f3cfa785 +Task-number: QTBUG-50929 +Reviewed-by: Laszlo Agocs +--- + src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +index b1792d2..dd1ff14 100644 +--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp ++++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +@@ -2654,7 +2654,9 @@ void Renderer::render() + if (m_alphaBatches.size()) + std::sort(&m_alphaBatches.first(), &m_alphaBatches.last() + 1, qsg_sort_batch_increasing_order); + +- m_zRange = 1.0 / (m_nextRenderOrder); ++ m_zRange = m_nextRenderOrder != 0 ++ ? 1.0 / (m_nextRenderOrder) ++ : 0; + } + + if (Q_UNLIKELY(debug_render())) timeSorting = timer.restart(); +-- +1.9.3 + diff --git a/Check-for-NULL-from-glGetString.patch b/Check-for-NULL-from-glGetString.patch new file mode 100644 index 0000000..5d8e04e --- /dev/null +++ b/Check-for-NULL-from-glGetString.patch @@ -0,0 +1,116 @@ +From d4efd5ab810e92202efe672be29136324dd2a3f9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= +Date: Mon, 28 Dec 2015 05:43:18 +0200 +Subject: [PATCH] Check for NULL from glGetString + +glGetString can return NULL pointer in case of error +so check for it before using. + +Change-Id: Ia07424c8f2b3ce6dce675514900a509e3ef3b739 +--- + src/particles/qquickimageparticle.cpp | 6 ++++-- + src/quick/scenegraph/qsgcontext.cpp | 22 ++++++++++++++++------ + .../qsgdefaultdistancefieldglyphcache.cpp | 8 +++++--- + src/quick/scenegraph/util/qsgatlastexture.cpp | 4 ++-- + 4 files changed, 27 insertions(+), 13 deletions(-) + +diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp +index d78a350..b54861e 100644 +--- a/src/particles/qquickimageparticle.cpp ++++ b/src/particles/qquickimageparticle.cpp +@@ -1276,14 +1276,16 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) + // OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros, + // causing point sprites who read gl_PointCoord in the frag shader to come out as + // green-red blobs. +- if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) { ++ const char *vendor = (const char *) glGetString(GL_VENDOR); ++ if (perfLevel < Deformable && vendor && strstr(vendor, "ATI")) { + perfLevel = Deformable; + } + #endif + + #ifdef Q_OS_LINUX + // Nouveau drivers can potentially freeze a machine entirely when taking the point-sprite path. +- if (perfLevel < Deformable && strstr((const char *) glGetString(GL_VENDOR), "nouveau")) ++ const char *vendor = (const char *) glGetString(GL_VENDOR); ++ if (perfLevel < Deformable && vendor && strstr(vendor, "nouveau")) + perfLevel = Deformable; + #endif + +diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp +index dd6977e..43d549f 100644 +--- a/src/quick/scenegraph/qsgcontext.cpp ++++ b/src/quick/scenegraph/qsgcontext.cpp +@@ -624,14 +624,24 @@ void QSGRenderContext::initialize(QOpenGLContext *context) + m_sg->renderContextInitialized(this); + + #ifdef Q_OS_LINUX ++ while (funcs->glGetError() != GL_NO_ERROR); ++ + const char *vendor = (const char *) funcs->glGetString(GL_VENDOR); +- if (strstr(vendor, "nouveau")) +- m_brokenIBOs = true; + const char *renderer = (const char *) funcs->glGetString(GL_RENDERER); +- if (strstr(renderer, "llvmpipe")) +- m_serializedRender = true; +- if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) +- m_brokenIBOs = true; ++ ++ if (vendor && renderer) { ++ if (strstr(vendor, "nouveau")) ++ m_brokenIBOs = true; ++ if (strstr(renderer, "llvmpipe")) ++ m_serializedRender = true; ++ if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) ++ m_brokenIBOs = true; ++ } else { ++ GLenum err; ++ while ((err = funcs->glGetError()) != GL_NO_ERROR) { ++ qWarning("QSGRenderContext::initialize: GL error %x from glGetString", err); ++ } ++ } + #endif + + emit initialized(); +diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +index dcc485c..43e234b 100644 +--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp ++++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +@@ -488,9 +488,11 @@ bool QSGDefaultDistanceFieldGlyphCache::useTextureUploadWorkaround() const + static bool set = false; + static bool useWorkaround = false; + if (!set) { +- useWorkaround = qstrcmp(reinterpret_cast(m_funcs->glGetString(GL_RENDERER)), +- "Mali-400 MP") == 0; +- set = true; ++ const char *renderer = reinterpret_cast(m_funcs->glGetString(GL_RENDERER)); ++ if (renderer) { ++ useWorkaround = qstrcmp(renderer, "Mali-400 MP") == 0; ++ set = true; ++ } + } + return useWorkaround; + } +diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp +index 8e8e870..d726907 100644 +--- a/src/quick/scenegraph/util/qsgatlastexture.cpp ++++ b/src/quick/scenegraph/util/qsgatlastexture.cpp +@@ -150,13 +150,13 @@ Atlas::Atlas(const QSize &size) + wrongfullyReportsBgra8888Support = false; + + const char *ext = (const char *) QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS); +- if (!wrongfullyReportsBgra8888Support ++ if (!wrongfullyReportsBgra8888Support && ext + && (strstr(ext, "GL_EXT_bgra") + || strstr(ext, "GL_EXT_texture_format_BGRA8888") + || strstr(ext, "GL_IMG_texture_format_BGRA8888"))) { + m_internalFormat = m_externalFormat = GL_BGRA; + #ifdef Q_OS_IOS +- } else if (strstr(ext, "GL_APPLE_texture_format_BGRA8888")) { ++ } else if (ext && strstr(ext, "GL_APPLE_texture_format_BGRA8888")) { + m_internalFormat = GL_RGBA; + m_externalFormat = GL_BGRA; + #endif // IOS +-- +1.9.3 + diff --git a/qt5-qtdeclarative.spec b/qt5-qtdeclarative.spec index dab121a..b7ad5a2 100644 --- a/qt5-qtdeclarative.spec +++ b/qt5-qtdeclarative.spec @@ -17,7 +17,7 @@ Summary: Qt5 - QtDeclarative component Name: qt5-%{qt_module} Version: 5.6.0 -Release: 3%{?prerelease:.%{prerelease}}%{?dist} +Release: 4%{?prerelease:.%{prerelease}}%{?dist} # See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -33,6 +33,15 @@ Patch1: qtdeclarative-opensource-src-5.5.0-no_sse2.patch # https://bugs.kde.org/show_bug.cgi?id=348385 Patch2: qtdeclarative-QQuickShaderEffectSource_deadlock.patch +## upstream patches +Patch8: 0008-Fix-crash-when-Canvas-has-negative-width-or-height.patch +Patch19: 0019-Revert-Fix-crash-on-QQmlEngine-destruction.patch +Patch29: 0029-Avoid-div-by-zero-when-nothing-is-rendered.patch + +## upstream patches under review +# Check-for-NULL-from-glGetStrin +Patch500: Check-for-NULL-from-glGetString.patch + Obsoletes: qt5-qtjsbackend < 5.2.0 BuildRequires: cmake @@ -85,6 +94,12 @@ Requires: %{name}%{?_isa} = %{version}-%{release} %patch1 -p1 -b .no_sse2 %patch2 -p1 -b .QQuickShaderEffectSource_deadlock +%patch8 -p1 -b .0008 +%patch19 -p1 -b .0019 +%patch29 -p1 -b .0029 + +%patch500 -p1 -b .Check-for-NULL-from-glGetString + %build @@ -216,6 +231,10 @@ popd %changelog +* Fri Mar 25 2016 Rex Dieter - 5.6.0-4 +- backport upstream fixes +- drop -fno-delete-null-pointer-checks hack (included in qt5-rpm-macros as needed now) + * Sat Mar 19 2016 Rex Dieter - 5.6.0-3 - BR: cmake (cmake autoprovides)