Closed Bug 1737793 Opened 11 months ago Closed 11 months ago

[Wayland] Audio playback issues on Ubuntu 21.04

Categories

(Core :: Audio/Video: Playback, defect)

All
Linux
defect

Tracking

()

RESOLVED DUPLICATE of bug 1731480
Tracking Status
firefox95 --- affected

People

(Reporter: phorea, Unassigned, NeedInfo)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

Affected versions

  • Nightly 95.0a1 2021-10-25 (works better than other channels)
  • Firefox 94 RC
  • Firefox 93 release

Affected platforms

  • Ubuntu 21.04 64-bit Wayland

Steps to reproduce

  1. Open youtube.com, select a random video and set a higher video quality
  2. Play the video with Stats for nerd open and check the dropped frames
  3. Pause / play the audio file
  4. Once the video ends, play it again
  5. Repeat the above steps with the following H.264 in MOV video format

Expected result
All audio files are played back properly, there are no or very few dropped frames.

Actual result
2. Dropped frames levels for H.264 file:

  • 93 - 24 dropped of 556
  • 94RC - 28 dropped of 556
  • 95.0a1 - 12 dropped of 556
  1. Distortions in sound may appear
  2. Sometimes the video remains stuck on loading

Note
This only reproduced on a Dell G3 laptop with Intel 630 UHD so I'm setting the severity field to S3.

Profiler link: https://share.firefox.dev/3Gk8ICN
I run the profiler on 94RC and there were 55 dropped frames for the H.264 video on this profile

Summary: [Intermittent] [Wayland] → [Wayland] Audio playback issues on Ubuntu 21.04

Can you share your about:support (text, not raw) here?

Flags: needinfo?(petruta.rasa)
Attached file about:support 94RC
Flags: needinfo?(petruta.rasa)

Thanks. The following lines look suspicious to me:

Compositing: WebRender (Software)
...
GPU #1
Active: Yes
Description: Mesa Intel(R) UHD Graphics 630 (CFL GT2)
Vendor ID: Intel
Device ID: Mesa Intel(R) UHD Graphics 630 (CFL GT2)
Driver Vendor: mesa/software-unknown
Driver Version: 21.0.3.0
RAM: 0
GPU #2
Active: No
Vendor ID: 0x8086
Device ID: 0x3e9b
...
DMABUF:
available by default
failed by runtime: Failed to configure

IIUC this is a setup with only one GPU, however something goes wrong in our detection. Is there any chance that you have the proprietary nvidia drivers installed (bug 1731480) or messed with libglvnd? In any case, as result you get software rendering, which is likely to blame for the frame drops on high resolutions.

Can you also share the about:support from current nightly?

Attached file about:support 95.0a1

I do have nvidia drivers installed and running sudo prime-select query returns nvidia. However, Intel is shown in both Firefox and OS Settings - About NV137 / Mesa Intel® UHD Graphics 630 (CFL GT2)

Thanks. Then this is a duplicate of bug 1731480, which again is likely a libglvnd bug. We might be able to work around it.

Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1731480

P.S.: you should be able to work around the issue by enabling gfx.webrender.all in about:config.

