Bug 1233576. Ensure vsync timestamps are monotonic on Windows 10. r=kats a=sylvestre
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -2872,16 +2872,21 @@ public:
DWM_TIMING_INFO vblankTime;
// Make sure to init the cbSize, otherwise GetCompositionTiming will fail
vblankTime.cbSize = sizeof(DWM_TIMING_INFO);
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
TimeStamp vsync = TimeStamp::Now();
+ // On Windows 10, DwmGetCompositionInfo returns the upcoming vsync.
+ // See GetAdjustedVsyncTimestamp.
+ // On start, set mPrevVsync to the "next" vsync
+ // So we'll use this timestamp on the 2nd loop iteration.
+ mPrevVsync = vsync + mSoftwareVsyncRate;
for (;;) {
{ // scope lock
MonitorAutoLock lock(mVsyncEnabledLock);
if (!mVsyncEnabled) return;
}
// Large parts of gecko assume that the refresh driver timestamp