| Index: ui/gl/init/gl_factory_ozone.cc
|
| diff --git a/ui/gl/init/gl_factory_ozone.cc b/ui/gl/init/gl_factory_ozone.cc
|
| index ca5334707356cade0ecd5d16c21c65cfe6388f12..af7a40dce35935456b021ccee6868939cad459ad 100644
|
| --- a/ui/gl/init/gl_factory_ozone.cc
|
| +++ b/ui/gl/init/gl_factory_ozone.cc
|
| @@ -17,6 +17,7 @@
|
| #include "ui/gl/gl_surface_egl.h"
|
| #include "ui/gl/gl_surface_osmesa.h"
|
| #include "ui/gl/gl_surface_stub.h"
|
| +#include "ui/gl/init/ozone_util.h"
|
| #include "ui/ozone/public/ozone_platform.h"
|
| #include "ui/ozone/public/surface_factory_ozone.h"
|
|
|
| @@ -25,10 +26,6 @@ namespace init {
|
|
|
| namespace {
|
|
|
| -ui::SurfaceFactoryOzone* GetSurfaceFactory() {
|
| - return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
|
| -}
|
| -
|
| bool HasDefaultImplementation(GLImplementation impl) {
|
| return impl == kGLImplementationOSMesaGL || impl == kGLImplementationMockGL;
|
| }
|
| @@ -63,13 +60,16 @@ scoped_refptr<GLSurface> CreateDefaultOffscreenGLSurface(
|
| } // namespace
|
|
|
| std::vector<GLImplementation> GetAllowedGLImplementations() {
|
| - std::vector<GLImplementation> impls;
|
| - impls.push_back(kGLImplementationEGLGLES2);
|
| - impls.push_back(kGLImplementationOSMesaGL);
|
| - return impls;
|
| + ui::OzonePlatform::InitializeForGPU();
|
| + return GetSurfaceFactoryOzone()->GetAllowedGLImplementations();
|
| }
|
|
|
| bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
|
| + if (HasGLOzone())
|
| + return GetGLOzone()->GetGLWindowSystemBindingInfo(info);
|
| +
|
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone
|
| + // platforms use GLOzone instead.
|
| switch (GetGLImplementation()) {
|
| case kGLImplementationEGLGLES2:
|
| return GetGLWindowSystemBindingInfoEGL(info);
|
| @@ -82,6 +82,12 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
|
| GLSurface* compatible_surface,
|
| GpuPreference gpu_preference) {
|
| TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
|
| +
|
| + if (HasGLOzone()) {
|
| + return GetGLOzone()->CreateGLContext(share_group, compatible_surface,
|
| + gpu_preference);
|
| + }
|
| +
|
| switch (GetGLImplementation()) {
|
| case kGLImplementationMockGL:
|
| return scoped_refptr<GLContext>(new GLContextStub(share_group));
|
| @@ -100,29 +106,44 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
|
| scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
|
| TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
|
|
|
| + if (HasGLOzone())
|
| + return GetGLOzone()->CreateViewGLSurface(window);
|
| +
|
| if (HasDefaultImplementation(GetGLImplementation()))
|
| return CreateDefaultViewGLSurface(window);
|
|
|
| - return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(),
|
| - window);
|
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone
|
| + // platforms use GLOzone instead.
|
| + return GetSurfaceFactoryOzone()->CreateViewGLSurface(GetGLImplementation(),
|
| + window);
|
| }
|
|
|
| scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
|
| gfx::AcceleratedWidget window) {
|
| TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
|
|
|
| - return GetSurfaceFactory()->CreateSurfacelessViewGLSurface(
|
| + if (HasGLOzone())
|
| + return GetGLOzone()->CreateSurfacelessViewGLSurface(window);
|
| +
|
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone
|
| + // platforms use GLOzone instead.
|
| + return GetSurfaceFactoryOzone()->CreateSurfacelessViewGLSurface(
|
| GetGLImplementation(), window);
|
| }
|
|
|
| scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
|
| TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
|
|
|
| + if (HasGLOzone())
|
| + return GetGLOzone()->CreateOffscreenGLSurface(size);
|
| +
|
| if (HasDefaultImplementation(GetGLImplementation()))
|
| return CreateDefaultOffscreenGLSurface(size);
|
|
|
| - return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(),
|
| - size);
|
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone
|
| + // platforms use GLOzone instead.
|
| + return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface(
|
| + GetGLImplementation(), size);
|
| }
|
|
|
| } // namespace init
|
|
|