Getting some hardware acceleration for video in Firefox 93 on my Linux home desktop

A bit over a year ago, I wrote about my confusion over Firefox 80's potentially hardware accelerated video on Linux . More recently, I had some issues with Firefox's WebRender GPU-based graphics acceleration , which through some luck led to a quite useful and informative Firefox bug . The upshot of all of this, and some recent experimentation, is that I believe I've finally achieved hardware accelerated video (although verifying this was a bit challenging).

My home desktop has an Intel CPU and uses the built in Intel GPU, and I use what is called a non-compositing window manager. In order to get some degree of GPU involvement in video playback in my environment, I need to be using hardware WebRender and generally force Firefox to use EGL instead of GLX with the about:config gfx.x11-egl.force-enabled setting. This results in video playback that the intel_gpu_top monitoring program says is using about as much of the GPU as Chrome is when playing the same video. In the future no setting will be necessary, as Firefox is switching over to EGL by default. This appears to be about as good as I can get right now on my current hardware on the sort of videos that I'm most interested in playing smoothly.

The Arch Linux wiki has a much longer list of steps to get VA-API acceleration. Using those as guidelines and after some spelunking of the Firefox source and strategic use of a $MOZ_LOG value of 'PlatformDecoderModule:5,Dmabuf:5' , the settings that leave things not reporting that VA-API is disabled (for my test video) is setting media.ffmpeg.vaapi.enabled to true and media.rdd-process.enabled to false . Based on an inspection of the current Firefox source code, using a RDD process disables VA-API unconditionally. The current debugging output you want to see (from the Dmabuf module) is:

D/Dmabuf nsDMABufDevice::IsDMABufVAAPIEnabled: EGL 1 DMABufEnabled 1  media_ffmpeg_vaapi_enabled 1 CanUseHardwareVideoDecoding 1 !XRE_IsRDDProcess 1

If any of those are zero, you are not going to be using VA-API today (and the platform decoder module logging will report that VA-API is disabled by the platform). Unfortunately, Firefox's about:support doesn't seem to say anything about how it's doing video playback (although it does have a section for audio), so we have to resort to this sort of digging.

(You need the Dmabuf logging to determine just why VA-API is disabled by the platform, and then having PlatformDecoderModule logging is helpful to understand what else is going on.)

However, after doing all of this to enable VA-API, it appears that VA-API doesn't accelerate decoding of my test video; the CPU and GPU usage is basically the same whether or not VA-API is theoretically enabled. Nor does Chrome seem to do any better here.

My tentative conclusion from the log output and intel_gpu_top information is that I'm probably now using the GPU in Firefox to actually display the video on screen, instead of blasting the pixels into place with the CPU, but video decoding is probably still not hardware accelerated. Running vainfo says that VA-API acceleration is available in general, so this may be either a general software issue or simply that the particular video format can't have its decoding hardware accelerated.