Please enable VA-API support (and GPU rendering) in Firefox by default

Hi,

After many years, Firefox 80 brought VA-API support even for X11 desktops, not just for Wayland desktops. But to use it, there are certain keys needs to be set in Firefox. In my view, these keys should be set by default.

First, GPU based rendering needs to be turned on. There are two ways to achieve this:

-Allow OpenGL based rendering (this is an older thing), by setting this key to TRUE:
layers.acceleration.force-enabled
(some other distros have already been used this setting in the past without any problems)

-Allow the newer WebRender, by setting this key to TRUE:
gfx.webrender.all

(Enabling webrenderer will overrides the OpenGL renderer setting.)
*you can check the effect of these keys buy checking about:support page, where there is a “Graphics” sections, the first value is the “compositing”. If that key sad “basic”, than you do not use GPU at all.

With working GPU rendering, VA-API can be enabled by setting these keys to TRUE:
media.ffmpeg.vaapi-drm-display.enabled
media.ffmpeg.vaapi.enabled

The effect of these setting are huge. Sadly, I can not even post a link to an image to show this…

On the other hand, Youtube uses VP9 codec, that requires a modern GPU for VA-API. You can check the capability of your GPU by running the vainfo command (from libva-utils package).
To allow YouTube VP9 acceleration, media.ffvpx.enabled should be set to FALSE.

**Also, enabling GPU based rendering by default leads to overall better Firefox experience for everyone. So this is a win-win situation.

2 Likes

Hardware acceleration doesnt work well on all systems.

And in general flipping experimental switches in browsers by default is not well liked.

2 Likes

Hardware acceleration in intel currently is supported with the i915 drivers, I have the iHD drivers and the video is unplayable for me,so if I have this problem is not ideal to be default on yet,also I think nvidia is not supported yet too.
https://wiki.archlinux.org/index.php/Firefox#Hardware_video_acceleration

For Intel graphics use the i965 driver libva-intel-driver, the iHD driver intel-media-driver is currently unsupported;

I use chromium with the vaapi patches and its working fine with the iHD drivers though.

The new support for VA-API on X11 is apparently really unstable on proprietary Nvidia drivers.

nVidia drivers… Sigh…

Well, at least the OpenGL rendering should be enabled by default. In Chakra Linux, it is set to enabled for all users since one or two years now, but there was no problems at all with that.

I might be remembering wrongly but i think that is gonna be enabled by default in version 80.
Actually i just found the newspiece.

I did seen that post too. But they did not enabled the vaapi keys by default at version 80. They didn’t even enabled OpenGL rendering, after 10 years. See that ridiculously old bug 594876 on mozilla bugtracker…

AFAIK vaapi will be on by default with v81. The Firefox reease cadence is very fast nowadays, so it shouldn’t take long to reach everyone.

1 Like

That would be awesome. Do you have a link for that?

VP9 in most cases can be blocked by using h264ify and works most of the time, even on older hardware the issue is, its not exactly the best experience all around, I havent tested it on many machines but using a baytrail based pc has been a not fun experience with it enabled, black squares incredibly slow etc. I will need to retest on the stable release though as I tested on a beta

Yes: Firefox 81 Enters Beta with GPU Acceleration Enabled by Default on Linux - 9to5Linux

on the beta you still need to manually change compositing, or at least on the flatpak beta anyways.

also as far as VAAPI goes, on cherryview, what I am on now, VAAPI only works using webrender, and when using webrender, the video works for about 30s before the video crashes on youtube, it is literally unusable on x11, on wayland it works far better, however wayland isn’t always a great experience it’self, especially for me on plasma, cant say for others though

You also have to set MOZ_X11_EGL=1.
And besides, even with that… it’s still basically half-assed.

My HD6310 in windows can decode even 1080p videos once the page and stuff has finished to cache.
On manjaro xfce even 720p is far from perfect smooth.

I see no difference with or without using MOZ_X11_EGL=1 with Firefox (on Manjaro KDE, with AMD RX570). Also, what kind of videos you try to see? It is matter. Can you please post your vainfo output? It will show what can be accelerated with your old graphics card.

Yes, I can confirm this. But this is only a half-solution, because that extension will limit the resolution for all YouTube videos to 1080p. YouTube simply did not used x264 on any resolutions higher than 1080p.

With what graphics / driver?

Browser developers (Goggle and Mozilla) mostly concentrate on Windows platform.

Hardware offloading - GPU rendering - of e.g. streaming media is a hit and miss on Linux in general - probably due to the driver landscape on Linux.

Defaulting to one type of rendering will - as @cscs points out - work well on one system and not so well on another.

2 Likes

I’m just trying to watch H264 on youtube.

If your gpu doesn’t support VP9, chances are you probably aren’t up to bear 4K either.

Yes, it is true but at least we are talking about these things. Imho I tough that 10+ year old OpenGL rendering for Gecko is matured enough with nowadays GPU drivers, since we can play AAA games on Linux. I was able to completely switch from Windows a half year ago but I’m still remained a gamer, thanks to the quality of Mesa drivers.

I remember, I had similar requests in the past from other distributions’s devs about the vaapi - vdpau related packages in order to get them installed by default. And here we are, they are installed by default. (but of coarse, not because of my requests XD)

Yes.
Btw, I have a 5600XT, that can decode VP9, but so far I was unable to use it with Youtube. Strange, since hw decoding works with NetFlix and I can not seen an error message from FF.