OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/ozone/surface_factory_ozone.h" | 10 #include "ui/gfx/ozone/surface_factory_ozone.h" |
11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
12 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
13 #include "ui/gl/gl_surface_osmesa.h" | 13 #include "ui/gl/gl_surface_osmesa.h" |
14 #include "ui/gl/gl_surface_stub.h" | 14 #include "ui/gl/gl_surface_stub.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 // static | 18 // static |
19 bool GLSurface::InitializeOneOffInternal() { | 19 bool GLSurface::InitializeOneOffInternal() { |
20 if (gfx::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != | |
21 gfx::SurfaceFactoryOzone::INITIALIZED) { | |
22 LOG(ERROR) << "Ozone failed to initialize hardware"; | |
23 return false; | |
24 } | |
25 | |
26 switch (GetGLImplementation()) { | 20 switch (GetGLImplementation()) { |
27 case kGLImplementationEGLGLES2: | 21 case kGLImplementationEGLGLES2: |
22 if (gfx::SurfaceFactoryOzone::GetInstance()->InitializeHardware() != | |
23 gfx::SurfaceFactoryOzone::INITIALIZED) { | |
24 LOG(ERROR) << "Ozone failed to initialize hardware"; | |
25 return false; | |
26 } | |
27 | |
28 if (!GLSurfaceEGL::InitializeOneOff()) { | 28 if (!GLSurfaceEGL::InitializeOneOff()) { |
29 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | 29 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
30 return false; | 30 return false; |
31 } | 31 } |
32 default: | 32 default: |
33 break; | 33 break; |
piman
2014/03/28 19:57:38
actually, should we return false here?
dnicoara
2014/03/28 20:30:37
As is no since OSMesa uses this path and we need t
| |
34 } | 34 } |
35 return true; | 35 return true; |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
39 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 39 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
40 gfx::AcceleratedWidget window) { | 40 gfx::AcceleratedWidget window) { |
41 if (GetGLImplementation() == kGLImplementationOSMesaGL) { | 41 if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
42 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); | 42 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); |
43 if (!surface->Initialize()) | 43 if (!surface->Initialize()) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 NOTREACHED(); | 91 NOTREACHED(); |
92 return NULL; | 92 return NULL; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 96 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
97 return SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 97 return SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
98 } | 98 } |
99 | 99 |
100 } // namespace gfx | 100 } // namespace gfx |
OLD | NEW |