| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); | 164 g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); |
| 165 g_egl_create_context_robustness_supported = | 165 g_egl_create_context_robustness_supported = |
| 166 HasEGLExtension("EGL_EXT_create_context_robustness"); | 166 HasEGLExtension("EGL_EXT_create_context_robustness"); |
| 167 g_egl_sync_control_supported = | 167 g_egl_sync_control_supported = |
| 168 HasEGLExtension("EGL_CHROMIUM_sync_control"); | 168 HasEGLExtension("EGL_CHROMIUM_sync_control"); |
| 169 g_egl_window_fixed_size_supported = | 169 g_egl_window_fixed_size_supported = |
| 170 HasEGLExtension("EGL_ANGLE_window_fixed_size"); | 170 HasEGLExtension("EGL_ANGLE_window_fixed_size"); |
| 171 | 171 |
| 172 // TODO(oetuaho@nvidia.com): Surfaceless is disabled on Android as a temporary |
| 173 // workaround, since code written for Android WebView takes different paths |
| 174 // based on whether GL surface objects have underlying EGL surface handles, |
| 175 // conflicting with the use of surfaceless. See https://crbug.com/382349 |
| 176 #if defined(OS_ANDROID) |
| 177 DCHECK(!g_egl_surfaceless_context_supported); |
| 178 #else |
| 172 // Check if SurfacelessEGL is supported. | 179 // Check if SurfacelessEGL is supported. |
| 173 g_egl_surfaceless_context_supported = | 180 g_egl_surfaceless_context_supported = |
| 174 HasEGLExtension("EGL_KHR_surfaceless_context"); | 181 HasEGLExtension("EGL_KHR_surfaceless_context"); |
| 175 if (g_egl_surfaceless_context_supported) { | 182 if (g_egl_surfaceless_context_supported) { |
| 176 // EGL_KHR_surfaceless_context is supported but ensure | 183 // EGL_KHR_surfaceless_context is supported but ensure |
| 177 // GL_OES_surfaceless_context is also supported. We need a current context | 184 // GL_OES_surfaceless_context is also supported. We need a current context |
| 178 // to query for supported GL extensions. | 185 // to query for supported GL extensions. |
| 179 scoped_refptr<GLSurface> surface = new SurfacelessEGL(Size(1, 1)); | 186 scoped_refptr<GLSurface> surface = new SurfacelessEGL(Size(1, 1)); |
| 180 scoped_refptr<GLContext> context = GLContext::CreateGLContext( | 187 scoped_refptr<GLContext> context = GLContext::CreateGLContext( |
| 181 NULL, surface.get(), PreferIntegratedGpu); | 188 NULL, surface.get(), PreferIntegratedGpu); |
| 182 if (!context->MakeCurrent(surface.get())) | 189 if (!context->MakeCurrent(surface.get())) |
| 183 g_egl_surfaceless_context_supported = false; | 190 g_egl_surfaceless_context_supported = false; |
| 184 | 191 |
| 185 // Ensure context supports GL_OES_surfaceless_context. | 192 // Ensure context supports GL_OES_surfaceless_context. |
| 186 if (g_egl_surfaceless_context_supported) { | 193 if (g_egl_surfaceless_context_supported) { |
| 187 g_egl_surfaceless_context_supported = context->HasExtension( | 194 g_egl_surfaceless_context_supported = context->HasExtension( |
| 188 "GL_OES_surfaceless_context"); | 195 "GL_OES_surfaceless_context"); |
| 189 context->ReleaseCurrent(surface.get()); | 196 context->ReleaseCurrent(surface.get()); |
| 190 } | 197 } |
| 191 } | 198 } |
| 199 #endif |
| 192 | 200 |
| 193 initialized = true; | 201 initialized = true; |
| 194 | 202 |
| 195 return true; | 203 return true; |
| 196 } | 204 } |
| 197 | 205 |
| 198 EGLDisplay GLSurfaceEGL::GetDisplay() { | 206 EGLDisplay GLSurfaceEGL::GetDisplay() { |
| 199 return g_display; | 207 return g_display; |
| 200 } | 208 } |
| 201 | 209 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 } | 657 } |
| 650 | 658 |
| 651 void* SurfacelessEGL::GetShareHandle() { | 659 void* SurfacelessEGL::GetShareHandle() { |
| 652 return NULL; | 660 return NULL; |
| 653 } | 661 } |
| 654 | 662 |
| 655 SurfacelessEGL::~SurfacelessEGL() { | 663 SurfacelessEGL::~SurfacelessEGL() { |
| 656 } | 664 } |
| 657 | 665 |
| 658 } // namespace gfx | 666 } // namespace gfx |
| OLD | NEW |