summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_context.cpp
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-09-13 10:32:33 +0200
committerMichal Klocek <michal.klocek@qt.io>2019-02-27 17:52:56 +0000
commit9362c57ecc54bfb7e007d5f4a6ec7948b59152d4 (patch)
tree31bc1fe880cf1e7cba59e2a10379bceb44aad640 /src/core/web_engine_context.cpp
parent28d3a4eb261318046464ea18d329aeecb9f1d9d0 (diff)
Fix detection of opengl support
Clean up tryGL check and add missing check for platform capability so webengine tests can run on arm in ci. Note this change only fixes webengine with offscreen plugin wihtout xlib support, which is the case for coin ci. Task-number: QTBUG-63346 Change-Id: I66fe6457f98815dad0dcd02df4500dc0ff752958 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/web_engine_context.cpp')
-rw-r--r--src/core/web_engine_context.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index adf98a3e1..e9a941bf2 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -113,8 +113,9 @@
#include <QStringList>
#include <QSurfaceFormat>
#include <QVector>
-#include <qpa/qplatformnativeinterface.h>
#include <QNetworkProxy>
+#include <QtGui/qpa/qplatformintegration.h>
+#include <QtGui/private/qguiapplication_p.h>
using namespace QtWebEngineCore;
@@ -138,10 +139,13 @@ bool usingANGLE()
#endif
}
-bool usingQtQuick2DRenderer()
+bool usingDefaultSGBackend()
{
const QStringList args = QGuiApplication::arguments();
- QString device;
+
+ //folow logic from contextFactory in src/quick/scenegraph/qsgcontextplugin.cpp
+ QString device = QQuickWindow::sceneGraphBackend();
+
for (int index = 0; index < args.count(); ++index) {
if (args.at(index).startsWith(QLatin1String("--device="))) {
device = args.at(index).mid(9);
@@ -150,16 +154,11 @@ bool usingQtQuick2DRenderer()
}
if (device.isEmpty())
- device = QQuickWindow::sceneGraphBackend();
- if (device.isEmpty())
device = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND"));
if (device.isEmpty())
device = QString::fromLocal8Bit(qgetenv("QMLSCENE_DEVICE"));
- if (device.isEmpty())
- device = QLatin1String("default");
- // Anything other than the default OpenGL device will need to render in 2D mode.
- return device != QLatin1String("default");
+ return device.isEmpty();
}
#endif //QT_NO_OPENGL
#if QT_CONFIG(webengine_pepper_plugins)
@@ -397,7 +396,11 @@ WebEngineContext::WebEngineContext()
QStringList appArgs = QCoreApplication::arguments();
- bool enableWebGLSoftwareRendering = appArgs.contains(QStringLiteral("--enable-webgl-software-rendering"));
+ // If user requested GL support instead of using Skia rendering to
+ // bitmaps, use software rendering via software OpenGL. This might be less
+ // performant, but at least provides WebGL support.
+ // TODO(miklocek), check if this still works with latest chromium
+ bool enableGLSoftwareRendering = appArgs.contains(QStringLiteral("--enable-webgl-software-rendering"));
bool useEmbeddedSwitches = false;
#if defined(QTWEBENGINE_EMBEDDED_SWITCHES)
@@ -498,15 +501,9 @@ WebEngineContext::WebEngineContext()
const char *glType = 0;
#ifndef QT_NO_OPENGL
- bool tryGL =
- (!usingSoftwareDynamicGL()
- // If user requested WebGL support instead of using Skia rendering to
- // bitmaps, use software rendering via software OpenGL. This might be less
- // performant, but at least provides WebGL support.
- || enableWebGLSoftwareRendering
- )
- && !usingQtQuick2DRenderer();
-
+ const bool tryGL = (usingDefaultSGBackend() && !usingSoftwareDynamicGL() &&
+ QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
+ || enableGLSoftwareRendering;
if (tryGL) {
if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) {
// If the native handle is QEGLNativeContext try to use GL ES/2.
@@ -573,7 +570,7 @@ WebEngineContext::WebEngineContext()
if (glType) {
parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);
parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
- if (enableWebGLSoftwareRendering) {
+ if (enableGLSoftwareRendering) {
parsedCommandLine->AppendSwitch(switches::kDisableGpuRasterization);
parsedCommandLine->AppendSwitch(switches::kIgnoreGpuBlacklist);
}