(In reply to Robert Mader [:rmader] from comment #7)

P.S.: you should be able to work around the issue by enabling gfx.webrender.all in about:config.

Thank you! Youtube video rendering improved with the preference, however the H.264 still has dropped frames and distorted sound.

(In reply to Robert Mader [:rmader] from comment #4)

Thanks. The following lines look suspicious to me:
IIUC this is a setup with only one GPU, however something goes wrong in our detection. Is there any chance that you have the proprietary nvidia drivers installed (bug 1731480) or messed with libglvnd? In any case, as result you get software rendering, which is likely to blame for the frame drops on high resolutions.

Considering this, should I continue testing on this format or should we reset the Ubuntu installation? Thank you!

(In reply to Petruta Horea [:phorea] from comment #8)

Considering this, should I continue testing on this format or should we reset the Ubuntu installation? Thank you!

From our side we shouldn't need your help to fix bug 1731480. Resetting the laptop might be a good idea - if you still get frame drops on a clean install please let us know and we can debug further.

(In reply to Petruta Horea [:phorea] from comment #8)

Window Protocol: xwayland

When testing Mozilla builds, you need to set the MOZ_ENABLE_WAYLAND=1 environment variable on Wayland, otherwise you are not testing Wayland, but Firefox X11 on Xwayland.
Snap builds default to MOZ_ENABLE_WAYLAND=1 on Wayland, the environment variable is not necessary there.

  • Wayland means Firefox with MOZ_ENABLE_WAYLAND=1 env var (or Firefox Snap without env var) on Wayland session.
  • Xwayland means Firefox without env var (or Firefox Snap with DISABLE_WAYLAND=1 env var) on Wayland session.
    • Firefox 94 enabled EGL for >= Mesa 21 on Xwayland. Previously it was using GLX by default.
  • X11 means Firefox on X11 session.
    • Firefox 94 enabled EGL for >= Mesa 21 on X11. Previously it was using GLX by default.

If you want to test Wayland, better use a computer without an Nvidia graphics card or at least without the proprietary Nvidia driver.
Wayland/Nvidia was not really possible until the recent Nvidia beta driver.

How properly do you intent to test? There is a scary amount of possible configurations.
Firefox Snap can have different behavior than Mozilla builds or debian packages. Something might be broken inside Snap/Flatpak that is not broken for non-Snap/Flatpak builds. And there is not only one Wayland, Wayland is just a protocol.

It makes most sense to test:

  • Relevant for Ubuntu >=21.10:
    Snap Firefox 94 Beta (defaults to Wayland backend) on Gnome Wayland on Mesa/Intel or AMD on Ubuntu 21.10
    $ sudo snap remove firefox; sudo snap install firefox --channel=latest/beta; snap run firefox
  • Relevant for Fedora and others:
    Mozilla-built Firefox 94 Beta with MOZ_ENABLE_WAYLAND=1 envionment variable on Gnome Wayland on Mesa/Intel or AMD on Ubuntu 21.10
    $ MOZ_ENABLE_WAYLAND=1 mozregression --repo mozilla-beta --launch 94.0b9

For better understanding, here is an incomplete overview of possible Linux configurations:

My last X11 testing was in bug 1733094 comment 14.

Legend:
SW WR GLX = gfx.x11-egl.force-disabled + gfx.webrender.software
WR GLX = gfx.x11-egl.force-disabled + gfx.webrender.all
SW WR EGL = gfx.x11-egl.force-enabled + gfx.webrender.software
WR EGL = gfx.x11-egl.force-enabled + gfx.webrender.all
(experimental Wayland WR EGL with OS compositing = gfx.webrender.compositor.force-enabled)
The table in incomplete: Each X11 variant can also be used with manually enabled GPU process: layers.gpu-process.force-enabled (bug 1653444)

Meta bugs:
Firefox X11 on Gnome Xwayland: bug 1695440
Firefox Wayland on Gnome Wayland: bug 635134, bug 1587060
Firefox Wayland on proprietary Nvidia (beta driver, requires manually enabling Wayland by changing system files): bug 1535716
Firefox Wayland on KDE Wayland: bug 1609115
Firefox Wayland on Sway Wayland: bug 1551279
Firefox Snap Wayland on Gnome Wayland: bug 1665641

Intel/AMD/Nvidia Mesa SW WR GLX WR GLX SW WR EGL WR EGL WR EGL with OS compositing
Gnome Wayland x x fallback default experimental, disabled by default
Snap on Gnome Wayland x x fallback default experimental, disabled by default
Sway Wayland x x fallback default experimental, disabled by default
Gnome Xwayland default for Mesa <21 discouraged (bug 1635186) fallback default for Mesa >= 21 x
Gnome X11 fallback default for Mesa <21 fallback default for Mesa >= 21 x
Snap on Gnome X11 fallback default for Mesa <21 fallback default for Mesa >= 21 x
Gnome X11 with GTK_CSD=1 (e.g. elementaryOS) fallback default for Mesa <21 fallback default for Mesa >= 21 x
KDE Wayland x x fallback default experimental, disabled by default
KDE X11 with compositing fallback default for Mesa <21 fallback default for Mesa >= 21 x
KDE X11 without compositing, i3, etc. (no alpha) fallback default for Mesa <21 fallback default for Mesa >= 21 x
Proprietary Nvidia driver SW WR GLX WR GLX SW WR EGL WR EGL WR EGL with OS compositing (disabled by default)
Gnome Wayland (beta driver) x x fallback default experimental, disabled by default
Snap on Gnome Wayland (beta driver) x x fallback default experimental, disabled by default
Sway Wayland (beta driver) x x fallback default experimental, disabled by default
Gnome Xwayland (beta driver) default for driver <470 discouraged (bug 1635186) fallback default for driver >=470 (bug 1732002) x
Gnome X11 fallback default fallback bug 1737428, default on EARLY_BETA_OR_EARLIER for driver >=470 x
Snap on Gnome X11 fallback default fallback bug 1737428, default on EARLY_BETA_OR_EARLIER for driver >=470 x
Gnome X11 with GTK_CSD=1 (e.g. elementaryOS) fallback default fallback bug 1737428, default on EARLY_BETA_OR_EARLIER for driver >=470 x
KDE Wayland (beta driver) x x fallback default experimental, disabled by default
KDE X11 with compositing fallback default fallback bug 1737428, default on EARLY_BETA_OR_EARLIER for driver >=470 x
KDE X11 without compositing, i3, etc. (no alpha) fallback default fallback bug 1737428, default on EARLY_BETA_OR_EARLIER for driver >=470 x
Uncommon Mesa (e.g. Raspberry Pi) SW WR GLX WR GLX SW WR EGL WR EGL WR EGL with OS compositing (disabled by default)
Gnome Wayland x x default recommended (GLES3) experimental, disabled by default
Snap on Gnome Wayland x x default recommended (GLES3) experimental, disabled by default
Sway Wayland x x default recommended (GLES3) experimental, disabled by default
Gnome Xwayland default unknown? fallback recommended (GLES3) x
Gnome X11 default unknown? fallback recommended (GLES3) x
Snap on Gnome X11 default unknown? fallback recommended (GLES3) x
Gnome X11 with GTK_CSD=1 (e.g. elementaryOS) default unknown? fallback recommended (GLES3) x
KDE Wayland x x default recommended (GLES3) experimental, disabled by default
KDE X11 with compositing default unknown? fallback recommended (GLES3) x
KDE X11 without compositing, i3, etc. (no alpha) default unknown? falllback recommended (GLES3) x

:aosmond, could you help outline what testing configuration would be most beneficial to the graphics team?

Flags: needinfo?(aosmond)

These circumstances have increased possible configurations:

  1. Ubuntu 21.10 installs Firefox Snap instead of the Firefox deb package by default: bug 1665641
    Firefox Snap breaks entire browser features like smartcards/native messaging.
    Chromium has already been a Snap, with the same smardcard/native messaging problem.

    Users of the proprietary Nvidia driver get Gnome X11 by default (Firefox X11 backend is used there),
    Users of Mesa drivers get Gnome Wayland by default (Firefox Wayland backend is still pre-Nightly for Mozilla builds (bug 1543600), but downstream Ubuntu and Fedora packages use it as their default).

    IIUC, existing Firefox users might not be migrated to Snap yet. That means there are 4 instead of 2 different Firefox Stable flavours on Ubuntu (deb package with X11 and Wayland backends, Snap package with X11 and Wayland backends).
    bug 1734120 was reported as Snap-only Nvidia bug.
    It is impossible to test Firefox Snap with mozregression. There is no Nightly Snap. Due to Snap having all dependencies included in the package and being sandboxed, it's like a different Linux distribution.

  2. Firefox 94 uses EGL by default on X11 and Xwayland on Mesa >=21.
    Dmabuf WebGL is enabled by default. Using the correct GPU in multi-GPU environments is important.
    Edge cases are most interesting:
    bug 1731480: X11/Mesa/Intel as main GPU, second Nvidia GPU with unused proprietary driver. (Prime/Optimus)

  3. Nvidia released a driver with GBM/Dmabuf support which is required for Wayland.
    Interested users might test it,

    • might need to change their system configuration to be able to test Wayland, might break it,
    • might not have the latest Nvidia patch to Xwayland that is required and therefore get empty Xwayland windows,
    • might run into Optimus/Prime problems with Xwayland and Wayland.

Possible steps to consolidate configurations:

  • bug 1543600: "Shipping" MOZ_ENABLE_WAYLAND=1 (it is already shipped by Ubuntu and Fedora) on Wayland to make Xwayland an unusual edge case.
  • Lowering required Mesa version for EGL/X11 from 21 to 17 (WR/GLX baseline) to unship WR/GLX/Mesa (more users will then be able to use GLES3/EGL where OGL3.2/GLX is not available: e.g. X11/Raspberry Pi),
    but possibly don't allow Dmabuf on older Mesa versions.
  • Making it impossible to enable GLX on Xwayland, require EGL like MOZ_ENABLE_WAYLAND already does.
  • bug 1737428: Enabling EGL by default on proprietary Nvidia with next 470.xx driver release (bug 1731172 comment 24), leaving GLX enabled on older driver versions until GLX removal.

What Mozilla should test in CI:

  • MOZ_ENABLE_WAYLAND=1 (bug 1543600)/Gnome Wayland/Mesa Intel with Ubuntu 21.04.
    That's what Intel&AMD users already have by default on Ubuntu and Fedora.
    That's almost what Snap users have on Ubuntu Wayland, but Snap packages contain their dependencies and are sandboxed, there is no Nightly Snap (an unsigned Snap package would need to be created and sideloaded, system permissions needed to be manually configured, if you wanted to test the whole stack).
    VAAPI hardware video decoding (still disabled by default: bug 1698778 comment 13) should be tested in the future: bug 1726186 comment 9
  • EGL/Gnome X11/Mesa Intel
  • GLX/Gnome X11 with Ubuntu LTS or Debian stable: Some basic GLX functionality test. Relevant for GLX/X11/Nvidia with driver <470.
You need to log in before you can comment on or make changes to this bug.