summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brüning <michael.bruning@qt.io>2018-10-16 18:24:27 +0200
committerMichael Brüning <michael.bruning@qt.io>2018-10-23 11:45:17 +0000
commit5b84b15cf610eb7ba2f62cf0f675238531816c30 (patch)
tree8b562dcda916ed0ead450f44753de877cff1e7e6
parent6fffee8bfb270eda4f06fa5dbe3a4b190036e90a (diff)
Trigger disabling offline renderers on late 2013 Mac Pros
This reads the hw.model string through sysctlbyname and sets the environment variable QT_MAC_PRO_WEBENGINE_WORKAROUND to tell the Cocoa platform plugin to not enable offline renderers upon creation of the platform OpenGL context. Task-number: QTBUG-70062 Change-Id: I986d9d76a80f96a215f3fcd08b3d47e546682e35 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index 0353dac7d..4bb69ac21 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 @@ QWEBENGINE_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 @@ QWEBENGINE_PRIVATE_EXPORT void initialize()
#endif // QT_NO_OPENGL
}
} // namespace QtWebEngineCore
+