mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1295214. Correct for negative vsync timestamps on windows. r=jrmuizel
This commit is contained in:
parent
d755533d9f
commit
b4272bd4ed
@ -1816,16 +1816,22 @@ public:
|
||||
// In these error cases, normalize to Now();
|
||||
if (vsync >= now) {
|
||||
vsync = vsync - mVsyncRate;
|
||||
return vsync <= now ? vsync : now;
|
||||
}
|
||||
}
|
||||
|
||||
// On Windows 7 and 8, DwmFlush wakes up AFTER qpcVBlankTime
|
||||
// from DWMGetCompositionTimingInfo. We can return the adjusted vsync.
|
||||
// If we got here on Windows 10, it means we got a weird timestamp.
|
||||
if (vsync >= now) {
|
||||
vsync = now;
|
||||
}
|
||||
|
||||
// Our vsync time is some time very far in the past, adjust to Now.
|
||||
// 4 ms is arbitrary, so feel free to pick something else if this isn't
|
||||
// working. See the comment above within IsWin10OrLater().
|
||||
if ((now - vsync).ToMilliseconds() > 4.0) {
|
||||
vsync = now;
|
||||
}
|
||||
|
||||
return vsync;
|
||||
}
|
||||
|
||||
@ -1891,6 +1897,12 @@ public:
|
||||
vsync = TimeStamp::Now();
|
||||
}
|
||||
|
||||
if ((now - vsync).ToMilliseconds() > 2.0) {
|
||||
// Account for time drift here where vsync never quite catches up to
|
||||
// Now and we'd fall ever so slightly further behind Now().
|
||||
vsync = GetVBlankTime();
|
||||
}
|
||||
|
||||
mPrevVsync = vsync;
|
||||
}
|
||||
} // end for
|
||||
|
Loading…
Reference in New Issue
Block a user