Hardware acceleration in chromium

there are actually quite a bunch of other “ways” (although some are mysterious and inscrutable ^^) as described in the wiki and probably here, as @pebcak pointed out.

1 Like

Yes o did.

I’m aware of the wiki and the forum thread. I followed along over the years, but none of those ever worked for me. Including different packages in the AUR claiming vaapi-support, vivialdi with their ffmpeg packages or other contortions.

I’m actually surprised to hear that it works for people. The ever changing wiki recommendations and never ending forum thread gave the impression of an ever moving and difficult target.

But let’s see, now I’m curious what OP’s issue and solution is.

@AnotherLinuxNewbie still can post that or…?
you should follow @thefrog advices…

This surely works on Chromium on my end:

Screenshot from 2024-03-03 17-25-30

CONFIRMED!

Thanks @linuxislife

1 Like

Yes, I am absolutely sure that Intel GPU top is correct. And I do absolutely value the time of volunteers… I will describe the whole case tommorow. I am currently on my phone. So, I will share some more info later.

1 Like

I dunno ¯_ (ツ)_/¯
Maybe you could post
sudo lspci -v
vainfo
cat ~/.config/chromium-flags.conf
if you want…
Also, for example, in your picture the flag you used isn’t --enable-features=VaapiVideoDecodeLinuxGL

maybe you could try with

~/.config/chromium-flags.conf
--ignore-gpu-blocklist
--enable-gpu-rasterization
--enable-zero-copy
--enable-features=VaapiVideoDecodeLinuxGL

Cheers

I would do that tommorow. I am currently on my phone.

I use an Intel iGPU.

Also thi s flag is enabled.

1 Like

Sure. If there’s a solution I’m interested: https://pastebin.com/G0B9ZK1W

My bad, must have been a C&P error. Here you go:

The whole case is that my GPU doesn’t use the video and video enhance engines.

My laptop has so called ‘Ubuntu support’ and really, hwaccel is working on Ubuntu but I don’t like it. I want something rolling release. I first tried arch which I was not able to install. Then manjaro which I hated and then endeavour os which is the best of all.

Things that I already tried.
Recompiling chromium from source with flags.
Making a chromium flags conf with a bunch of the stuff that I read from the wiki.
Following YouTube tutorials.
Searching though many websites.
Trying x11 which worked but it was crazy glitchy.
Using native Wayland mode in chromium.
Much more.

I would say I extensively went through all those steps too. Maybe our issues have the same cause and we figure it out together.

Not that I would switch away from FF, but it would be nice to know what’s going on if it works for others.

1 Like

Interesting. After reading this thread, I did some testing.

Hardware acceleration isn’t currently working for me in any chromium-based browser. However, I did have it working in the past.

I would first get rid of chromium-wayland-vaapi if installed and try adding

~/.config/chromium-flags.conf
--ignore-gpu-blocklist
--enable-gpu-rasterization
--enable-zero-copy
--enable-features=VaapiVideoDecodeLinuxGL

to see how it goes

This is the extra/chromium started with these flags, no success:

Environment unchanged from the pastbin above.

:frowning:

There’s quite a section after “otherwise, continue reading” on the wiki… I would try all the flags in there lol :sweat_smile:

otherwise, continue reading.

Hardware video acceleration

Note:

  • There is no official support from Chromium or Arch Linux for this feature [2]. However, chromium from official repositories is compiled with VA-API support and you may ask for help in the dedicated forum thread.
  • Since Chromium version 122, the chromium-wayland-vaapiAUR package is no longer needed. VA-API works when using the native Wayland backend with the chromium package from official repositories.
  • On AMD GPU devices, VA-API does not work according to Chromium bug 1445074. A patch is available, but it only works under X11/XWayland (flag --ozone-platform-hint=x11).

