Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/gl/gl_surface_egl.cc

Issue 2696203004: Revert of "Route DXGI Frame Statistics to VSyncProvider" (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/sync_control_vsync_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
25 #include "ui/gl/angle_platform_impl.h" 25 #include "ui/gl/angle_platform_impl.h"
26 #include "ui/gl/egl_util.h" 26 #include "ui/gl/egl_util.h"
27 #include "ui/gl/gl_context.h" 27 #include "ui/gl/gl_context.h"
28 #include "ui/gl/gl_context_egl.h" 28 #include "ui/gl/gl_context_egl.h"
29 #include "ui/gl/gl_image.h" 29 #include "ui/gl/gl_image.h"
30 #include "ui/gl/gl_implementation.h" 30 #include "ui/gl/gl_implementation.h"
31 #include "ui/gl/gl_surface_stub.h" 31 #include "ui/gl/gl_surface_stub.h"
32 #include "ui/gl/gl_switches.h" 32 #include "ui/gl/gl_switches.h"
33 #include "ui/gl/scoped_make_current.h" 33 #include "ui/gl/scoped_make_current.h"
34 #include "ui/gl/sync_control_vsync_provider.h"
34 35
35 #if defined(USE_X11) && !defined(OS_CHROMEOS) 36 #if defined(USE_X11) && !defined(OS_CHROMEOS)
36 extern "C" { 37 extern "C" {
37 #include <X11/Xlib.h> 38 #include <X11/Xlib.h>
38 #define Status int 39 #define Status int
39 } 40 }
40 #include "ui/base/x/x11_util_internal.h" // nogncheck 41 #include "ui/base/x/x11_util_internal.h" // nogncheck
41 #endif 42 #endif
42 43
43 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const char* g_egl_extensions = nullptr; 130 const char* g_egl_extensions = nullptr;
130 bool g_egl_create_context_robustness_supported = false; 131 bool g_egl_create_context_robustness_supported = false;
131 bool g_egl_create_context_bind_generates_resource_supported = false; 132 bool g_egl_create_context_bind_generates_resource_supported = false;
132 bool g_egl_create_context_webgl_compatability_supported = false; 133 bool g_egl_create_context_webgl_compatability_supported = false;
133 bool g_egl_sync_control_supported = false; 134 bool g_egl_sync_control_supported = false;
134 bool g_egl_window_fixed_size_supported = false; 135 bool g_egl_window_fixed_size_supported = false;
135 bool g_egl_surfaceless_context_supported = false; 136 bool g_egl_surfaceless_context_supported = false;
136 bool g_egl_surface_orientation_supported = false; 137 bool g_egl_surface_orientation_supported = false;
137 bool g_use_direct_composition = false; 138 bool g_use_direct_composition = false;
138 139
140 class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider {
141 public:
142 explicit EGLSyncControlVSyncProvider(EGLSurface surface)
143 : SyncControlVSyncProvider(),
144 surface_(surface) {
145 }
146
147 ~EGLSyncControlVSyncProvider() override {}
148
149 protected:
150 bool GetSyncValues(int64_t* system_time,
151 int64_t* media_stream_counter,
152 int64_t* swap_buffer_counter) override {
153 uint64_t u_system_time, u_media_stream_counter, u_swap_buffer_counter;
154 bool result = eglGetSyncValuesCHROMIUM(
155 g_display, surface_, &u_system_time,
156 &u_media_stream_counter, &u_swap_buffer_counter) == EGL_TRUE;
157 if (result) {
158 *system_time = static_cast<int64_t>(u_system_time);
159 *media_stream_counter = static_cast<int64_t>(u_media_stream_counter);
160 *swap_buffer_counter = static_cast<int64_t>(u_swap_buffer_counter);
161 }
162 return result;
163 }
164
165 bool GetMscRate(int32_t* numerator, int32_t* denominator) override {
166 return false;
167 }
168
169 private:
170 EGLSurface surface_;
171
172 DISALLOW_COPY_AND_ASSIGN(EGLSyncControlVSyncProvider);
173 };
174
139 EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display, 175 EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
140 EGLenum platform_type, 176 EGLenum platform_type,
141 bool warpDevice) { 177 bool warpDevice) {
142 std::vector<EGLint> display_attribs; 178 std::vector<EGLint> display_attribs;
143 179
144 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE); 180 display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
145 display_attribs.push_back(platform_type); 181 display_attribs.push_back(platform_type);
146 182
147 if (warpDevice) { 183 if (warpDevice) {
148 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE); 184 display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 460 }
425 } 461 }
426 462
427 // If no displays are available due to missing angle extensions or invalid 463 // If no displays are available due to missing angle extensions or invalid
428 // flags, request the default display. 464 // flags, request the default display.
429 if (init_displays->empty()) { 465 if (init_displays->empty()) {
430 init_displays->push_back(DEFAULT); 466 init_displays->push_back(DEFAULT);
431 } 467 }
432 } 468 }
433 469
434 EGLSyncControlVSyncProvider::EGLSyncControlVSyncProvider(EGLSurface surface)
435 : SyncControlVSyncProvider(), surface_(surface) {}
436
437 EGLSyncControlVSyncProvider::~EGLSyncControlVSyncProvider() {}
438
439 bool EGLSyncControlVSyncProvider::GetSyncValues(int64_t* system_time,
440 int64_t* media_stream_counter,
441 int64_t* swap_buffer_counter) {
442 uint64_t u_system_time, u_media_stream_counter, u_swap_buffer_counter;
443 bool result = eglGetSyncValuesCHROMIUM(g_display, surface_, &u_system_time,
444 &u_media_stream_counter,
445 &u_swap_buffer_counter) == EGL_TRUE;
446 if (result) {
447 *system_time = static_cast<int64_t>(u_system_time);
448 *media_stream_counter = static_cast<int64_t>(u_media_stream_counter);
449 *swap_buffer_counter = static_cast<int64_t>(u_swap_buffer_counter);
450 }
451 return result;
452 }
453
454 bool EGLSyncControlVSyncProvider::GetMscRate(int32_t* numerator,
455 int32_t* denominator) {
456 return false;
457 }
458
459 GLSurfaceEGL::GLSurfaceEGL() {} 470 GLSurfaceEGL::GLSurfaceEGL() {}
460 471
461 GLSurfaceFormat GLSurfaceEGL::GetFormat() { 472 GLSurfaceFormat GLSurfaceEGL::GetFormat() {
462 return format_; 473 return format_;
463 } 474 }
464 475
465 EGLDisplay GLSurfaceEGL::GetDisplay() { 476 EGLDisplay GLSurfaceEGL::GetDisplay() {
466 return g_display; 477 return g_display;
467 } 478 }
468 479
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1227 }
1217 1228
1218 void* SurfacelessEGL::GetShareHandle() { 1229 void* SurfacelessEGL::GetShareHandle() {
1219 return NULL; 1230 return NULL;
1220 } 1231 }
1221 1232
1222 SurfacelessEGL::~SurfacelessEGL() { 1233 SurfacelessEGL::~SurfacelessEGL() {
1223 } 1234 }
1224 1235
1225 } // namespace gl 1236 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/sync_control_vsync_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698