Alexander Gromnitsky's Blog

Chrome and VAAPI

Latest update:

If your laptop has multiple GPUs, Google Chrome may by default select the one it thinks is the fastest (e.g., a dedicated GPU instead of an iGPU). Unless you're playing heavy browser games, this only drains your battery faster while providing 0 benefit.

I noticed that when playing a 4k hevc video in Chrome, the laptop's fan started spinning up (it used to stay mostly silent). At first I thought it was time to grab a screwdriver, replace the thermal paste, & clean the fan. Then I remembered I was using Linux, meaning the problem could be software-related.

You won't believe it, but that's exactly what happend.

Turns out, Chrome suddenly forgot how to talk to VAAPI on Fedora 44 & use hardware video decoders. The most confusing part was that chrome://gpu/ page still reported

Video Decode: Hardware accelerated

when in reality the browser didn't even try to call libva initialisation routines.

The easiest way to check this is by running Chrome with a tmp profile:

$ export LIBVA_MESSAGING_LEVEL=2
$ google-chrome --user-data-dir=$PWD/1 2>&1 | grep libva

If nothing gets printed, VAAPI isn't being initialised. (To see what the expected output should look like, run vainfo 2>&1 | grep libva.)

I impelled Chrome to behave using 1 of the following command-line options:

  1. via explicitly selecting a GPU --render-node-override=/dev/dri/renderDXXX

  2. or, more interestingly, with --hardware-video-decode-path=/dev/dri/renderDXXX, that allows using hardware video decoders only from the specified GPU while continuing to use the default GPU for everything else.


Tags: ойті
Authors: ag