If you’ve confirmed working VA-API support by checking the output of vainfo (see Hardware video acceleration#Verifying VA-API), you might first try the following flag alone:

~/.config/chromium-flags.conf

–enable-features=VaapiVideoDecodeLinuxGL

otherwise, continue reading.

To enable VA-API support in Chromium:

  • Install the correct VA-API driver for your video card and verify VA-API has been enabled and working correctly, see Hardware video acceleration. For proprietary NVIDIA support, installing libva-vdpau-driver-chromiumAUR[broken link: package not found] or libva-vdpau-driver-vp9-gitAUR is required.
  • Set the option --enable-features=VaapiVideoDecoder. This is enough when using ANGLE GL renderer and libva-intel-driver.
  • When using ANGLE, Chromium forces the older i965 driver and fails when intel-media-driver is used. As a workaround, configure VA-API manually. See [3] for details.
  • To use the system GL renderer on Xorg or Wayland, use --use-gl=egl. Setting this option might no longer be needed when using Chrome 112 and may break GPU acceleration when using AMD GPUs.
  • If VA-API still does not work, try the --enable-features=VaapiIgnoreDriverChecks or--disable-features=UseChromeOSDirectVideoDecoder flag
  • If VA-API still does not work on X11 and old GPUs, set the LIBVA_DRI3_DISABLE=1 environment variable [4].

Tips and tricks

To check if it is working play a video which is using a codec supported by your VA-API driver (vainfo tells you which codecs are supported, but Chromium will only support VP9 and h264):

  • Open the DevTools by pressing Ctrl+Shift+I or on the Inspect button of the context (right-click) menu
  • Add the Media inspection tab: Hamburger menu > More tools > Media
  • In the newly opened Media tab, look at the hardware decoder state of the video decoder

Test on a large enough video. Starting with version 86, Chromium on desktop will only accelerate videos larger than 720p.

To reduce CPU usage while watching YouTube where VP8/VP9 hardware decoding is not available use the h264ify, enhanced-h264ify or Not yet, AV1[5] extension.

On some systems (especially on Xwayland) you might need to #Force GPU acceleration. Only --ignore-gpu-blocklist is enough for our purposes.

This article or section needs expansion.

Reason: Provide a link to some bug report. (Discuss in Talk:Chromium)

You might need to disable the Skia renderer, as it is currently not compatible with video decode acceleration: --disable-features=UseSkiaRenderer

Maybe you’ll have to configure VA-API manually.
¯_ (ツ)_/¯

I tried all those wiki recommendations over the years and today. While Firefox eventually settled from using these myriads of flags and configs to having hardware-acceleration available out of box: chromium (and derivatives) never did. These recommendations provide a wide variance of should and could, but they never materialized here.

VA-API is working though, it works everywhere else it is supposed to work, from playback in Firefox or mpv to recording in OBS.

Maybe dalto is able to figure something out.

1 Like

Maybe its a language barrier, but from your post it sounded like you were the authority on the topic that can not confirm it, and that linuxislife is the exception.

Anyway, from your screenshots it’s obvious to me that wayland is the issue on your chrome instance. Disable wayland in chrome and try again.

Open chrome://flags in a new tab, find “Preferred Ozone Platform”, select X11 and restart Chrome (don’t click on Relaunch button)

Or via chrome flags

--enable-features=UseOzonePlatform --ozone-platform=x11

Yes, I’m the sole authority that can or cannot confirm what is working for me. And again, how else is that supposed to work? :wink:

I didn’t say it doesn’t work, I said I have never seen it working, and from that perspective I was surprised to hear that it works for other people.

Now, back to my perspective and the realm of my personal authority:

Doesn’t make a difference, still no hardware acceleration.

My instinct would have said Wayland too, but that news was two months ago, and I tried chrome-dev earlier today. :person_shrugging:

Hmm…it isn’t working for me.

For those it is working for, how are you testing it?

I am using nvtop. When I use Firefox, I can see that the GPU has no additional load but the hardware encoder/decoder is in use. When I use any Chromium-based browser, I see both CPU and GPU load increase but the decoder is not in use.

Also, VA-API should be working because it works in both Firefox and other standalone players.

Firefox:
Screenshot_20240303_132407

Chromium:
Screenshot_20240303_132449

[Non working here] What is your gpu, display server and repository package (Intel Arc, Wayland, chromium here)?

I use intel_gpu_top to look for hardware activity. From what I understand people checked in the Media tab within the chromium inspector (1, 2), not a hardware monitor.

But … the chromium inspector never showed VaapiVideoDecoder for me. So that seems to correlate on my end.