OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This include must be here so that the includes provided transitively | 5 // This include must be here so that the includes provided transitively |
6 // by gl_surface_egl.h don't make it impossible to compile this code. | 6 // by gl_surface_egl.h don't make it impossible to compile this code. |
7 #include "third_party/mesa/src/include/GL/osmesa.h" | 7 #include "third_party/mesa/src/include/GL/osmesa.h" |
8 | 8 |
9 #include "ui/gl/gl_surface_egl.h" | 9 #include "ui/gl/gl_surface_egl.h" |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 | 93 |
94 } // namespace | 94 } // namespace |
95 | 95 |
96 GLSurfaceEGL::GLSurfaceEGL() {} | 96 GLSurfaceEGL::GLSurfaceEGL() {} |
97 | 97 |
98 bool GLSurfaceEGL::InitializeOneOff() { | 98 bool GLSurfaceEGL::InitializeOneOff() { |
99 static bool initialized = false; | 99 static bool initialized = false; |
100 if (initialized) | 100 if (initialized) |
101 return true; | 101 return true; |
102 | 102 |
103 #if defined (USE_OZONE) | |
104 ui::SurfaceFactoryOzone::GetInstance()->InitializeHardware(); | |
105 #endif | |
106 | |
107 #if defined(USE_X11) | 103 #if defined(USE_X11) |
108 g_native_display = base::MessagePumpForUI::GetDefaultXDisplay(); | 104 g_native_display = base::MessagePumpForUI::GetDefaultXDisplay(); |
109 #elif defined(OS_WIN) | 105 #elif defined(OS_WIN) |
110 g_native_display = EGL_DEFAULT_DISPLAY; | 106 g_native_display = EGL_DEFAULT_DISPLAY; |
111 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) { | 107 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) { |
112 g_native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; | 108 g_native_display = EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; |
113 } | 109 } |
110 #elif defined(USE_OZONE) | |
111 ui::SurfaceFactoryOzone* surface_factory = | |
112 ui::SurfaceFactoryOzone::GetInstance(); | |
113 if (surface_factory->InitializeHardware() != | |
114 ui::SurfaceFactoryOzone::INITIALIZED) { | |
115 LOG(ERROR) << "OZONE failed to initialize hardware"; | |
116 return false; | |
117 } | |
118 g_native_display = reinterpret_cast<EGLNativeDisplayType>( | |
119 surface_factory->GetNativeDisplay()); | |
rjkroege
2013/08/30 15:26:04
it would be nice to have the stub GetNativeDisplay
| |
114 #else | 120 #else |
115 g_native_display = EGL_DEFAULT_DISPLAY; | 121 g_native_display = EGL_DEFAULT_DISPLAY; |
116 #endif | 122 #endif |
117 g_display = eglGetDisplay(g_native_display); | 123 g_display = eglGetDisplay(g_native_display); |
118 if (!g_display) { | 124 if (!g_display) { |
119 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); | 125 LOG(ERROR) << "eglGetDisplay failed with error " << GetLastEGLErrorString(); |
120 return false; | 126 return false; |
121 } | 127 } |
122 | 128 |
123 if (!eglInitialize(g_display, NULL, NULL)) { | 129 if (!eglInitialize(g_display, NULL, NULL)) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 } | 680 } |
675 default: | 681 default: |
676 NOTREACHED(); | 682 NOTREACHED(); |
677 return NULL; | 683 return NULL; |
678 } | 684 } |
679 } | 685 } |
680 | 686 |
681 #endif | 687 #endif |
682 | 688 |
683 } // namespace gfx | 689 } // namespace gfx |
OLD | NEW |