summaryrefslogtreecommitdiffstats
path: root/src/core/ozone
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ozone')
-rw-r--r--src/core/ozone/gl_context_qt.cpp21
-rw-r--r--src/core/ozone/gl_context_qt.h2
-rw-r--r--src/core/ozone/gl_ozone_egl_qt.cpp32
-rw-r--r--src/core/ozone/gl_ozone_egl_qt.h2
-rw-r--r--src/core/ozone/gl_ozone_glx_qt.cpp6
-rw-r--r--src/core/ozone/gl_ozone_glx_qt.h1
-rw-r--r--src/core/ozone/gl_surface_egl_qt.cpp7
-rw-r--r--src/core/ozone/gl_surface_egl_qt.h5
-rw-r--r--src/core/ozone/gl_surface_qt.cpp11
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp4
-rw-r--r--src/core/ozone/surface_factory_qt.cpp35
11 files changed, 59 insertions, 67 deletions
diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp
index 10347bdc7..e511e8eb5 100644
--- a/src/core/ozone/gl_context_qt.cpp
+++ b/src/core/ozone/gl_context_qt.cpp
@@ -123,7 +123,8 @@ void* GLContextHelper::getEGLConfig()
void* GLContextHelper::getGlXConfig()
{
- return resourceForContext(QByteArrayLiteral("glxconfig"));
+ QByteArray resource = QByteArrayLiteral("glxconfig");
+ return resourceForContext(resource);
}
void* GLContextHelper::getEGLDisplay()
@@ -172,6 +173,24 @@ QFunctionPointer GLContextHelper::getEglGetProcAddress()
return get_proc_address;
}
+void *GLContextHelper::getGlxPlatformInterface()
+{
+#if QT_CONFIG(opengl) && defined(USE_GLX)
+ if (QOpenGLContext *context = qt_gl_global_share_context())
+ return context->platformInterface<QPlatformInterface::QGLXContext>();
+#endif
+ return nullptr;
+}
+
+void *GLContextHelper::getEglPlatformInterface()
+{
+#if QT_CONFIG(opengl) && QT_CONFIG(egl)
+ if (QOpenGLContext *context = qt_gl_global_share_context())
+ return context->platformInterface<QPlatformInterface::QEGLContext>();
+#endif
+ return nullptr;
+}
+
bool GLContextHelper::isCreateContextRobustnessSupported()
{
return contextHelper->m_robustness;
diff --git a/src/core/ozone/gl_context_qt.h b/src/core/ozone/gl_context_qt.h
index cc4f6b0d1..612aae3f5 100644
--- a/src/core/ozone/gl_context_qt.h
+++ b/src/core/ozone/gl_context_qt.h
@@ -65,6 +65,8 @@ public:
static QFunctionPointer getGlXGetProcAddress();
static QFunctionPointer getEglGetProcAddress();
static bool isCreateContextRobustnessSupported();
+ static void *getGlxPlatformInterface();
+ static void *getEglPlatformInterface();
private:
Q_INVOKABLE bool initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs);
diff --git a/src/core/ozone/gl_ozone_egl_qt.cpp b/src/core/ozone/gl_ozone_egl_qt.cpp
index c692920cf..a8b7cdfe4 100644
--- a/src/core/ozone/gl_ozone_egl_qt.cpp
+++ b/src/core/ozone/gl_ozone_egl_qt.cpp
@@ -38,32 +38,21 @@
****************************************************************************/
#if defined(USE_OZONE)
-#include "gl_ozone_egl_qt.h"
#include "gl_context_qt.h"
+#include "gl_ozone_egl_qt.h"
#include "gl_surface_egl_qt.h"
+
#include "base/files/file_path.h"
#include "base/native_library.h"
-#include "gl_context_qt.h"
-#include "gl_ozone_egl_qt.h"
#include "ui/gl/gl_context_egl.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/init/gl_factory.h"
#include "ui/gl/init/gl_initializer.h"
-
#include <EGL/egl.h>
#include <dlfcn.h>
-#include <QtGui/qtgui-config.h>
-
-#if QT_CONFIG(opengl)
-#include <QOpenGLContext>
-QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
-QT_END_NAMESPACE
-#endif
-
namespace ui {
base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
@@ -88,15 +77,11 @@ bool GLOzoneEGLQt::LoadGLES2Bindings(gl::GLImplementation /*implementation*/)
reinterpret_cast<gl::GLGetProcAddressProc>(
base::GetFunctionPointerFromNativeLibrary(eglgles2Library,
"eglGetProcAddress"));
-#if QT_CONFIG(opengl)
if (!get_proc_address) {
// QTBUG-63341 most likely libgles2 not linked with libegl -> fallback to qpa
- if (QOpenGLContext *context = qt_gl_global_share_context()) {
- get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(
- context->getProcAddress("eglGetProcAddress"));
- }
+ QFunctionPointer address = GLContextHelper::getEglGetProcAddress();
+ get_proc_address = reinterpret_cast<gl::GLGetProcAddressProc>(address);
}
-#endif
if (!get_proc_address) {
LOG(ERROR) << "eglGetProcAddress not found.";
@@ -142,14 +127,11 @@ scoped_refptr<gl::GLSurface> GLOzoneEGLQt::CreateOffscreenGLSurface(const gfx::S
return nullptr;
}
-intptr_t GLOzoneEGLQt::GetNativeDisplay()
+gl::EGLDisplayPlatform GLOzoneEGLQt::GetNativeDisplay()
{
static void *display = GLContextHelper::getNativeDisplay();
-
- if (display)
- return reinterpret_cast<intptr_t>(display);
-
- return reinterpret_cast<intptr_t>(EGL_DEFAULT_DISPLAY);
+ static gl::EGLDisplayPlatform platform(display ? reinterpret_cast<intptr_t>(display) : EGL_DEFAULT_DISPLAY);
+ return platform;
}
} // namespace ui
diff --git a/src/core/ozone/gl_ozone_egl_qt.h b/src/core/ozone/gl_ozone_egl_qt.h
index c24d03a81..c55ba232c 100644
--- a/src/core/ozone/gl_ozone_egl_qt.h
+++ b/src/core/ozone/gl_ozone_egl_qt.h
@@ -58,7 +58,7 @@ public:
protected:
// Returns native platform display handle. This is used to obtain the EGL
// display connection for the native display.
- intptr_t GetNativeDisplay() override;
+ gl::EGLDisplayPlatform GetNativeDisplay() override;
// Sets up GL bindings for the native surface.
bool LoadGLES2Bindings(gl::GLImplementation implementation) override;
diff --git a/src/core/ozone/gl_ozone_glx_qt.cpp b/src/core/ozone/gl_ozone_glx_qt.cpp
index 0c54299ba..60b970209 100644
--- a/src/core/ozone/gl_ozone_glx_qt.cpp
+++ b/src/core/ozone/gl_ozone_glx_qt.cpp
@@ -95,12 +95,6 @@ bool GLOzoneGLXQt::InitializeStaticGLBindings(
return true;
}
-void GLOzoneGLXQt::InitializeLogGLBindings()
-{
- gl::InitializeLogGLBindingsGL();
- gl::InitializeLogGLBindingsGLX();
-}
-
void GLOzoneGLXQt::SetDisabledExtensionsPlatform(
const std::string& disabled_extensions) {
gl::SetDisabledExtensionsGLX(disabled_extensions);
diff --git a/src/core/ozone/gl_ozone_glx_qt.h b/src/core/ozone/gl_ozone_glx_qt.h
index 8f85ea23b..7825cba35 100644
--- a/src/core/ozone/gl_ozone_glx_qt.h
+++ b/src/core/ozone/gl_ozone_glx_qt.h
@@ -54,7 +54,6 @@ public:
bool InitializeGLOneOffPlatform() override;
bool InitializeStaticGLBindings(gl::GLImplementation implementation) override;
- void InitializeLogGLBindings() override;
bool InitializeExtensionSettingsOneOffPlatform() override;
void ShutdownGL() override;
void SetDisabledExtensionsPlatform(
diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp
index ac0e79b67..8e8e66f63 100644
--- a/src/core/ozone/gl_surface_egl_qt.cpp
+++ b/src/core/ozone/gl_surface_egl_qt.cpp
@@ -194,8 +194,7 @@ bool GLSurfaceEGL::HasEGLExtension(const char* name)
{
return ExtensionsContain(GetEGLExtensions(), name);
}
-
-bool GLSurfaceEGL::InitializeOneOff(EGLNativeDisplayType /*native_display*/)
+bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/)
{
return GLSurfaceEGLQt::InitializeOneOff();
}
@@ -252,7 +251,7 @@ void GLSurfaceEGLQt::Destroy()
}
bool GLSurfaceEGLQt::Resize(const gfx::Size& size, float scale_factor,
- ColorSpace color_space, bool has_alpha)
+ const gfx::ColorSpace &color_space, bool has_alpha)
{
if (size == m_size)
return true;
@@ -303,7 +302,7 @@ bool GLSurfacelessQtEGL::IsSurfaceless() const
}
bool GLSurfacelessQtEGL::Resize(const gfx::Size& size, float scale_factor,
- ColorSpace color_space, bool has_alpha)
+ const gfx::ColorSpace &color_space, bool has_alpha)
{
m_size = size;
return true;
diff --git a/src/core/ozone/gl_surface_egl_qt.h b/src/core/ozone/gl_surface_egl_qt.h
index ecc2327b3..dff25e433 100644
--- a/src/core/ozone/gl_surface_egl_qt.h
+++ b/src/core/ozone/gl_surface_egl_qt.h
@@ -57,7 +57,8 @@ public:
void Destroy() override;
void* GetHandle() override;
bool Resize(const gfx::Size& size, float scale_factor,
- ColorSpace color_space, bool has_alpha) override;
+ const gfx::ColorSpace &color_space, bool has_alpha) override;
+
protected:
~GLSurfaceEGLQt();
@@ -85,7 +86,7 @@ public:
void Destroy() override;
bool IsSurfaceless() const override;
bool Resize(const gfx::Size& size, float scale_factor,
- ColorSpace color_space, bool has_alpha) override;
+ const gfx::ColorSpace &color_space, bool has_alpha) override;
EGLSurface GetHandle() override;
void* GetShareHandle() override;
diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp
index 4be17f12b..90f486532 100644
--- a/src/core/ozone/gl_surface_qt.cpp
+++ b/src/core/ozone/gl_surface_qt.cpp
@@ -243,6 +243,17 @@ bool DirectCompositionSurfaceWin::IsSwapChainTearingSupported()
{
return false;
}
+
+bool DirectCompositionSurfaceWin::AreOverlaysSupported()
+{
+ return false;
+}
+
+UINT DirectCompositionSurfaceWin::GetOverlaySupportFlags(DXGI_FORMAT format)
+{
+ Q_UNUSED(format);
+ return 0;
+}
} // namespace gl
#endif
#endif // !defined(OS_MACOSX)
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index fb5af18c5..3674ccfe6 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -73,7 +73,7 @@ public:
ui::InputController* GetInputController() override;
std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override;
ui::OverlayManagerOzone* GetOverlayManager() override;
- std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate) override;
+ std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate, gfx::AcceleratedWidget widget) override;
std::unique_ptr<ui::PlatformScreen> CreateScreen() override { return nullptr; }
private:
void InitializeUI(const ui::OzonePlatform::InitParams &) override;
@@ -148,7 +148,7 @@ void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &)
surface_factory_ozone_.reset(new QtWebEngineCore::SurfaceFactoryQt());
}
-std::unique_ptr<InputMethod> OzonePlatformQt::CreateInputMethod(internal::InputMethodDelegate *)
+std::unique_ptr<InputMethod> OzonePlatformQt::CreateInputMethod(internal::InputMethodDelegate *, gfx::AcceleratedWidget)
{
NOTREACHED();
return nullptr;
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
index 037641672..846d930d6 100644
--- a/src/core/ozone/surface_factory_qt.cpp
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -37,46 +37,31 @@
**
****************************************************************************/
-#include "surface_factory_qt.h"
-#include "gl_context_qt.h"
-#include "gl_ozone_egl_qt.h"
-#if defined(USE_GLX)
-#include "gl_ozone_glx_qt.h"
-#endif
-
-#include "ui/gl/gl_surface.h"
-
#if defined(USE_OZONE)
+#include "surface_factory_qt.h"
+#include "ozone/gl_context_qt.h"
#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>
+#if defined(USE_GLX)
+#include "ozone/gl_ozone_glx_qt.h"
+#endif
namespace QtWebEngineCore {
SurfaceFactoryQt::SurfaceFactoryQt()
{
- QOpenGLContext *context = QOpenGLContext::globalShareContext();
#if defined(USE_GLX)
- auto *glx = context->platformInterface<QPlatformInterface::QGLXContext>();
- if (glx) {
+ if (GLContextHelper::getGlxPlatformInterface()) {
m_impl = { gl::kGLImplementationDesktopGL };
m_ozone.reset(new ui::GLOzoneGLXQt());
- return;
- }
+ } else
#endif
-#if QT_CONFIG(egl)
- auto *egl = context->platformInterface<QPlatformInterface::QEGLContext>();
- if (egl) {
+ if (GLContextHelper::getEglPlatformInterface()) {
m_impl = { gl::kGLImplementationDesktopGL, gl::kGLImplementationEGLGLES2 };
m_ozone.reset(new ui::GLOzoneEGLQt());
- return;
+ } else {
+ qFatal("No suitable graphics backend found\n");
}
-#endif
- qFatal("No suitable graphics backend found\n");
}
std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations()