Firefox on Fedora finally gets VA-API on Wayland.

I used of Toy Story 3 trailer as a test video and saw it a thousand times during the VA-API debugging. I should definitely watch the movie one day.

Yes, it’s finally here. One and half year after Tom Callaway, Engineering Manager @ Red Hat added the patch to Chromium we also get hardware accelerated video playback for Firefox. It’s shame it took too long but I’m still learning.

The VA-API support in Firefox is a bit specific as it works under Wayland only right now. There isn’t any technical reason for that, I just don’t have enough time to implement it for X11 so Bug 1619523 is waiting for brave hackers.

There are a lot of people who greatly contributed to the Firefox Wayland port. Jan Horak (Red Hat) did all the uneasy Wayland patches reviews I threw at him. Jonas Ådahl (Red Hat) helped me with Wayland backend since the first Wayland patch four years ago. Robert Mader faced various Mutter/Gtk compositor bugs, Kenny Levinsen implemented adaptive Wayland vsync handlers, Jan Andre Ikenmeyer has been tirelessly triaged new Wayland bugs and cleaning bugzilla. Sotaro Ikeda (Mozilla) reviewed almost all Wayland patches for graphics subsystem, Jean-Yves Avenard (Mozilla) reviewed VA-API video patches and Jeff Gilbert (Mozilla) faced to my OpenGL Wayland patches.

The contributor list is not exhaustive as I mentioned only the most active ones who comes to mind right now. There are a lot of people who contribute to Firefox/Wayland. You’re the best!

How to enable it in Fedora?

When you run Gnome Wayland session on Fedora you get Firefox with Wayland backend by default. Make sure you have the latest Firefox 77.0 for Fedora 32 / Fedora 31.

You also need working VA-API acceleration and ffmpeg (valib) packages. They are provided by RPM Fusion repository. Enable it and install ffmpeg, libva and libva-utils.

Intel graphics card

