| 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 #include "ui/gl/gl_surface_egl.h" | 5 #include "ui/gl/gl_surface_egl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider { | 140 class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider { |
| 141 public: | 141 public: |
| 142 explicit EGLSyncControlVSyncProvider(EGLSurface surface) | 142 explicit EGLSyncControlVSyncProvider(EGLSurface surface) |
| 143 : SyncControlVSyncProvider(), | 143 : SyncControlVSyncProvider(), |
| 144 surface_(surface) { | 144 surface_(surface) { |
| 145 } | 145 } |
| 146 | 146 |
| 147 ~EGLSyncControlVSyncProvider() override {} | 147 ~EGLSyncControlVSyncProvider() override {} |
| 148 | 148 |
| 149 static bool IsSupported() { |
| 150 return SyncControlVSyncProvider::IsSupported() && |
| 151 g_egl_sync_control_supported; |
| 152 } |
| 153 |
| 149 protected: | 154 protected: |
| 150 bool GetSyncValues(int64_t* system_time, | 155 bool GetSyncValues(int64_t* system_time, |
| 151 int64_t* media_stream_counter, | 156 int64_t* media_stream_counter, |
| 152 int64_t* swap_buffer_counter) override { | 157 int64_t* swap_buffer_counter) override { |
| 153 uint64_t u_system_time, u_media_stream_counter, u_swap_buffer_counter; | 158 uint64_t u_system_time, u_media_stream_counter, u_swap_buffer_counter; |
| 154 bool result = eglGetSyncValuesCHROMIUM( | 159 bool result = eglGetSyncValuesCHROMIUM( |
| 155 g_display, surface_, &u_system_time, | 160 g_display, surface_, &u_system_time, |
| 156 &u_media_stream_counter, &u_swap_buffer_counter) == EGL_TRUE; | 161 &u_media_stream_counter, &u_swap_buffer_counter) == EGL_TRUE; |
| 157 if (result) { | 162 if (result) { |
| 158 *system_time = static_cast<int64_t>(u_system_time); | 163 *system_time = static_cast<int64_t>(u_system_time); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 EGLBoolean retVal = eglQuerySurface( | 806 EGLBoolean retVal = eglQuerySurface( |
| 802 GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal); | 807 GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal); |
| 803 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; | 808 supports_post_sub_buffer_ = (surfaceVal && retVal) == EGL_TRUE; |
| 804 } | 809 } |
| 805 | 810 |
| 806 supports_swap_buffer_with_damage_ = | 811 supports_swap_buffer_with_damage_ = |
| 807 g_driver_egl.ext.b_EGL_KHR_swap_buffers_with_damage; | 812 g_driver_egl.ext.b_EGL_KHR_swap_buffers_with_damage; |
| 808 | 813 |
| 809 if (sync_provider) | 814 if (sync_provider) |
| 810 vsync_provider_ = std::move(sync_provider); | 815 vsync_provider_ = std::move(sync_provider); |
| 811 else if (g_egl_sync_control_supported) | 816 else if (EGLSyncControlVSyncProvider::IsSupported()) |
| 812 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); | 817 vsync_provider_.reset(new EGLSyncControlVSyncProvider(surface_)); |
| 813 return true; | 818 return true; |
| 814 } | 819 } |
| 815 | 820 |
| 816 bool NativeViewGLSurfaceEGL::InitializeNativeWindow() { | 821 bool NativeViewGLSurfaceEGL::InitializeNativeWindow() { |
| 817 return true; | 822 return true; |
| 818 } | 823 } |
| 819 | 824 |
| 820 void NativeViewGLSurfaceEGL::Destroy() { | 825 void NativeViewGLSurfaceEGL::Destroy() { |
| 821 if (surface_) { | 826 if (surface_) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 } | 1250 } |
| 1246 | 1251 |
| 1247 void* SurfacelessEGL::GetShareHandle() { | 1252 void* SurfacelessEGL::GetShareHandle() { |
| 1248 return NULL; | 1253 return NULL; |
| 1249 } | 1254 } |
| 1250 | 1255 |
| 1251 SurfacelessEGL::~SurfacelessEGL() { | 1256 SurfacelessEGL::~SurfacelessEGL() { |
| 1252 } | 1257 } |
| 1253 | 1258 |
| 1254 } // namespace gl | 1259 } // namespace gl |
| OLD | NEW |