From 1c916f6f1a44b5868a296bfa91dc59f5be97b92f Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Thu, 9 Jul 2020 09:51:29 +0200 Subject: Unify ozone platform selection in surfacefactoryqt Use shared context to select between glx and egl. Change-Id: I6504400b9a2e2d23952c6da22fd42cf547596146 Reviewed-by: Allan Sandfeld Jensen --- src/core/ozone/surface_factory_qt.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src') 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 #if defined(USE_OZONE) #include "ozone/gl_ozone_egl_qt.h" #include "ozone/surface_factory_qt.h" #include "ui/gl/gl_surface.h" + +#include +#include + namespace QtWebEngineCore { SurfaceFactoryQt::SurfaceFactoryQt() { - Q_ASSERT(qApp); + QOpenGLContext *context = QOpenGLContext::globalShareContext(); #if defined(USE_GLX) - if (GLContextHelper::getGlXConfig()) { + auto *glx = context->platformInterface(); + 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(); + 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 SurfaceFactoryQt::GetAllowedGLImplementations() -- cgit v1.2.3