OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "ui/gl/vsync_provider.h" | 5 #include "ui/gl/vsync_provider.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 int64 system_time; | 58 int64 system_time; |
59 int64 media_stream_counter; | 59 int64 media_stream_counter; |
60 int64 swap_buffer_counter; | 60 int64 swap_buffer_counter; |
61 if (!GetSyncValues(&system_time, | 61 if (!GetSyncValues(&system_time, |
62 &media_stream_counter, | 62 &media_stream_counter, |
63 &swap_buffer_counter)) | 63 &swap_buffer_counter)) |
64 return; | 64 return; |
65 | 65 |
66 // Both Intel and Mali drivers will return TRUE for GetSyncValues | 66 // Both Intel and Mali drivers will return TRUE for GetSyncValues |
67 // but a value of 0 for MSC if they cannot access the CRTC data structure | 67 // but a value of 0 for MSC if they cannot access the CRTC data structure |
68 // associated with the surfrace. | 68 // associated with the surfrace. crbug.com/231945 |
69 if (media_stream_counter == 0) | 69 if (media_stream_counter == 0) { |
| 70 LOG(ERROR) << "glXGetSyncValuesOML should not return TRUE with a " |
| 71 << "media stream counter of 0."; |
70 return; | 72 return; |
| 73 } |
71 | 74 |
72 struct timespec real_time; | 75 struct timespec real_time; |
73 struct timespec monotonic_time; | 76 struct timespec monotonic_time; |
74 clock_gettime(CLOCK_REALTIME, &real_time); | 77 clock_gettime(CLOCK_REALTIME, &real_time); |
75 clock_gettime(CLOCK_MONOTONIC, &monotonic_time); | 78 clock_gettime(CLOCK_MONOTONIC, &monotonic_time); |
76 | 79 |
77 int64 real_time_in_microseconds = | 80 int64 real_time_in_microseconds = |
78 real_time.tv_sec * base::Time::kMicrosecondsPerSecond + | 81 real_time.tv_sec * base::Time::kMicrosecondsPerSecond + |
79 real_time.tv_nsec / base::Time::kNanosecondsPerMicrosecond; | 82 real_time.tv_nsec / base::Time::kNanosecondsPerMicrosecond; |
80 int64 monotonic_time_in_microseconds = | 83 int64 monotonic_time_in_microseconds = |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 152 } |
150 } | 153 } |
151 | 154 |
152 last_timebase_ = timebase; | 155 last_timebase_ = timebase; |
153 last_media_stream_counter_ = media_stream_counter; | 156 last_media_stream_counter_ = media_stream_counter; |
154 callback.Run(timebase, last_good_interval_); | 157 callback.Run(timebase, last_good_interval_); |
155 #endif // defined(OS_LINUX) | 158 #endif // defined(OS_LINUX) |
156 } | 159 } |
157 | 160 |
158 } // namespace gfx | 161 } // namespace gfx |
OLD | NEW |