Closed Bug 1704290 Opened 3 years ago Closed 3 years ago

[Wayland] VSync loop does not pause when the browser is idle


(Core :: Widget: Gtk, enhancement, P3)




Tracking Status
firefox89 --- affected


(Reporter: val, Unassigned)


(Blocks 1 open bug)


When nothing is changing in the browser with widget.wayland_vsync.enabled=false, there are no wayland events happening at all.

With widget.wayland_vsync.enabled=true, even when nothing is happening and the browser is unfocused, WAYLAND_DEBUG=1 still spams this over and over again:

[921493.920] wl_callback@58.done(11425277)
[921493.924]  -> wl_surface@55.set_buffer_scale(2)
[921493.926]  -> wl_surface@55.frame(new id wl_callback@58)
[921493.928]  -> wl_surface@55.commit()
[921510.596] wl_display@1.delete_id(58)

It would be nice to not waste any CPU time on requesting and processing these frame callbacks when no new frames are being rendered and the browser is completely idle.
(Also no need to set_buffer_scale when not even sending a new buffer…)

Blocks: wayland

Robert, you solved something similar in Mutter right?

Flags: needinfo?(robert.mader)
Priority: -- → P3

A bit of context here: the FF vsync infrastructure is optimized for classical buffer swap events like we have on other platforms, including X11. So whenever FF may want to draw in the future, it enables the vsync source, assuming it just passively listens to those events. If nothing happens for a short while, it should disable the vsync source again until it needs it again.

I just checked again using WAYLAND_DEBUG=1 firefox and things work as expected on nightly+gnome - frame callbacks are requested more often than on some other Wayland apps, but still stop being requested when really being idle. Greg, can you confirm that? Because if you see continues frame request, then there's a bug somewhere.

So get optimal behaviour, we'd need to implement bug 1563075, which would change the architecture to be more Wayland friendly, but that's a big undertaking with relatively little gain AFAICS.

Concerning the scale part: that's something we should indeed fix - we only need to set it when something changed.

Flags: needinfo?(robert.mader)
See Also: → 1563075

see above

Flags: needinfo?(greg)

Hm, it actually does stop most of the time now. I guess let's close in favor of bug 1563075.

Closed: 3 years ago
Flags: needinfo?(greg)
Resolution: --- → DUPLICATE

Bug 1707226 fixed the buffer scale issue.

See Also: → 1707226
You need to log in before you can comment on or make changes to this bug.