layout.frame_rate > 0 works on wayland/linux only if widget.wayland.vsync.enabled is false
Categories
(Core :: Widget: Gtk, defect, P3)
Tracking
()
People
(Reporter: smaug, Assigned: mstange)
References
(Blocks 2 open bugs)
Details
I was trying to play with high refresh rates (in order to fix some issues in idle handling) but looks like the pref layout.frame_rate doesn't quite work on linux. Had to figure out that
widget.wayland.vsync.enabled needs to be false.
Seems like we just always use WaylandVsync*
https://searchfox.org/mozilla-central/rev/c6620104602decf1af7c6a9f78692426db6a5da2/widget/gtk/nsWindow.cpp#5913-5914
layout.frame_rate == 0 is special and handled as Asap mode in RefreshDriver.
http://mozilla.pettay.fi/moztests/raf.html is my simple test.
(need to be super simple for the very high rates so that painting doesn't end up taking too much time.)
Assignee | ||
Comment 1•1 year ago
|
||
That's right. To support this properly, the wayland implementation needs to have the equivalents of these two pieces of code from gfxPlatform.cpp:
#1: Initialize the vsync dispatcher with the software vsync source if gfxPlatform::ForceSoftwareVsync()
is true
RefPtr<VsyncSource> vsyncSource =
gfxPlatform::ForceSoftwareVsync()
? gPlatform->GetSoftwareVsyncSource()
: gPlatform->GetGlobalHardwareVsyncSource();
gPlatform->mVsyncDispatcher = new VsyncDispatcher(vsyncSource);
#2: Listen to the pref layout.frame_rate and update the vsync dispatcher when it changes:
// Swap out the dispatcher's underlying source.
RefPtr<VsyncSource> vsyncSource =
gfxPlatform::ForceSoftwareVsync()
? gPlatform->GetSoftwareVsyncSource()
: gPlatform->GetGlobalHardwareVsyncSource();
gPlatform->mVsyncDispatcher->SetVsyncSource(vsyncSource);
Assignee | ||
Comment 2•1 year ago
|
||
I can take this bug.
Comment 3•1 year ago
|
||
That's right. To support this properly, the wayland implementation needs to have the equivalents of these two pieces of code from gfxPlatform.cpp:
Alternatively we could disable the Wayland vsync source, falling back to the global software one, in https://searchfox.org/mozilla-central/source/widget/gtk/nsWindow.cpp#6223. IIUC layout.frame_rate
is global, so no need for a per-widget source.
I can take this bug.
Thanks!
Assignee | ||
Comment 4•1 year ago
|
||
It's global but it can be changed at runtime. And other things own the VsyncDispatcher permanently and don't expect it to change, for example VsyncParent. So for this to work properly we need to have a per-widget VsyncDispatcher which stays constant for that widget, and only swap out its vsync source.
Comment 5•1 year ago
|
||
It's global but it can be changed at runtime.
Oh, right, was missing that one.
Updated•2 months ago
|
Description
•