diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2018-10-30 11:33:05 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2018-10-30 11:33:05 +0100 |
commit | 92b8a931504020d6a2fdb00a47f26be314fda19f (patch) | |
tree | 49b2b03d85708bbb51418216dc496f7792bab4a9 | |
parent | 25dc99491cf4380cba2dda30f17ea91aa4233855 (diff) | |
parent | 5b84b15cf610eb7ba2f62cf0f675238531816c30 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12.0
Change-Id: I319ea175f9d95a3ffea9cc3140696976348a5238
-rw-r--r-- | src/core/api/qtwebenginecoreglobal.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index d3cf72477..a415ade92 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -42,6 +42,10 @@ #include <QGuiApplication> #ifndef QT_NO_OPENGL # include <QOpenGLContext> +#ifdef Q_OS_MACOS +#include <sys/types.h> +#include <sys/sysctl.h> +#endif #endif #include <QThread> @@ -52,6 +56,23 @@ Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); QT_END_NAMESPACE #endif +#ifndef QT_NO_OPENGL +#ifdef Q_OS_MACOS +static bool needsOfflineRendererWorkaround() { + size_t hwmodelsize = 0; + + if (sysctlbyname("hw.model", nullptr, &hwmodelsize, nullptr, 0) == -1) + return false; + + char hwmodel[hwmodelsize]; + if (sysctlbyname("hw.model", &hwmodel, &hwmodelsize, nullptr, 0) == -1) + return false; + + return QString::fromLatin1(hwmodel) == QLatin1String("MacPro6,1"); +} +#endif +#endif + namespace QtWebEngineCore { #ifndef QT_NO_OPENGL static QOpenGLContext *shareContext; @@ -74,7 +95,10 @@ QWEBENGINECORE_PRIVATE_EXPORT void initialize() #ifdef Q_OS_WIN32 qputenv("QT_D3DCREATE_MULTITHREADED", "1"); #endif - +#ifdef Q_OS_MACOS + if (needsOfflineRendererWorkaround()) + qputenv("QT_MAC_PRO_WEBENGINE_WORKAROUND", "1"); +#endif // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts). if (qt_gl_global_share_context()) return; @@ -107,3 +131,4 @@ QWEBENGINECORE_PRIVATE_EXPORT void initialize() #endif // QT_NO_OPENGL } } // namespace QtWebEngineCore + |