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