[RESPONDED] Video decoding acceleration in Linux

For reference here are my details…

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

I guess we wait for updates to Mesa?

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 may sound like a crotchety old man, but… ewh wayland.

I have a few other applications that dont play nice with wayland, so I have to use X11.

for what its worth… you may try these program flags with chrome and see if it helps

google-chrome --use-gl=egl --ozone-platform=wayland

now get off my lawn… sorry old man came out again

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.

https://aur.archlinux.org/packages/chromium-wayland-vaapi/

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.

1 Like

I’ll chime in here for the firefox perspective. It currently will work on stable with today’s firefox 96 release! They finally fixed the Xe graphics sandboxing issues (relevant issue: 1698778 - RDD/VAAPI: Sandbox: seccomp sandbox violation by syscall 16 (DRM_IOCTL_VERSION)).

7 Likes

Nice! What settings did you apply to firefox in order to make it work?

See this: Firefox - ArchWiki. Arch wiki is a great resource even if not using arch Linux. I’m using following about:config flags:

media.ffmpeg.vaapi.enabled = true
media.navigator.mediadatadecoder_vpx_enabled = true
media.rdd-ffmpeg.enabled = true
2 Likes

Sigh… it’s not working for me. Need to figure out why vaapi isn’t starting. (manjaro on wayland here)

libva info: VA-API version 1.13.0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva error: /usr/lib/dri/i965_drv_video.so init failed
libva info: va_openDriver() returns -1

edit: figured it out. Needed to install the intel-media-driver package

2 Likes

I’ve actually already done this and yet on mine it still doesn’t work :confused: 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) :slight_smile:

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

 OS: Fedora Linux 36 (KDE Plasma) x86_64 
Kernel: 5.19.7-200.fc36.x86_64
CPU: 11th Gen Intel i5-1135G7 (8) @ 4.200GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics]

vainfo

libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib64/dri/iHD_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.14.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

installed intel_media_driver, linux_firmware, libva, liva-intel-hybrid-driver, libva-utils

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.

WebRenderering is on and Wayland Mode enabled



Flags used:

media.ffmpeg.vaapi.enabled = true
media.navigator.mediadatadecoder_vpx_enabled = true
media.rdd-ffmpeg.enabled = true

ffmpeg installed from rpmfusion.

It works with VP9 even in vlc… but FF nor h264 (h264fy) either vp9

1 Like

Got it finally working after inspecting the moz log file deeply.

FFMPEG: VA-API works in RDD process only

edited

media.rdd-process.enabled to true
works now !

5 Likes

This answer worked for me on Ubuntu 22.04 running a Firefox fork.

1 Like

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.

Note that not all YT seem to use hardware. This one does: FLYING OVER SWEDEN (4K UHD) - Relaxing Music Along With Beautiful Nature Videos - 4K Video HD - YouTube

3 Likes

Got it working in Fedora 37 on my 12th gen Framework by following these steps:

Source: Firefox Hardware acceleration - Fedora Project Wiki

  1. Installed ffmpeg
  2. Installed intel-media-driver (I found that the libva-intel-driver package doesn’t support the 12th gen iGPU)
  3. 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.

2 Likes

@Matt_Hartley could you clarify on this? It sounds like you are saying Framework doesn’t support hardware acceleration by default? I’m trying to fix a slow laptop problem and I thought it might be related to this. Even live booting from usb for Ubuntu didn’t solve my problem.

Basically saying that the only changes we recommend to a vanilla installation are those provided in the guides.

We’ve found historically that unless you’re very careful, random changes can make matters worse. I also understand that many people elect to go ahead, but they also understand that we will not be able to provide ticket support when something breaks unless they’re willing to restore to a point as outlined in our guides.

Now, that said, we encourage you to do what you feel is best - then the community support can help get you squared away if going this direction is what you need. I just want to make sure you understand that this is community territory.

1 Like