So I noticed deplorable battery life watching youtube et al in browser. Went down the rabbit hole to figure out why.
It occurred to me that hardware video decoding (intel quick sync) should be working, which should save precious battery. With standard intel device drivers I proved that hardware video acceleration works with vlc and intel-gpu-tools (using intel_gpu_top, quick sync isnt working if there is nothing under video% ). Curiously, neither Firefox or Chrome have working hardware video acceleration.
I am currently using Fedora 35. I have proven that OpenGL works with glxgears. I have set flags as needed in chrome and firefox to no avail (I now understand, firefox lacks the correct implementation to use the Intel Xe graphics). I am not opposed to using another supported distro, was going to test with Ubuntu 21.10 later.
I ask, has anyone else gotten any browser video acceleration working? If so what distro and what setup?
I managed on Chrome (96.0.4664.45, Arch Linux 5.15.5, libva 2.13.0).
After also digging for a while, I mostly followed this post. Note that YouTube usually serves videos encoded with AV1. As pointed out here, you may want to install an extension to force the use of a codec known to be supported for hardware decoding.
Even though the Framework’s GPU should support AV1 decoding, it seems the software support will be coming in mesa 21.3. At least my Arch setup is still at mesa 2.2.5, which I hope explains why AV1 is still not decoded in hardware.
I start Chrome with google-chrome-stable --use-gl=egl --enable-features=VaapiVideoDecoder, and if I look at “about:gpu”, I can see Video Decode: Hardware accelerated, as well as (scrolling down) a number of entries in the table under the section “Video Acceleration Information”:
Decoding (VideoDecoder)
Decode h264 baseline 16x16 to 4096x4096 pixels
Decode h264 main 16x16 to 4096x4096 pixels
Decode h264 high 16x16 to 4096x4096 pixels
Decode vp8 16x16 to 4096x4096 pixels
Decode vp9 profile0 16x16 to 16384x16384 pixels
Decoding (Legacy VideoDecodeAccelerator)
Decode h264 baseline 16x16 to 4096x4096 pixels
Decode h264 main 16x16 to 4096x4096 pixels
Decode h264 high 16x16 to 4096x4096 pixels
Decode vp8 16x16 to 4096x4096 pixels
Decode vp9 profile0 16x16 to 16384x16384 pixels
Encoding
Fedora 35 kernel 5.15.4-201
Chrome 96.0.4664.45
libva 2.13.0
Graphics driver 21.3.4
mesa 21.2.5 (I think you had a typo)
I was curious about that myself… looking at vainfo, it seems there is an entry for VAProfileAV1Profile0… so according to the vaapi it should support AV1.
It seems that all of the “common” codecs Youtube uses “should” be supported in vaapi, which is what Chrome uses.
Interestingly… based on your recommendation… I just tried a handful of videos.
It seems it is “working” for vp9, vp8 and h264… but not avc1.
Thanks for the reply none the less. I hope between my sources and yours, this helps someone else
Woops, yeah, I made a type on the mesa version. Mine is the same as yours. Fingers crossed things will work after 21.3. I agree the hardware is capable of hardware decoding.
Even with the various flags I’ve been unable to get VAAPI decoding working in Chrome on Wayland… I can get to where it says video decode is hardware accelerated, but nothing is listed under acceleration information, and as expected there’s no actual acceleration happening in that situation.
I’m not too worried about it but it’s vaguely annoying.
I don’t know that it’s possible with the ozone Wayland backend… Looks like there’s a patched version on the AUR to enable it. Maybe you could try some of the other flags listed in the FAQ at the below link? I can give them a try tomorrow. Edit: I can’t get it working with the additional flags, but if you’re on arch you could try using the linked patched version.
the flags are different depending on if you are using Wayland or X11.
I got my setup with X11 to work using:
google-chrome --use-gl=desktop --enable-features=VaapiVideoDecoder
I dont use wayland, so I cant verify, but according to my research, this should work:
google-chrome --use-gl=egl --ozone-platform=wayland
you may or may not need --enable-features=VaapiVideoDecoder depending on chrome version and or patch level.
I believe thats what the aur.archlinux.org chromium-wayland-vaapi is all about, enabling the “–enable-features=VaapiVideoDecoder” feature permanently without needing a flag.
Since I use full google-chrome-stable, I need the enable Vaapi flag, since google took away internal program flag.
In the end… google needs to treat linux chrome less crappy and we’ll be happier.
I’ve actually already done this and yet on mine it still doesn’t work I’ll check again later and see the results
Whoops forgot to install intel-media-driver LOL!
It’s now working great on both FFox and Chromium (ungoogled-chromium)
Yeah it’s the Wayland flags specifically that do not work properly. I believe that version of chromium on the AUR that I linked is patched so that the flags will work, though I haven’t tried since it takes time to compile.
I’m getting really tired… This shitty hardware acceleration in firefox probably will never work.
I spent already 3 hours on getting this work. No chance. It works well with VLC
I did anything.
I’m on
Tried Run Firefox with the MOZ_LOG="PlatformDecoderModule:5"
Dont find any logs firefox always in shell background even with MOZ_LOG_FILE; doesnt log anything in the related file.
I’m on Ubuntu 22.04, and I got no hardware acceleration for YT on Firefox.
The problem was that Firefox was installed with snap, and seemed to have an issue recognizing vaapi installed through apt (sudo apt install intel-media-va-driver).
So, I have uninstalled firefox and reinstalled it with flatpak (apt seems to use the snap version for firefox). And now it’s working (with proper flags turned on)! sudo intel_gpu_top shows video acceleration.
Installed intel-media-driver (I found that the libva-intel-driver package doesn’t support the 12th gen iGPU)
Restart Firefox. (Make sure you’re using the Fedora RPM version of Firefox. I couldn’t find a way to get it working for the Fedora Flatpak version.)
Open a 4k video in YouTube like this one, set the quality to 4k in the YouTube player, and run intel_gpu_top. If the “Video” bar in intel_gpu_top is above 0, then hardware acceleration is working.
Officially we recommend using tlp, unofficially hardware acceleration does help…but it’s a bit of config to get it working. Excellent suggestions provided above, nothing to add.
Power continues to be a focus we’re working on (be it a process), so we do appreciate that there is work to be done here.