Skip to content

Pace Firefox frames with its own 60 Hz clock - #247

Open
brkosebay wants to merge 1 commit into
OrchardLinux:mainfrom
brkosebay:submit/firefox-own-vsync
Open

brkosebay wants to merge 1 commit into
OrchardLinux:mainfrom
brkosebay:submit/firefox-own-vsync

Conversation

@brkosebay

Copy link
Copy Markdown
Contributor

Firefox takes its frame clock from Wayland frame callbacks by default. Each frame then has to be painted, rendered, submitted and committed within one display frame of the last callback, or the compositor shows nothing new and the next callback comes a frame later. On slower boards Firefox misses that window about one frame in four, though neither the GPU nor the CPU is busy.

This sets widget.wayland.vsync.enabled to false in our Firefox defaults, for every session. Firefox then paces itself with its own 60 Hz clock and the compositor shows the newest frame each refresh. It is a defaultPref, so users can still change it.

Measured on the iPad 5 (A9, Labwc), YouTube 1080p60 in a window, Firefox's own frame counters, two runs per arm:

frames shown/s dropped/s Firefox CPU GPU busy
frame callbacks (now) 43.6, 43.7 16.3, 16.2 56 % 577 ms/s
own clock (this change, via firefox.cfg) 57.3, 57.1, 57.4 2.7, 2.8, 2.5 59 % 570 ms/s

The video decoder delivered all 60 frames per second in every run; 720p60 dropped the same 16 frames per second as 1080p60, so the loss is pacing, not decode or fill rate.

How to test

  1. Install the package, open Firefox (a new start reads the defaults), and check about:config shows widget.wayland.vsync.enabled = false.
  2. Play a 60 fps YouTube video in a window (for example LXb3EKWsInQ, 1080p60). Right-click → Stats for nerds: dropped frames should stay at a few percent instead of about a quarter.
  3. A10 (iPad 7) and the other boards: same steps; the change is not board-specific. Scrolling and animations should be at least as smooth as before.

Assisted-by: LLM

🤖 Generated with Claude Code

With Wayland frame callbacks as its clock, Firefox has to render, submit and
commit each frame within one display frame of the last callback, or Labwc
skips it until the next one. On the iPad 5 a 60 fps YouTube video showed 44
frames a second and dropped 16 that way, at 1080p and 720p alike, with the
GPU and the CPU far from busy. With Firefox's own clock it renders whenever
the next frame is due and Labwc shows the newest one: 57 frames a second,
3 dropped, for the same GPU and CPU time.

Assisted-by: LLM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant