Open Bug 1771017 Opened 4 months ago Updated 4 months ago

layout.frame_rate > 0 works on wayland/linux only if widget.wayland.vsync.enabled is false

Categories

(Core :: Widget: Gtk, defect)

defect

Tracking

()

ASSIGNED

People

(Reporter: smaug, Assigned: mstange)

References

(Blocks 1 open bug)

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.)

Blocks: wayland

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

https://searchfox.org/mozilla-central/rev/c6620104602decf1af7c6a9f78692426db6a5da2/gfx/thebes/gfxPlatform.cpp#935-939

    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:

https://searchfox.org/mozilla-central/rev/c6620104602decf1af7c6a9f78692426db6a5da2/gfx/thebes/gfxPlatform.cpp#3059-3064

  // Swap out the dispatcher's underlying source.
  RefPtr<VsyncSource> vsyncSource =
      gfxPlatform::ForceSoftwareVsync()
          ? gPlatform->GetSoftwareVsyncSource()
          : gPlatform->GetGlobalHardwareVsyncSource();
  gPlatform->mVsyncDispatcher->SetVsyncSource(vsyncSource);

I can take this bug.

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED

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!

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.

It's global but it can be changed at runtime.

Oh, right, was missing that one.

You need to log in before you can comment on or make changes to this bug.