summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2020-07-09 09:51:29 +0200
committerMichal Klocek <michal.klocek@qt.io>2020-08-05 19:56:03 +0200
commit1c916f6f1a44b5868a296bfa91dc59f5be97b92f (patch)
tree715a7acfcc7cc3f58a5b2f2a6f56a91a787a49ed /src/core
parent07c06c6c4a75d483ded3e27c5830a516576ee6e2 (diff)
Unify ozone platform selection in surfacefactoryqt
Use shared context to select between glx and egl. Change-Id: I6504400b9a2e2d23952c6da22fd42cf547596146 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ozone/surface_factory_qt.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
index f40aabc47..037641672 100644
--- a/src/core/ozone/surface_factory_qt.cpp
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -45,30 +45,38 @@
#endif
#include "ui/gl/gl_surface.h"
-#include <QGuiApplication>
#if defined(USE_OZONE)
#include "ozone/gl_ozone_egl_qt.h"
#include "ozone/surface_factory_qt.h"
#include "ui/gl/gl_surface.h"
+
+#include <QtGui/qtgui-config.h>
+#include <QOpenGLContext>
+
namespace QtWebEngineCore {
SurfaceFactoryQt::SurfaceFactoryQt()
{
- Q_ASSERT(qApp);
+ QOpenGLContext *context = QOpenGLContext::globalShareContext();
#if defined(USE_GLX)
- if (GLContextHelper::getGlXConfig()) {
+ auto *glx = context->platformInterface<QPlatformInterface::QGLXContext>();
+ if (glx) {
m_impl = { gl::kGLImplementationDesktopGL };
m_ozone.reset(new ui::GLOzoneGLXQt());
- } else
+ return;
+ }
#endif
- if (GLContextHelper::getEGLConfig()) {
+#if QT_CONFIG(egl)
+ auto *egl = context->platformInterface<QPlatformInterface::QEGLContext>();
+ if (egl) {
m_impl = { gl::kGLImplementationDesktopGL, gl::kGLImplementationEGLGLES2 };
m_ozone.reset(new ui::GLOzoneEGLQt());
- } else {
- qFatal("No suitable graphics backend found\n");
+ return;
}
+#endif
+ qFatal("No suitable graphics backend found\n");
}
std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations()