Hardware Acceleration in Firefox

October 27, 2020 - Reading time: 2 minutes

I wanted to enable Hardware Acceleration in Firefox, to improve performance (for example in the HTML5 benchmark https://testdrive-archive.azurewebsites.net/Performance/Chalkboard/) and test new features.

I found some sources with useful information, I will not detail everything so here are the links to follow the steps I took:

https://wiki.archlinux.org/index.php/Firefox#Hardware_video_acceleration
https://wiki.archlinux.org/index.php/Firefox/Tweaks#Enable_WebRender_compositor
https://wiki.archlinux.org/index.php/Talk:Firefox/Tweaks#Enable_WebRender

To summarize, I simply did that to enable hardware acceleration in Firefox

about:config :
gfx.webrender.all = true
media.ffmpeg.vaapi.enabled = true
media.ffvpx.enabled = false

And I created both following files

~/.pam_environment :
MOZ_ACCELERATED=1 
MOZ_WEBRENDER=1
MOZ_X11_EGL=1
~/.mozilla/firefox/abcxyz.default-something/user.js :
pref("gfx.webrender.program-binary", true);
pref("gfx.webrender.program-binary-disk", true);

Initial benchmark result (I discovered this benchmark test when I was looking for info) were horrible, 89 seconds to finish the test. Now it finishes is 6.5 seconds. Impressive difference.