| 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 #include <vector> |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
| 22 #include "ui/gfx/vsync_provider.h" | 22 #include "ui/gfx/vsync_provider.h" |
| 23 #include "ui/gl/gl_bindings.h" | 23 #include "ui/gl/gl_bindings.h" |
| 24 #include "ui/gl/gl_export.h" | 24 #include "ui/gl/gl_export.h" |
| 25 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
| 26 #include "ui/gl/gl_surface_overlay.h" | 26 #include "ui/gl/gl_surface_overlay.h" |
| 27 #include "ui/gl/sync_control_vsync_provider.h" |
| 27 | 28 |
| 28 namespace gl { | 29 namespace gl { |
| 29 | 30 |
| 30 // If adding a new type, also add it to EGLDisplayType in | 31 // If adding a new type, also add it to EGLDisplayType in |
| 31 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. | 32 // tools/metrics/histograms/histograms.xml. Don't remove or reorder entries. |
| 32 enum DisplayType { | 33 enum DisplayType { |
| 33 DEFAULT = 0, | 34 DEFAULT = 0, |
| 34 SWIFT_SHADER = 1, | 35 SWIFT_SHADER = 1, |
| 35 ANGLE_WARP = 2, | 36 ANGLE_WARP = 2, |
| 36 ANGLE_D3D9 = 3, | 37 ANGLE_D3D9 = 3, |
| 37 ANGLE_D3D11 = 4, | 38 ANGLE_D3D11 = 4, |
| 38 ANGLE_OPENGL = 5, | 39 ANGLE_OPENGL = 5, |
| 39 ANGLE_OPENGLES = 6, | 40 ANGLE_OPENGLES = 6, |
| 40 DISPLAY_TYPE_MAX = 7, | 41 DISPLAY_TYPE_MAX = 7, |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d, | 44 GL_EXPORT void GetEGLInitDisplays(bool supports_angle_d3d, |
| 44 bool supports_angle_opengl, | 45 bool supports_angle_opengl, |
| 45 const base::CommandLine* command_line, | 46 const base::CommandLine* command_line, |
| 46 std::vector<DisplayType>* init_displays); | 47 std::vector<DisplayType>* init_displays); |
| 47 | 48 |
| 49 // VSync provider for EGL surface; |
| 50 class GL_EXPORT EGLSyncControlVSyncProvider : public SyncControlVSyncProvider { |
| 51 public: |
| 52 explicit EGLSyncControlVSyncProvider(EGLSurface surface); |
| 53 ~EGLSyncControlVSyncProvider() override; |
| 54 |
| 55 protected: |
| 56 bool GetSyncValues(int64_t* system_time, |
| 57 int64_t* media_stream_counter, |
| 58 int64_t* swap_buffer_counter) override; |
| 59 |
| 60 bool GetMscRate(int32_t* numerator, int32_t* denominator) override; |
| 61 |
| 62 private: |
| 63 EGLSurface surface_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(EGLSyncControlVSyncProvider); |
| 66 }; |
| 67 |
| 48 // Interface for EGL surface. | 68 // Interface for EGL surface. |
| 49 class GL_EXPORT GLSurfaceEGL : public GLSurface { | 69 class GL_EXPORT GLSurfaceEGL : public GLSurface { |
| 50 public: | 70 public: |
| 51 GLSurfaceEGL(); | 71 GLSurfaceEGL(); |
| 52 | 72 |
| 53 // Implement GLSurface. | 73 // Implement GLSurface. |
| 54 EGLDisplay GetDisplay() override; | 74 EGLDisplay GetDisplay() override; |
| 55 EGLConfig GetConfig() override; | 75 EGLConfig GetConfig() override; |
| 56 GLSurface::Format GetFormat() override; | 76 GLSurface::Format GetFormat() override; |
| 57 | 77 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 ~SurfacelessEGL() override; | 234 ~SurfacelessEGL() override; |
| 215 | 235 |
| 216 private: | 236 private: |
| 217 gfx::Size size_; | 237 gfx::Size size_; |
| 218 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); | 238 DISALLOW_COPY_AND_ASSIGN(SurfacelessEGL); |
| 219 }; | 239 }; |
| 220 | 240 |
| 221 } // namespace gl | 241 } // namespace gl |
| 222 | 242 |
| 223 #endif // UI_GL_GL_SURFACE_EGL_H_ | 243 #endif // UI_GL_GL_SURFACE_EGL_H_ |
| OLD | NEW |