Chromium Code Reviews| 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..acb8e235fd7ee6b00b37f3fc2f6bf1b3f59538f5 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(); |
|
rjkroege
2016/08/26 19:55:53
in my opinion, this is not the right place to init
kylechar
2016/08/29 15:38:14
I'm not the biggest fan of this either but this is
rjkroege
2016/08/30 18:47:31
in the startup code of the gpu thread. like it was
|
| + return GetSurfaceFactory()->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,9 +106,14 @@ 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); |
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone |
| + // platforms use GLOzone instead. |
| return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(), |
| window); |
| } |
| @@ -111,6 +122,11 @@ scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( |
| gfx::AcceleratedWidget window) { |
| TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface"); |
| + if (HasGLOzone()) |
| + return GetGLOzone()->CreateSurfacelessViewGLSurface(window); |
| + |
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone |
| + // platforms use GLOzone instead. |
| return GetSurfaceFactory()->CreateSurfacelessViewGLSurface( |
| GetGLImplementation(), window); |
| } |
| @@ -118,9 +134,14 @@ scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( |
| 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); |
| + // TODO(kylechar): This is deprecated and can be removed once all Ozone |
| + // platforms use GLOzone instead. |
| return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(), |
| size); |
| } |