summaryrefslogtreecommitdiff
path: root/chromium/ui/gl/init
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/ui/gl/init
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/gl/init')
-rw-r--r--chromium/ui/gl/init/BUILD.gn40
-rw-r--r--chromium/ui/gl/init/DEPS1
-rw-r--r--chromium/ui/gl/init/create_gr_gl_interface.cc1
-rw-r--r--chromium/ui/gl/init/gl_factory_linux_x11.cc (renamed from chromium/ui/gl/init/gl_factory_x11.cc)25
-rw-r--r--chromium/ui/gl/init/gl_factory_linux_x11.h98
-rw-r--r--chromium/ui/gl/init/gl_factory_ozone.cc73
-rw-r--r--chromium/ui/gl/init/gl_initializer_linux_x11.cc (renamed from chromium/ui/gl/init/gl_initializer_x11.cc)14
-rw-r--r--chromium/ui/gl/init/gl_initializer_linux_x11.h38
-rw-r--r--chromium/ui/gl/init/gl_initializer_mac.cc1
-rw-r--r--chromium/ui/gl/init/gl_initializer_ozone.cc29
10 files changed, 288 insertions, 32 deletions
diff --git a/chromium/ui/gl/init/BUILD.gn b/chromium/ui/gl/init/BUILD.gn
index 72a840d78fa..9141ba379fd 100644
--- a/chromium/ui/gl/init/BUILD.gn
+++ b/chromium/ui/gl/init/BUILD.gn
@@ -56,12 +56,36 @@ jumbo_component("init") {
]
libs = [ "OpenGL.framework" ]
- } else if (use_x11) {
+ } else if (use_ozone) {
+ sources += [
+ "gl_display_egl_util_ozone.cc",
+ "gl_display_egl_util_ozone.h",
+ "ozone_util.h",
+ ]
+ deps += [ "//ui/ozone" ]
+ }
+
+ # Allow X11 to use Ozone implementation of gl_factory and gl_initializer.
+ # This is needed temporarily to allow use_x11 && use_ozone build. Once
+ # use_x11 goes away, this will be removed. Internally, it checks whether
+ # it should use pure X11 implementation or Ozone implementation based on
+ # IsUsingOzonePlatform feature flag.
+ if (use_x11 || use_ozone) {
+ sources += [
+ "gl_factory_ozone.cc",
+ "gl_initializer_ozone.cc",
+ ]
+ deps += [ "//ui/base:features" ]
+ }
+
+ if (use_x11) {
sources += [
"gl_display_egl_util_x11.cc",
"gl_display_egl_util_x11.h",
- "gl_factory_x11.cc",
- "gl_initializer_x11.cc",
+ "gl_factory_linux_x11.cc",
+ "gl_factory_linux_x11.h",
+ "gl_initializer_linux_x11.cc",
+ "gl_initializer_linux_x11.h",
]
deps += [
@@ -69,15 +93,5 @@ jumbo_component("init") {
"//ui/base/x:gl",
"//ui/gfx/x",
]
- } else if (use_ozone) {
- sources += [
- "gl_display_egl_util_ozone.cc",
- "gl_display_egl_util_ozone.h",
- "gl_factory_ozone.cc",
- "gl_initializer_ozone.cc",
- "ozone_util.h",
- ]
-
- deps += [ "//ui/ozone" ]
}
}
diff --git a/chromium/ui/gl/init/DEPS b/chromium/ui/gl/init/DEPS
index 6b2bc9584ad..82a1175c23c 100644
--- a/chromium/ui/gl/init/DEPS
+++ b/chromium/ui/gl/init/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+ui/base/ui_base_features.h",
"+ui/ozone/gl",
"+ui/ozone/public",
]
diff --git a/chromium/ui/gl/init/create_gr_gl_interface.cc b/chromium/ui/gl/init/create_gr_gl_interface.cc
index d71dd24f871..cb283629719 100644
--- a/chromium/ui/gl/init/create_gr_gl_interface.cc
+++ b/chromium/ui/gl/init/create_gr_gl_interface.cc
@@ -426,6 +426,7 @@ sk_sp<GrGLInterface> CreateGrGLInterface(
// functions->fMultiDrawArraysIndirect = gl->glMultiDrawArraysIndirectFn;
// functions->fMultiDrawElementsIndirect = gl->glMultiDrawElementsIndirectFn;
+ functions->fPatchParameteri = gl->glPatchParameteriFn;
functions->fPixelStorei = gl->glPixelStoreiFn;
functions->fPolygonMode = gl->glPolygonModeFn;
functions->fProgramBinary = gl->glProgramBinaryFn;
diff --git a/chromium/ui/gl/init/gl_factory_x11.cc b/chromium/ui/gl/init/gl_factory_linux_x11.cc
index 4bebef1a31d..ed722461046 100644
--- a/chromium/ui/gl/init/gl_factory_x11.cc
+++ b/chromium/ui/gl/init/gl_factory_linux_x11.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/gl/init/gl_factory.h"
+#include "ui/gl/init/gl_factory_linux_x11.h"
#include "base/trace_event/trace_event.h"
#include "ui/gl/gl_context.h"
@@ -23,7 +23,7 @@
namespace gl {
namespace init {
-std::vector<GLImplementation> GetAllowedGLImplementations() {
+std::vector<GLImplementation> GetAllowedGLImplementationsX11() {
std::vector<GLImplementation> impls;
impls.push_back(kGLImplementationDesktopGL);
impls.push_back(kGLImplementationEGLGLES2);
@@ -32,8 +32,8 @@ std::vector<GLImplementation> GetAllowedGLImplementations() {
return impls;
}
-bool GetGLWindowSystemBindingInfo(const GLVersionInfo& gl_info,
- GLWindowSystemBindingInfo* info) {
+bool GetGLWindowSystemBindingInfoX11(const GLVersionInfo& gl_info,
+ GLWindowSystemBindingInfo* info) {
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
return GetGLWindowSystemBindingInfoGLX(gl_info, info);
@@ -45,9 +45,9 @@ bool GetGLWindowSystemBindingInfo(const GLVersionInfo& gl_info,
}
}
-scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
- GLSurface* compatible_surface,
- const GLContextAttribs& attribs) {
+scoped_refptr<GLContext> CreateGLContextX11(GLShareGroup* share_group,
+ GLSurface* compatible_surface,
+ const GLContextAttribs& attribs) {
TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
@@ -72,7 +72,7 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
}
}
-scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
+scoped_refptr<GLSurface> CreateViewGLSurfaceX11(gfx::AcceleratedWidget window) {
TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
@@ -93,8 +93,9 @@ scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
}
}
-scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
- const gfx::Size& size, GLSurfaceFormat format) {
+scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormatX11(
+ const gfx::Size& size,
+ GLSurfaceFormat format) {
TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
@@ -119,7 +120,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
}
}
-void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
+void SetDisabledExtensionsPlatformX11(const std::string& disabled_extensions) {
GLImplementation implementation = GetGLImplementation();
DCHECK_NE(kGLImplementationNone, implementation);
switch (implementation) {
@@ -139,7 +140,7 @@ void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
}
}
-bool InitializeExtensionSettingsOneOffPlatform() {
+bool InitializeExtensionSettingsOneOffPlatformX11() {
GLImplementation implementation = GetGLImplementation();
DCHECK_NE(kGLImplementationNone, implementation);
switch (implementation) {
diff --git a/chromium/ui/gl/init/gl_factory_linux_x11.h b/chromium/ui/gl/init/gl_factory_linux_x11.h
new file mode 100644
index 00000000000..ce6519ef58b
--- /dev/null
+++ b/chromium/ui/gl/init/gl_factory_linux_x11.h
@@ -0,0 +1,98 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_INIT_GL_FACTORY_LINUX_X11_H_
+#define UI_GL_INIT_GL_FACTORY_LINUX_X11_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface_format.h"
+#include "ui/gl/gpu_preference.h"
+
+namespace gl {
+
+class GLContext;
+class GLShareGroup;
+class GLSurface;
+
+struct GLContextAttribs;
+struct GLVersionInfo;
+
+// Note that this is a temporary implementation for Linux/X11 GL. It is called
+// through GLFactoryOzone, and will be removed as soon as Linux/Ozone is
+// the default. Comments have been copied from gl_factory.h
+//
+// TODO(msisov): remove this once Ozone is the default on Linux.
+namespace init {
+
+// Returns a list of allowed GL implementations. The default implementation will
+// be the first item.
+std::vector<GLImplementation> GetAllowedGLImplementationsX11();
+
+// Initializes GL bindings and extension settings.
+bool InitializeGLOneOffX11();
+
+// Initializes GL bindings without initializing extension settings.
+bool InitializeGLNoExtensionsOneOffX11(bool init_bindings);
+
+// Initializes GL bindings - load dlls and get proc address according to gl
+// command line switch.
+bool InitializeStaticGLBindingsOneOffX11();
+
+// Initialize plaiform dependent extension settings, including bindings,
+// capabilities, etc.
+bool InitializeExtensionSettingsOneOffPlatformX11();
+
+// Initializes GL bindings using the provided parameters. This might be required
+// for use in tests.
+bool InitializeStaticGLBindingsImplementationX11(GLImplementation impl,
+ bool fallback_to_software_gl);
+
+// Initializes GL platform using the provided parameters. This might be required
+// for use in tests. This should be called only after GL bindings are initilzed
+// successfully.
+bool InitializeGLOneOffPlatformImplementationX11(bool fallback_to_software_gl,
+ bool disable_gl_drawing,
+ bool init_extensions);
+
+// Clears GL bindings and resets GL implementation.
+void ShutdownGLX11(bool due_to_fallback);
+
+// Return information about the GL window system binding implementation (e.g.,
+// EGL, GLX, WGL). Returns true if the information was retrieved successfully.
+bool GetGLWindowSystemBindingInfoX11(const GLVersionInfo& gl_info,
+ GLWindowSystemBindingInfo* info);
+
+// Creates a GL context that is compatible with the given surface.
+// |share_group|, if non-null, is a group of contexts which the internally
+// created OpenGL context shares textures and other resources.
+scoped_refptr<GLContext> CreateGLContextX11(GLShareGroup* share_group,
+ GLSurface* compatible_surface,
+ const GLContextAttribs& attribs);
+
+// Creates a GL surface that renders directly to a view.
+scoped_refptr<GLSurface> CreateViewGLSurfaceX11(gfx::AcceleratedWidget window);
+
+// Creates a GL surface used for offscreen rendering.
+scoped_refptr<GLSurface> CreateOffscreenGLSurfaceX11(const gfx::Size& size);
+
+scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormatX11(
+ const gfx::Size& size,
+ GLSurfaceFormat format);
+
+// Set platform dependent disabled extensions and re-initialize extension
+// bindings.
+void SetDisabledExtensionsPlatformX11(const std::string& disabled_extensions);
+
+} // namespace init
+
+} // namespace gl
+
+#endif // UI_GL_INIT_GL_FACTORY_LINUX_X11_H_
diff --git a/chromium/ui/gl/init/gl_factory_ozone.cc b/chromium/ui/gl/init/gl_factory_ozone.cc
index cd64372831f..a53de798086 100644
--- a/chromium/ui/gl/init/gl_factory_ozone.cc
+++ b/chromium/ui/gl/init/gl_factory_ozone.cc
@@ -14,20 +14,45 @@
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_surface_stub.h"
+
+#if defined(USE_OZONE)
#include "ui/gl/init/ozone_util.h"
+#endif
+
+#if defined(USE_X11)
+#include "ui/base/ui_base_features.h"
+#include "ui/gl/init/gl_factory_linux_x11.h"
+#endif
namespace gl {
namespace init {
std::vector<GLImplementation> GetAllowedGLImplementations() {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::GetAllowedGLImplementationsX11();
+#endif
+
+#if defined(USE_OZONE)
DCHECK(GetSurfaceFactoryOzone());
return GetSurfaceFactoryOzone()->GetAllowedGLImplementations();
+#else
+ NOTREACHED();
+ return {};
+#endif
}
bool GetGLWindowSystemBindingInfo(const GLVersionInfo& gl_info,
GLWindowSystemBindingInfo* info) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::GetGLWindowSystemBindingInfoX11(gl_info, info);
+#endif
+
+#if defined(USE_OZONE)
if (HasGLOzone())
return GetGLOzone()->GetGLWindowSystemBindingInfo(gl_info, info);
+#endif
return false;
}
@@ -35,6 +60,13 @@ bool GetGLWindowSystemBindingInfo(const GLVersionInfo& gl_info,
scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
GLSurface* compatible_surface,
const GLContextAttribs& attribs) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::CreateGLContextX11(share_group, compatible_surface,
+ attribs);
+#endif
+
+#if defined(USE_OZONE)
TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
if (HasGLOzone()) {
@@ -56,10 +88,18 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
default:
NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
}
+#endif
+
return nullptr;
}
scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::CreateViewGLSurfaceX11(window);
+#endif
+
+#if defined(USE_OZONE)
TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
if (HasGLOzone())
@@ -72,22 +112,37 @@ scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
default:
NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
}
+#endif
return nullptr;
}
scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
gfx::AcceleratedWidget window) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform()) {
+ return nullptr;
+ }
+#endif
+
+#if defined(USE_OZONE)
TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
if (HasGLOzone())
return GetGLOzone()->CreateSurfacelessViewGLSurface(window);
+#endif
return nullptr;
}
scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
const gfx::Size& size, GLSurfaceFormat format) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::CreateOffscreenGLSurfaceWithFormatX11(size, format);
+#endif
+
+#if defined(USE_OZONE)
TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
if (!format.IsCompatible(GLSurfaceFormat())) {
@@ -105,11 +160,20 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
default:
NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
}
+#endif
return nullptr;
}
void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform()) {
+ gl::init::SetDisabledExtensionsPlatformX11(disabled_extensions);
+ return;
+ }
+#endif
+
+#if defined(USE_OZONE)
if (HasGLOzone()) {
GetGLOzone()->SetDisabledExtensionsPlatform(disabled_extensions);
return;
@@ -122,9 +186,16 @@ void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
default:
NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
}
+#endif
}
bool InitializeExtensionSettingsOneOffPlatform() {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::InitializeExtensionSettingsOneOffPlatformX11();
+#endif
+
+#if defined(USE_OZONE)
if (HasGLOzone())
return GetGLOzone()->InitializeExtensionSettingsOneOffPlatform();
@@ -136,6 +207,8 @@ bool InitializeExtensionSettingsOneOffPlatform() {
NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
return false;
}
+#endif
+ return false;
}
} // namespace init
diff --git a/chromium/ui/gl/init/gl_initializer_x11.cc b/chromium/ui/gl/init/gl_initializer_linux_x11.cc
index d76d146b0d8..0c57d500c0d 100644
--- a/chromium/ui/gl/init/gl_initializer_x11.cc
+++ b/chromium/ui/gl/init/gl_initializer_linux_x11.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/gl/init/gl_initializer.h"
+#include "ui/gl/init/gl_initializer_linux_x11.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -45,7 +45,7 @@ const char kEGLSwiftShaderLibraryName[] = "libEGL.so";
#endif
bool InitializeStaticGLXInternal() {
- base::NativeLibrary library = NULL;
+ base::NativeLibrary library = nullptr;
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
@@ -142,7 +142,7 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) {
} // namespace
-bool InitializeGLOneOffPlatform() {
+bool InitializeGLOneOffPlatformX11() {
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
if (!GLSurfaceGLX::InitializeOneOff()) {
@@ -155,8 +155,8 @@ bool InitializeGLOneOffPlatform() {
case kGLImplementationEGLANGLE:
// Set utility class that helps to initialize egl platform.
gl::GLDisplayEglUtil::SetInstance(gl::GLDisplayEglUtilX11::GetInstance());
- if (!GLSurfaceEGL::InitializeOneOff(
- EGLDisplayPlatform(gfx::GetXDisplay()))) {
+ if (!GLSurfaceEGL::InitializeOneOff(EGLDisplayPlatform(
+ reinterpret_cast<EGLNativeDisplayType>(gfx::GetXDisplay())))) {
LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
return false;
}
@@ -166,7 +166,7 @@ bool InitializeGLOneOffPlatform() {
}
}
-bool InitializeStaticGLBindings(GLImplementation implementation) {
+bool InitializeStaticGLBindingsX11(GLImplementation implementation) {
// Prevent reinitialization with a different implementation. Once the gpu
// unit tests have initialized with kGLImplementationMock, we don't want to
// later switch to another GL implementation.
@@ -197,7 +197,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
return false;
}
-void ShutdownGLPlatform() {
+void ShutdownGLPlatformX11() {
GLSurfaceEGL::ShutdownOneOff();
GLSurfaceGLX::ShutdownOneOff();
ClearBindingsEGL();
diff --git a/chromium/ui/gl/init/gl_initializer_linux_x11.h b/chromium/ui/gl/init/gl_initializer_linux_x11.h
new file mode 100644
index 00000000000..07e0f8654de
--- /dev/null
+++ b/chromium/ui/gl/init/gl_initializer_linux_x11.h
@@ -0,0 +1,38 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_INIT_GL_INITIALIZER_LINUX_X11_H_
+#define UI_GL_INIT_GL_INITIALIZER_LINUX_X11_H_
+
+#include "ui/gl/gl_implementation.h"
+
+namespace gl {
+
+// Note that this is a temporary gl implementation for Linux/X11 GL. It is
+// called through GLFactoryOzone, and will be removed as soon as Linux/Ozone is
+// default.
+//
+// TODO(msisov): remove this once Ozone is default on Linux.
+namespace init {
+
+// Performs platform dependent one-off GL initialization, calling into the
+// appropriate GLSurface code to initialize it. To perform one-off GL
+// initialization you should use InitializeGLOneOff() or
+// InitializeStaticGLBindingsOneOff() +
+// InitializeGLNoExtensionsOneOff(). For tests possibly
+// InitializeStaticGLBindingsImplementation() +
+// InitializeGLOneOffPlatformImplementation() instead.
+bool InitializeGLOneOffPlatformX11();
+
+// Initializes a particular GL implementation.
+bool InitializeStaticGLBindingsX11(GLImplementation implementation);
+
+// Clears GL bindings for all implementations supported by platform.
+void ShutdownGLPlatformX11();
+
+} // namespace init
+
+} // namespace gl
+
+#endif // UI_GL_INIT_GL_INITIALIZER_LINUX_X11_H_
diff --git a/chromium/ui/gl/init/gl_initializer_mac.cc b/chromium/ui/gl/init/gl_initializer_mac.cc
index 0deebafe135..d8ad42a0755 100644
--- a/chromium/ui/gl/init/gl_initializer_mac.cc
+++ b/chromium/ui/gl/init/gl_initializer_mac.cc
@@ -226,6 +226,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
void ShutdownGLPlatform() {
ClearBindingsGL();
#if defined(USE_EGL)
+ GLSurfaceEGL::ShutdownOneOff();
ClearBindingsEGL();
#endif // defined(USE_EGL)
}
diff --git a/chromium/ui/gl/init/gl_initializer_ozone.cc b/chromium/ui/gl/init/gl_initializer_ozone.cc
index a94b6d4b7cb..aac4833f6c9 100644
--- a/chromium/ui/gl/init/gl_initializer_ozone.cc
+++ b/chromium/ui/gl/init/gl_initializer_ozone.cc
@@ -9,14 +9,28 @@
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_surface.h"
+
+#if defined(USE_OZONE)
#include "ui/gl/init/gl_display_egl_util_ozone.h"
#include "ui/gl/init/ozone_util.h"
#include "ui/ozone/public/ozone_platform.h"
+#endif
+
+#if defined(USE_X11)
+#include "ui/base/ui_base_features.h"
+#include "ui/gl/init/gl_initializer_linux_x11.h"
+#endif
namespace gl {
namespace init {
bool InitializeGLOneOffPlatform() {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::InitializeGLOneOffPlatformX11();
+#endif
+
+#if defined(USE_OZONE)
if (HasGLOzone()) {
gl::GLDisplayEglUtil::SetInstance(gl::GLDisplayEglUtilOzone::GetInstance());
return GetGLOzone()->InitializeGLOneOffPlatform();
@@ -29,10 +43,17 @@ bool InitializeGLOneOffPlatform() {
default:
NOTREACHED();
}
+#endif
return false;
}
bool InitializeStaticGLBindings(GLImplementation implementation) {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::InitializeStaticGLBindingsX11(implementation);
+#endif
+
+#if defined(USE_OZONE)
// Prevent reinitialization with a different implementation. Once the gpu
// unit tests have initialized with kGLImplementationMock, we don't want to
// later switch to another GL implementation.
@@ -52,17 +73,25 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
default:
NOTREACHED();
}
+#endif
return false;
}
void ShutdownGLPlatform() {
+#if defined(USE_X11)
+ if (!features::IsUsingOzonePlatform())
+ return gl::init::ShutdownGLPlatformX11();
+#endif
+
+#if defined(USE_OZONE)
if (HasGLOzone()) {
GetGLOzone()->ShutdownGL();
return;
}
ClearBindingsGL();
+#endif
}
} // namespace init