Switch to using WaitForVBlank for vsync on Windows
Categories
(Core :: Graphics, enhancement, P3)
Tracking
()
People
(Reporter: jrmuizel, Assigned: bpeers)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
(deleted),
text/html
|
Details | |
(deleted),
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details |
(deleted),
text/html
|
Details |
It seems like using DWMFlush causes us to wait for the DWM to finish it's work before starting any of ours.
Chrome has started using WaitForVBlank and there's a thread here with piles of info:
https://bugs.chromium.org/p/chromium/issues/detail?id=953970
See also the complaints here: https://www.vsynctester.com/firefoxisbroken.html
Reporter | ||
Comment 1•5 years ago
|
||
Switching to WaitForVBlank can buy us 1ms+ of frame budget which can be really important on lower end machines.
Reporter | ||
Comment 2•5 years ago
|
||
We originally ran into problems with WaitForVBlank acquiring a process wide lock but it seems like those problems were limited to Win7.
From https://bugs.chromium.org/p/chromium/issues/detail?id=953970:
"1. Use WaitForVBlank in Win8+ only, there is a process wide lock in Win7 there prevents other DX from running in the process if you call WaitForVBlank."
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
This seems to work without issues on my dual monitor setup, and substantially reduces the instability in the frame-to-frame delay as measured via QueryPerformanceCounter
: from a full millisecond above or below the 16.66 we want, to less than 0.2ms of wobble. Both the peaks and the general variation seems improved.
I haven't tested yet what happens during sleep, monitor time-out, laptop close, etc. I've attached the patch will all the timing scaffolding as part of it. I could take it all out and make a proper review if we think this is enough?
There's also a bit in there where I simply assign vsync = now
when using VBlank, and that seems to drop the blue/purple lines on vsynctester.com by about 2ms; not entirely sure what that means but it sounds like a good thing? :)
Reporter | ||
Comment 4•5 years ago
|
||
It would probably be good to make this controllable via a pref. That way we can get it in early and have people easily change it if they run into problems.
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Comment 6•5 years ago
|
||
Intel HD630 @_@
Comment 8•5 years ago
|
||
bugherder |
Reporter | ||
Comment 9•5 years ago
|
||
I had a look at a new gpuview trace with this change it looks like it has the benefit that we're looking for. We start doing work ~1ms earlier.
Reporter | ||
Comment 10•5 years ago
|
||
Comment on attachment 9139642 [details]
Bug 1628137 - Switch to using WaitForVBlank for vsync on Windows
Beta/Release Uplift Approval Request
- User impact if declined: This relatively simple change has shown a substantial performance improvement in a number of situations that we've tested. We'd like to get it out as soon as possible.
This change doesn't actually enable the new vsync method (it's behind a pref) but will enable wider testing.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): There should be no behaviour change because the code is behind a pref.
- String changes made/needed:
Updated•5 years ago
|
Assignee | ||
Comment 11•5 years ago
|
||
Enable by default on Windows 10, unless force disabled by pref.
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Comment on attachment 9139642 [details]
Bug 1628137 - Switch to using WaitForVBlank for vsync on Windows
Lands this new functionality between an off-by-default pref for wider opt-in testing. Approved for 76.0b5.
Comment 13•5 years ago
|
||
bugherder uplift |
Description
•