There are two drivers for Intel cards, libva-intel-driver (provides and libva-intel-hybrid-driver ( Firefox works with libva-intel-driver only, intel-media-driver is broken due to sandboxing issues (Bug 1619585). I strongly recommend to avoid it all cost and don’t disable media sandbox for it.

AMD graphics card

AMD open source drivers decode video with library which is provided by mesa-dri-drivers package and it comes with Fedora by default.

NVIDIA graphics cards

I have no idea how NVIDIA cards are supported because I don’t owny any. Please refer to Fedora VA-API page for details.

Test VA-API state

When you have the driver set it’s time to prove it. Run vainfo on terminal and check which media formats are decoded on the hardware.


There’s vainfo output from my laptop with integrated Intel UHD Graphics 630. Loads driver and decodes H.264/VP8/VP9 video formats. I don’t expect much more from it – seems to be up.

Configure Firefox

It’s time to whip up the lazy fox 🙂 At about:config set gfx.webrender.enabled and widget.wayland-dmabuf-vaapi.enabled. Restart browser, go to about:support and make sure WebRender is enabled…


…and Window Protocol is Wayland/drm.


Right now you should be able to decode and play clips on your graphics cards only without any CPU interaction.

Get more info from Firefox log

VA-API video playback may not work from various reason. Incompatible video codec, large video size, missing system libraries and so on. All those errors can be diagnosed by Firefox media log. Run on terminal

MOZ_LOG="PlatformDecoderModule:5" MOZ_ENABLE_WAYLAND=1 firefox

and you should see something like


VA-API FFmpeg init successful” claims the VA-API is up and running, VP9 is the video format and “Got one VAAPI frame output…” line confirms that frame decoding works.

VA-API and Youtube

Unfortunately Youtube tends to serve various video formats, from H.264 to AV1. Actual codec info is shown after right click on video under “Stats for nerds” option.

Surprisingly “avc1” means H.264 video. You can expect also AV1 and VP8/VP9 there.

Youtube video codec can be changed by enhanced-h264ify Firefox add-on, so disable all SW decoded formats there. And that’s it. If you’re running Fedora you should be settled for now.

We’re done, bro!

VA-API with stock Mozilla binaries

Stock Mozilla Firefox 77.0 is missing some important stability/performance VA-API fixes which hit Firefox 78.0 and are backported to Fedora Firefox package. You should grab latest nightly binaries or Developer/Beta versions and run them under Wayland as


Mozilla binaries perform VP8/VP9 decoding by bundled libvpx library which is missing VA-API decode path. If your hardware supports it and you want to use VA-API for VP8/VP9 decoding, you need to disable bundled libvpx and force external ffmpeg. Go to about:config and set media.ffvpx.enabled to false. Fedora sets that by default when VA-API is enabled.


Wayland/X11: How to run Firefox in mixed environment


Mixed X11/Wayland environment is a source of great annoyance when comes to running Firefox on Wayland along other X11 applications, like terminal, mail clients etc. Some X11 applications set GDK_BACKEND variable to x11 which effectively breaks Wayland applications and causes Firefox to start in X11 mode. That breaks Firefox remote protocol when Firefox searches for running instances and tries to reuse it.

When Firefox instance is already running on Wayland and you launch X11 version you get infamous “Firefox is already running” dialog due to locked Firefox profile.

Firefox 74 ships new MOZ_DBUS_REMOTE env variable and it forces Firefox on X11 to use D-Bus remote protocol as well as Wayland version does. So when X11 Firefox is launched after Wayland one with the same profile, already running Wayland instance is reused to open the link instead of the “Close Firefox” greetings.

All you need is to put this line to your ~/.bashrc file and restart your shell:

export MOZ_DBUS_REMOTE = 1

WebGL and fgx acceleration on Wayland

WebGL on Wayland running in full speed.

Firefox on Linux have suffered by poor WebGL performance for long, long time. It was given by missing general acceleration on Linux as there are always broken gfx drivers on X11, various hacks and different standards, closed source drivers and so on. Long story short – to do gfx acceleration seriously on Linux have been PITA. For instance Chrome (which supports gfx acceleration on Linux/X11) shows long list of active exceptions and workarounds listen at chrome://gpu/ page.

It’s also reason why Firefox never enabled it by default although it also implements gfx acceleration – Mozilla does not have resources to spend too much time on every broken gfx card / driver.

Fortunately situation was changed with Wayland. Working gfx acceleration is a sort of prerequisite to even start a decent Wayland compositor like Mutter or Plasma so when Firefox is launched on Wayland we can pretty much expect working GL environment. Also dmabuf is widely supported by Wayland compositor so we finally have all pieces together to build fully accelerated browser on Linux which is equal to its Windows siblings.

Firefox supports two acceleration modes – WebRender and GL compositor. WebRender is the new one and it’s superior in web content rendering. GL compositor is the former one, less advanced but it’s still faster for some scenarios where bits are heavily shifted from one side to another one – video playback and WebGL.

Both WebRender and GL compositor have implemented dmabuf back end which means textures used by WebRender/GL compositor can be created directly at GPU and shared  without copy among compositor / GPU browser processes. Such GPU memory can be in the same time mapped as EGL framebuffer so we can render WebGL frames directly to GPU memory, handle them from webgl process to chrome process and render it as a texture to a web page.

All those pieces are tied together in recent nightly where we finally have full WebGL support on Wayland and it will be shipped as Firefox 75. If you run Fedora/Gnome you can try it by yourself. Just grab latest nightly from Mozilla, enable HW acceleration, set widget.wayland-dmabuf-webgl.enabled to true at about:config, restart browser and open your favorite WebGL application like or WebGL samples.

Fedora Firefox team at 2019

logoI think the last year was the strongest one in whole Fedora Firefox team history. We have been always contributed at Mozilla but in 2019 we finished some major outstanding projects at upstream and also ship them at Fedora.

The first finished project I’d like to mention is disabled system titlebar by default on Gnome. Firefox UI on Linux finally matches Windows/MacOS and provides similar user experience. We also implement various tweaks like styled and HiDPI titlebar button rendering and left/right button placement.

A rather small by code changes but highly impacted was gcc optimization with PGO/LTO.  In cooperation with Jakub Jelinek and SuSE guys we managed to match and even slightly outperform default Mozilla Firefox binaries which are built with clang. I’m going to post more accurate numbers in some follow up post as was already published by a Czech  linux magazine.

Firefox Gnome search provider is another small but useful feature we introduced last year. It’s not integrated at upstream yet because it needs an update for an upcoming async history lookup API at Firefox side but we ship it as tech preview to get more user feedback.

And then there’s our biggest project so far – Firefox with native Wayland backend. Fedora 31 ships it by default for Gnome which closes an initial developer phase and we can focus on polishing, bug fixing and adding more features now. It’s the biggest project we have been working on so far and also extends the Gtk2 to Gtk3 transition. There are also many people from and outside of Mozilla who helped with it and some of them are brand new contributors to Firefox which is awesome.

The Wayland backend is going to get more and more features in the future. We’re investigating possible advantages of DMA-BUF backend which can be used for HW accelerated video playback or direct WebGL rendering. We need to address missing Xvfb on Wayland to run tests on Wayland and build Firefox with PGO/LTO there. We’re also going to look at other Wayland compositors like Plasma and Sway to make sure Firefox works fine there – so many challenges and a lot of fun are waiting for fearless fox hackers! 😉

Firefox & Wayland HiDPI screens

hidpiWhen comes to HiDPI screens and resolutions Firefox has always had some technical debts there. Wayland slightly improved it  but we still miss clean user experience.

We tried hard to improve it and the last piece – hi-res widget rendering – landed in upcoming Firefox 68 (recently Beta). That means Firefox should be fully compatible with HiDPI screens and you shouldn’t see any glitches there.

Also Firefox 68 supports fractional scaling on Fedora 30 / Wayland which gives you more control over the screen resolution. To test it just grab Firefox Beta and try on your own, as:




Create your website with
Get started