Skip to content

Tags

, ,

Video acceleration in Firefox (all recent versions of the past year and more) has been a problem on my desktop computer with its radeon graphics card. See my setup. Various websites would have videos appear as glitches and even lead to the xfdesktop freezing/crashing and needing to be killed (xfdesktop will automatically restart after being killed).

Thanks to UbuntuHandbook for its advice at Enable Hardware Video Acceleration (VA-API) For Firefox in Ubuntu 20.04 / 18.04 & Higher and Get Firefox VA-API Hardware Acceleration working on NVIDIA GPU, I finally got video acceleration to stop glitching and take advantage of the radeon graphics card in the desktop.

First, I followed the advice in these posts to run vainfo.

$ sudo vainfo
[sudo] password for user: 
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Mesa Gallium driver 23.2.1-1ubuntu3.1~22.04.2 for AMD TURKS (DRM 2.50.0 / 6.5.0-18-generic, LLVM 15.0.7)
vainfo: Supported profile and entrypoints
  VAProfileMPEG2Simple            :    VAEntrypointVLD
  VAProfileMPEG2Main              :    VAEntrypointVLD
  VAProfileVC1Simple              :    VAEntrypointVLD
  VAProfileVC1Main                :    VAEntrypointVLD
  VAProfileVC1Advanced            :    VAEntrypointVLD
  VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
  VAProfileH264Main               :    VAEntrypointVLD
  VAProfileH264High               :    VAEntrypointVLD
  VAProfileNone                   :    VAEntrypointVideoProc

So, the graphics card should handle basic web video. And, I know radeon is my graphics driver after running the following command:

$ inxi -G
Graphics:
Device-1: AMD Turks GL [FirePro V3900] driver: radeon v: kernel
Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: ati,radeon
unloaded: fbdev,modesetting,vesa gpu: radeon resolution: 1: 1920x1080~60Hz
2: 1920x1200~60Hz
OpenGL: renderer: AMD TURKS (DRM 2.50.0 / 6.5.0-18-generic LLVM 15.0.7)
v: 4.5 Mesa 23.2.1-1ubuntu3.1~22.04.2

I then configured advanced settings in Firefox — about:config in the address bar — in the following manner:

media.ffmpeg.vaapi.enabled  true
gfx.x11-egl.force-enabled   true
widget.dmabuf.force-enabled true

Note: I tried other recommended changes in the UbuntuHandbook posts, but those changes were ineffective for my setup (the glitching came back).

Finally, I added the following comment and lines to my .bashrc file:

# mozilla video firefox fixes in .bashrc file
export LIBVA_DRIVER_NAME=radeon
export MOZ_DISABLE_RDD_SANDBOX=1
export MOZ_X11_EGL=1

Note: My setup is pretty basic, so I do not have much customization in my .profile file. While there are many aliases are in .bash_aliases, all other customization is in .bashrc.

After quitting Firefox, I then typed source .bashrc in the terminal to reload the .bashrc file and ran Firefox from the terminal by entering the command firefox. A test of a website that was previously glitching showed that these fixes resolved the problem: no more glitching and radeontop showing some work now being done by the graphics card when the video was playing inside Firefox:

radeotop showing graphics card processing video within Firefox

__ATA.cmd.push(function() {
__ATA.initVideoSlot(‘atatags-370373-65d78fee15090’, {
sectionId: ‘370373’,
format: ‘inread’
});
});

 

__ATA.cmd.push(function() {
__ATA.initDynamicSlot({
id: ‘atatags-26942-65d78fee15107’,
location: 120,
formFactor: ‘001’,
label: {
text: ‘Advertisements’,
},
creative: {
reportAd: {
text: ‘Report this ad’,
},
privacySettings: {
text: ‘Privacy’,

}
}
});
});