Open Bug 2052451 Opened 4 months ago Updated 1 month ago

[Wayland] Frame drops/stuttering on YouTube and WebGL with hybrid graphics (fixed by disabling vsync)

Categories

(Core :: Graphics: CanvasWebGL, defect)

Firefox 152
defect

Tracking

()

UNCONFIRMED

People

(Reporter: petrufagurel, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0

Steps to reproduce:

System Information:

OS: Ubuntu 26.04 LTS

Display Server: Wayland

GPU: Hybrid Intel / Nvidia RTX Blackwell 3000 PRO

Steps to reproduce:

Open Firefox on Wayland with default settings.

Play a YouTube video or run a WebGL browser game.

Go to about:config and set widget.wayland.vsync.enabled to false. Restart Firefox.

Play the same video/game. 

BROKEN (V-Sync TRUE, dropping frames): https://share.firefox.dev/4y73HIE

SEMI-WORKING (V-Sync FALSE, fewer dropped frames): https://share.firefox.dev/4v87y5i

Actual results:

With vsync enabled : stuttering, dropped frames, and lag.

Expected results:

Without v-sync enabled: the stuttering is reduced(not completely).
On Ubuntu 26.04 with Chromium frames are still dropped at the same pace as Firefox with v-sync disabled.
On the same laptop on Windows 11, no frames dropped are present.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: CanvasWebGL' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: CanvasWebGL
Product: Firefox → Core

Any thoughts on this? I haven't looked into the vsync code for Wayland, I'm familiar with vsync code for Windows so I know some of the problem space but not the specifics here.

Flags: needinfo?(stransky)

Please run on terminal with MOZ_LOG="WidgetVSync:5" env variable and check the fps reported - it should roughly match the screen fps.
You may also try VSync tester - https://www.vsynctester.com/

Flags: needinfo?(stransky) → needinfo?(petrufagurel)
Blocks: wayland
Severity: -- → S3
Attached file firefox_vsync_log.txt —
Flags: needinfo?(petrufagurel)

Hello,

I have recorded in a file using MOZ_LOG="WidgetVSync:5". It records everything, even static pages. This file is in the attachments. On Youtube the video recorded is https://youtu.be/1La4QzGeaaQ?si=_fTegYOZVN2F_SPm at 4K 60fps.

Attachment #9604768 - Flags: review+

The vsync log looks correctly. Please try https://www.vsynctester.com/ - is the VSync correct there?

Flags: needinfo?(petrufagurel)
Attached image image.png —
Flags: needinfo?(petrufagurel)

It is mainly correct, rarely it is red or cyan.

(In reply to Nat from comment #8)

It is mainly correct, rarely it is red or cyan.

Then it may not be an issue with VSync then.

Please run on terminal with MOZ_LOG="FFmpegVideo:5" env variable, do video playback and attach the log here.
Also do you see the lagging if you play a saved clip from disk?
Thanks.

Flags: needinfo?(petrufagurel)

Hi Martin,

Yes, it also happens with a local video. I tested a 20-second 4K60 H.264 clip with fresh Firefox profiles:

  • Wayland VSync enabled: 17 and 49 dropped frames.
  • Wayland VSync disabled: zero drops in both runs.

The FFmpeg logs show hardware decoding working. I also reproduced the problem with the official Firefox 155.0.1 build outside Snap.

The VSync timing looks mostly normal, but the profiler shows Firefox skipping video frames. I have the FFmpeg logs available.

Flags: needinfo?(petrufagurel)

FFMPEG log

Hi Nat,

I am experiencing the exact same issue on Fedora 44 Workstation. I also tested Chromium based browsers and unfortunately the issue persists there as well. The only browser where this does not reproduce is GNOME Web (Epiphany). Could you please test this on your end?

Flags: needinfo?(petrufagurel)

Yes, the decode looks correct and working - so the difference may be really the vsync, but it also shows ~60hz sync.

Can you try to enable vsync but disable HW video decoding? (media.hardware-video-decoding.enabled -> false at about:config).

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

Attachment

General

Creator:
Created:
Updated:
Size: