| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <EGL/egl.h> | |
| 8 | |
| 9 #include "base/logging.h" | 7 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/base/linux/native_surface_linux_factory.h" |
| 11 #include "ui/gl/egl_util.h" | 10 #include "ui/gl/egl_util.h" |
| 12 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
| 13 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
| 14 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
| 15 #include "ui/gl/gl_surface_egl.h" | 14 #include "ui/gl/gl_surface_egl.h" |
| 16 #include "ui/gl/gl_surface_stub.h" | 15 #include "ui/gl/gl_surface_stub.h" |
| 17 | 16 |
| 18 using ui::GetLastEGLErrorString; | 17 using ui::GetLastEGLErrorString; |
| 19 | 18 |
| 20 namespace gfx { | 19 namespace gfx { |
| 21 | 20 |
| 22 bool GLSurface::InitializeOneOffInternal() { | 21 bool GLSurface::InitializeOneOffInternal() { |
| 23 static bool initialized = false; | 22 static bool initialized = false; |
| 24 if (initialized) | 23 if (initialized) |
| 25 return true; | 24 return true; |
| 26 | 25 |
| 27 switch (GetGLImplementation()) { | 26 switch (GetGLImplementation()) { |
| 28 case kGLImplementationEGLGLES2: | 27 case kGLImplementationEGLGLES2: |
| 28 ui::NativeSurfaceLinuxFactory::GetInstance()->InitializeHardware(); |
| 29 if (!GLSurfaceEGL::InitializeOneOff()) { | 29 if (!GLSurfaceEGL::InitializeOneOff()) { |
| 30 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | 30 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
| 31 return false; | 31 return false; |
| 32 } | 32 } |
| 33 break; | 33 break; |
| 34 default: | 34 default: |
| 35 NOTREACHED(); | 35 NOTREACHED(); |
| 36 break; | 36 break; |
| 37 } | 37 } |
| 38 | 38 |
| 39 initialized = true; | 39 initialized = true; |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 |
| 42 // static | 43 // static |
| 43 scoped_refptr<GLSurface> | 44 scoped_refptr<GLSurface> |
| 44 GLSurface::CreateViewGLSurface(bool software, gfx::AcceleratedWidget window) { | 45 GLSurface::CreateViewGLSurface(bool software, gfx::AcceleratedWidget window) { |
| 45 if (software) | 46 if (software) |
| 46 return NULL; | 47 return NULL; |
| 47 | 48 |
| 48 switch (GetGLImplementation()) { | 49 switch (GetGLImplementation()) { |
| 49 case kGLImplementationEGLGLES2: { | 50 case kGLImplementationEGLGLES2: { |
| 50 scoped_refptr<GLSurface> surface; | 51 scoped_refptr<GLSurface> surface; |
| 51 if (window) | 52 if (window) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 76 return NULL; | 77 return NULL; |
| 77 return surface; | 78 return surface; |
| 78 } | 79 } |
| 79 default: | 80 default: |
| 80 NOTREACHED(); | 81 NOTREACHED(); |
| 81 return NULL; | 82 return NULL; |
| 82 } | 83 } |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace gfx | 86 } // namespace gfx |
| OLD | NEW |