| 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 #ifndef UI_GL_GL_SURFACE_EGL_H_ | 5 #ifndef UI_GL_GL_SURFACE_EGL_H_ |
| 6 #define UI_GL_GL_SURFACE_EGL_H_ | 6 #define UI_GL_GL_SURFACE_EGL_H_ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
| 21 #include "ui/gfx/vsync_provider.h" | 22 #include "ui/gfx/vsync_provider.h" |
| 22 #include "ui/gl/gl_bindings.h" | 23 #include "ui/gl/gl_bindings.h" |
| 23 #include "ui/gl/gl_export.h" | 24 #include "ui/gl/gl_export.h" |
| 24 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
| 25 #include "ui/gl/gl_surface_overlay.h" | 26 #include "ui/gl/gl_surface_overlay.h" |
| 26 | 27 |
| 27 namespace gl { | 28 namespace gl { |
| 28 | 29 |
| 29 // Get default EGL display for GLSurfaceEGL (differs by platform). | |
| 30 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay(); | |
| 31 | |
| 32 // If adding a new type, also add it to EGLDisplayType in | 30 // If adding a new type, also add it to EGLDisplayType in |
| 33 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. | 31 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. |
| 34 enum DisplayType { | 32 enum DisplayType { |
| 35 DEFAULT = 0, | 33 DEFAULT = 0, |
| 36 SWIFT_SHADER = 1, | 34 SWIFT_SHADER = 1, |
| 37 ANGLE_WARP = 2, | 35 ANGLE_WARP = 2, |
| 38 ANGLE_D3D9 = 3, | 36 ANGLE_D3D9 = 3, |
| 39 ANGLE_D3D11 = 4, | 37 ANGLE_D3D11 = 4, |
| 40 ANGLE_OPENGL = 5, | 38 ANGLE_OPENGL = 5, |
| 41 ANGLE_OPENGLES = 6, | 39 ANGLE_OPENGLES = 6, |
| 42 DISPLAY_TYPE_MAX = 7, | 40 DISPLAY_TYPE_MAX = 7, |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d, | 43 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d, |
| 46 bool supports_angle_opengl, | 44 bool supports_angle_opengl, |
| 47 const base::CommandLine* command_line, | 45 const base::CommandLine* command_line, |
| 48 std::vector<DisplayType>* init_displays); | 46 std::vector<DisplayType>* init_displays); |
| 49 | 47 |
| 50 // Interface for EGL surface. | 48 // Interface for EGL surface. |
| 51 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 49 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
| 52 public: | 50 public: |
| 53 GLSurfaceEGL(); | 51 GLSurfaceEGL(); |
| 54 | 52 |
| 55 // Implement GLSurface. | 53 // Implement GLSurface. |
| 56 EGLDisplay GetDisplay() override; | 54 EGLDisplay GetDisplay() override; |
| 57 EGLConfig GetConfig() override; | 55 EGLConfig GetConfig() override; |
| 58 GLSurface::Format GetFormat() override; | 56 GLSurface::Format GetFormat() override; |
| 59 | 57 |
| 60 static bool InitializeOneOff(); | 58 static bool InitializeOneOff(EGLNativeDisplayType native_display); |
| 61 static EGLDisplay GetHardwareDisplay(); | 59 static EGLDisplay GetHardwareDisplay(); |
| 62 static EGLDisplay InitializeDisplay(); | 60 static EGLDisplay InitializeDisplay(EGLNativeDisplayType native_display); |
| 63 static EGLNativeDisplayType GetNativeDisplay(); | 61 static EGLNativeDisplayType GetNativeDisplay(); |
| 64 | 62 |
| 65 // These aren't particularly tied to surfaces, but since we already | 63 // These aren't particularly tied to surfaces, but since we already |
| 66 // have the static InitializeOneOff here, it's easiest to reuse its | 64 // have the static InitializeOneOff here, it's easiest to reuse its |
| 67 // initialization guards. | 65 // initialization guards. |
| 68 static const char* GetEGLExtensions(); | 66 static const char* GetEGLExtensions(); |
| 69 static bool HasEGLExtension(const char* name); | 67 static bool HasEGLExtension(const char* name); |
| 70 static bool IsCreateContextRobustnessSupported(); | 68 static bool IsCreateContextRobustnessSupported(); |
| 71 static bool IsEGLSurfacelessContextSupported(); | 69 static bool IsEGLSurfacelessContextSupported(); |
| 72 static bool IsDirectCompositionSupported(); | 70 static bool IsDirectCompositionSupported(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ~SurfacelessEGL() override; | 205 ~SurfacelessEGL() override; |
| 208 | 206 |
| 209 private: | 207 private: |
| 210 gfx::Size size_; | 208 gfx::Size size_; |
| 211 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 209 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
| 212 }; | 210 }; |
| 213 | 211 |
| 214 } // namespace gl | 212 } // namespace gl |
| 215 | 213 |
| 216 #endif // UI_GL_GL_SURFACE_EGL_H_ | 214 #endif // UI_GL_GL_SURFACE_EGL_H_ |
| OLD | NEW |