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

Side by Side Diff: ui/gl/sync_control_vsync_provider.h

Issue 2767293002: More reliable check for whether EGLSyncControlVSyncProvider should be instantiated. (Closed)
Patch Set: Created 3 years, 9 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.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SYNC_CONTROL_VSYNC_PROVIDER_H_ 5 #ifndef UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_
6 #define UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ 6 #define UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "ui/gfx/vsync_provider.h" 13 #include "ui/gfx/vsync_provider.h"
14 14
15 namespace gl { 15 namespace gl {
16 16
17 // Base class for providers based on extensions like GLX_OML_sync_control and 17 // Base class for providers based on extensions like GLX_OML_sync_control and
18 // EGL_CHROMIUM_sync_control. 18 // EGL_CHROMIUM_sync_control.
19 class SyncControlVSyncProvider : public gfx::VSyncProvider { 19 class SyncControlVSyncProvider : public gfx::VSyncProvider {
20 public: 20 public:
21 SyncControlVSyncProvider(); 21 SyncControlVSyncProvider();
22 ~SyncControlVSyncProvider() override; 22 ~SyncControlVSyncProvider() override;
23 23
24 void GetVSyncParameters(const UpdateVSyncCallback& callback) override; 24 void GetVSyncParameters(const UpdateVSyncCallback& callback) override;
25 25
26 static constexpr bool IsSupported() {
27 #if defined(OS_LINUX)
28 return true;
29 #else
30 return false;
31 #endif // defined(OS_LINUX)
32 }
33
26 protected: 34 protected:
27 virtual bool GetSyncValues(int64_t* system_time, 35 virtual bool GetSyncValues(int64_t* system_time,
28 int64_t* media_stream_counter, 36 int64_t* media_stream_counter,
29 int64_t* swap_buffer_counter) = 0; 37 int64_t* swap_buffer_counter) = 0;
30 38
31 virtual bool GetMscRate(int32_t* numerator, int32_t* denominator) = 0; 39 virtual bool GetMscRate(int32_t* numerator, int32_t* denominator) = 0;
32 40
33 private: 41 private:
34 #if defined(OS_LINUX) 42 #if defined(OS_LINUX)
35 base::TimeTicks last_timebase_; 43 base::TimeTicks last_timebase_;
36 uint64_t last_media_stream_counter_ = 0; 44 uint64_t last_media_stream_counter_ = 0;
37 base::TimeDelta last_good_interval_; 45 base::TimeDelta last_good_interval_;
38 bool invalid_msc_ = false; 46 bool invalid_msc_ = false;
39 47
40 // A short history of the last few computed intervals. 48 // A short history of the last few computed intervals.
41 // We use this to filter out the noise in the computation resulting 49 // We use this to filter out the noise in the computation resulting
42 // from configuration change (monitor reconfiguration, moving windows 50 // from configuration change (monitor reconfiguration, moving windows
43 // between monitors, suspend and resume, etc.). 51 // between monitors, suspend and resume, etc.).
44 std::queue<base::TimeDelta> last_computed_intervals_; 52 std::queue<base::TimeDelta> last_computed_intervals_;
45 #endif // defined(OS_LINUX) 53 #endif // defined(OS_LINUX)
46 54
47 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider); 55 DISALLOW_COPY_AND_ASSIGN(SyncControlVSyncProvider);
48 }; 56 };
49 57
50 } // namespace gl 58 } // namespace gl
51 59
52 #endif // UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_ 60 #endif // UI_GL_SYNC_CONTROL_VSYNC_PROVIDER_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698