Chromium Code Reviews| Index: ui/gl/gl_surface_win.cc |
| diff --git a/ui/gl/gl_surface_win.cc b/ui/gl/gl_surface_win.cc |
| index 2219f32c0386efb8bc3a3bbc03f3dba9adce1ce1..3d033a4a23e5c5ff063f2d19b36aed8df8d9d6ac 100644 |
| --- a/ui/gl/gl_surface_win.cc |
| +++ b/ui/gl/gl_surface_win.cc |
| @@ -91,44 +91,37 @@ class WinVSyncProvider : public VSyncProvider { |
| if (gfx::FrameTime::TimestampsAreHighRes()) { |
| timebase = gfx::FrameTime::FromQPCValue( |
| static_cast<LONGLONG>(timing_info.qpcVBlank)); |
| - } |
| - |
| - // Swap the numerator/denominator to convert frequency to period. |
| - if (timing_info.rateRefresh.uiDenominator > 0 && |
| + interval = base::TimeDelta::FromQPCValue( |
| + static_cast<LONGLONG>(timing_info.qpcRefreshPeriod)); |
|
brianderson
2014/10/22 23:05:30
+tansell for fyi: Apparently qpcRefreshPeriod is a
|
| + } else if (timing_info.rateRefresh.uiDenominator > 0 && |
| timing_info.rateRefresh.uiNumerator > 0) { |
| + // Swap the numerator/denominator to convert frequency to period. |
|
brianderson
2014/10/22 23:05:30
Can you add some comments regarding why you don't
|
| interval = base::TimeDelta::FromMicroseconds( |
| timing_info.rateRefresh.uiDenominator * |
| base::Time::kMicrosecondsPerSecond / |
| timing_info.rateRefresh.uiNumerator); |
| } |
| } |
| - } |
| - |
| - // Double check DWM values against per-display refresh rates. |
| - // When DWM compositing is active all displays are normalized to the |
| - // refresh rate of the primary display, and won't composite any faster. |
| - // If the display refresh rate is higher than the DWM reported value we will |
| - // favor the DWM value because any additional frames produced will be |
| - // discarded by the OS. If the display refresh rate is lower, however, we |
| - // can use that to limit the frames we produce more intelligently. |
| - // If DWM compositing is not active we will always use the display refresh. |
| - HMONITOR monitor = MonitorFromWindow(window_, MONITOR_DEFAULTTONEAREST); |
| - MONITORINFOEX monitor_info; |
| - monitor_info.cbSize = sizeof(MONITORINFOEX); |
| - BOOL result = GetMonitorInfo(monitor, &monitor_info); |
| - if (result) { |
| - DEVMODE display_info; |
| - display_info.dmSize = sizeof(DEVMODE); |
| - display_info.dmDriverExtra = 0; |
| - result = EnumDisplaySettings(monitor_info.szDevice, ENUM_CURRENT_SETTINGS, |
| - &display_info); |
| - if (result && display_info.dmDisplayFrequency > 1) { |
| - base::TimeDelta display_interval = base::TimeDelta::FromMicroseconds( |
| - (1.0 / static_cast<double>(display_info.dmDisplayFrequency)) * |
| - base::Time::kMicrosecondsPerSecond); |
| - |
| - if (!dwm_active || display_interval > interval) { |
| - interval = display_interval; |
| + } else { |
| + // When DWM compositing is active all displays are normalized to the |
| + // refresh rate of the primary display, and won't composite any faster. |
| + // If DWM compositing is disabled, though, we can use the refresh rates |
| + // reported by each display, which will help systems that have mis-matched |
| + // displays that run at different frequencies. |
| + HMONITOR monitor = MonitorFromWindow(window_, MONITOR_DEFAULTTONEAREST); |
| + MONITORINFOEX monitor_info; |
| + monitor_info.cbSize = sizeof(MONITORINFOEX); |
| + BOOL result = GetMonitorInfo(monitor, &monitor_info); |
| + if (result) { |
| + DEVMODE display_info; |
| + display_info.dmSize = sizeof(DEVMODE); |
| + display_info.dmDriverExtra = 0; |
| + result = EnumDisplaySettings(monitor_info.szDevice, |
| + ENUM_CURRENT_SETTINGS, &display_info); |
| + if (result && display_info.dmDisplayFrequency > 1) { |
| + interval = base::TimeDelta::FromMicroseconds( |
| + (1.0 / static_cast<double>(display_info.dmDisplayFrequency)) * |
| + base::Time::kMicrosecondsPerSecond); |
| } |
| } |
| } |