3

Problem in a nutshell: cannot enable hardware video acceleration in Chrome. My desktop has integrated GPU Intel UHD 750 and Core i5 11600 and it runs Kubuntu 20.04.

Initially, I had no hardware acceleration at all, so that even VLC played videos without acceleration, despite I had intel-media-va-driver-non-free installed. The output of vainfo was

libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva info: va_openDriver() returns -1

I searched for the solution but did not find anyone with the same problem. I decided to follow some advises for the related issues. First, I updated the kernel from 5.11 to 5.15 but that did not help. Then I added a repo to install 21.xx version of the Intel drivers as suggested in the comments here: https://githubmemory.com/repo/HaveAGitGat/Tdarr/issues/452. After upgrading some packages and installing some kept back packages I got video acceleration. The current output of vainfo is

libva info: VA-API version 1.12.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.12 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.3.3 (6fdf88c)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats

and so on.

The next step is to enable hardware acceleration in Chrome. I followed the instructions from here https://www.linuxuprising.com/2021/01/how-to-enable-hardware-accelerated.html but it did not help. The chrome://gpu tab shows the following

Graphics Feature Status

  • Canvas: Software only. Hardware acceleration disabled
  • Canvas out-of-process rasterization: Disabled
  • Compositing: Software only. Hardware acceleration disabled
  • Multiple Raster Threads: Disabled
  • Out-of-process Rasterization: Disabled
  • OpenGL: Disabled
  • Rasterization: Software only. Hardware acceleration disabled
  • Raw Draw: Disabled
  • Skia Renderer: Enabled
  • Video Decode: Software only. Hardware acceleration disabled
  • Vulkan: Disabled
  • WebGL: Disabled
  • WebGL2: Disabled

Problems Detected

  • Accelerated video decode has been disabled, either via blocklist, about:flags or the command line.
    Disabled Features: video_decode
  • Gpu compositing has been disabled, either via blocklist, about:flags or the command line. The browser will fall back to software compositing and hardware acceleration will be unavailable.
    Disabled Features: gpu_compositing
  • GPU process was unable to boot: GPU process crashed too many times with SwiftShader.
    Disabled Features: all
    ...

I also tried to enable video acceleration in Firefox but failed. Moreover, I installed Chromium and chrome://gpu now shows that almost everything is enabled but video acceleration is not.

Please, help!

1 Answer 1

3

Disclaimer

Likely you won't really get hardware acceleration in your Chrome-based browser. But let's not surrender: something can still be done.

My differences with your setup are:

  • Environment: ArchLinux+XOrg+KDE
  • GPU: TigerLake-LP GT2 [Iris Xe Graphics] (from lspci).
  • Kernel: 5.15.7-zen1-1-zen

I think the recipe should be the same.

Needed packages

I have these ones (names may differ from Ubuntu):

  • mesa
  • xf86-video-intel
  • libva
  • libva-intel-driver
  • libva-mesa-driver
  • libva-vdpau-driver
  • mesa-vdpau
  • intel-gmmlib
  • intel-media-driver

You may also need some tools to check:

  • libva-utils
  • vdpauinfo
  • intel-gpu-tools

Browser settings

I set them up in chrome://flags and then restarted the browser. This also applies to Chromium, while Vivaldi internal URLs are on vivaldi:// prefix.

  • Override software rendering list
  • GPU rasterization
  • Zero-copy rasterizer
  • Enables Display Compositor to use a new gpu thread
  • Accelerated 2D canvas
  • Out-of-process 2D canvas rasterization

Browser startup

You need to restart the browser with an extra option:

--enable-features=VaapiVideoDecoder

You can edit you startup profile in order to add this one. Mine looks like this now:

/usr/bin/google-chrome-stable --enable-features=VaapiVideoDecoder %U

Check status

This is the best, IMHO, you can do.

Browser

Once restarted, you can go to the internal URL chrome://gpu and check. This is my very own status:

Graphics Feature Status
Canvas: Hardware accelerated
Canvas out-of-process rasterization: Enabled
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
Out-of-process Rasterization: Hardware accelerated
OpenGL: Enabled
Rasterization: Hardware accelerated on all pages
Raw Draw: Disabled
Skia Renderer: Enabled
Video Decode: Hardware accelerated
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

I keep Raw Draw: Disabled because it plays bad with the browser. If you want to experiment with it, go back to the flags and enable "Enable raw draw" flag.

vainfo

If you installed it just run it. Mine works like this:

[enzo@Feynman ~] vainfo 
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.4.3 ()
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
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      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

vdpauinfo

Same as above. There is a bug somewhere causing the core dump. None seems to be paying attention to that, though. :-(

The use of MALLOC_CHECK_ doesn't help much, though.

[enzo@Feynman ~] MALLOC_CHECK_=2 vdpauinfo 
display: :0   screen: 0
API version: 1
Information string: OpenGL/VAAPI backend for VDPAU

Video surface:

name   width height types
-------------------------------------------
420     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 
422     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 
444     4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 
420_16  4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 
422_16  4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 
444_16  4096  4096  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 NV24 YV24 P010 P016 Y_U_V_444_16 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                   --- not supported ---
MPEG2_MAIN                     --- not supported ---
H264_BASELINE                  51 16384  2048  2048
H264_MAIN                      51 16384  2048  2048
H264_HIGH                      51 16384  2048  2048
VC1_SIMPLE                     --- not supported ---
VC1_MAIN                       --- not supported ---
VC1_ADVANCED                   --- not supported ---
MPEG4_PART2_SP                 --- not supported ---
MPEG4_PART2_ASP                --- not supported ---
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE      51 16384  2048  2048
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
VP9_PROFILE_0                  --- not supported ---
VP9_PROFILE_1                  --- not supported ---
VP9_PROFILE_2                  --- not supported ---
VP9_PROFILE_3                  --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---
HEVC_MAIN_444_10               --- not supported ---
HEVC_MAIN_444_12               --- not supported ---

Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8         16384 16384    y  
R8G8B8A8         16384 16384    y  
R10G10B10A2      16384 16384    y  
B10G10R10A2      16384 16384    y  
A8               16384 16384    y  

Bitmap surface:

name              width height
------------------------------
B8G8R8A8         16384 16384
R8G8B8A8         16384 16384
R10G10B10A2      16384 16384
B10G10R10A2      16384 16384
A8               16384 16384

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             -
DEINTERLACE_TEMPORAL_SPATIAL     -
INVERSE_TELECINE                 -
NOISE_REDUCTION                  -
SHARPNESS                        -
LUMA_KEY                         -
HIGH QUALITY SCALING - L1        -
HIGH QUALITY SCALING - L2        -
HIGH QUALITY SCALING - L3        -
HIGH QUALITY SCALING - L4        -
HIGH QUALITY SCALING - L5        -
HIGH QUALITY SCALING - L6        -
HIGH QUALITY SCALING - L7        -
HIGH QUALITY SCALING - L8        -
HIGH QUALITY SCALING - L9        -

parameter name                  sup      min      max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH              -
VIDEO_SURFACE_HEIGHT             -
CHROMA_TYPE                      -
LAYERS                           -

attribute name                  sup      min      max
-----------------------------------------------------
BACKGROUND_COLOR                 -
CSC_MATRIX                       -
NOISE_REDUCTION_LEVEL            -
SHARPNESS_LEVEL                  -
LUMA_KEY_MIN_LUMA                -
LUMA_KEY_MAX_LUMA                -


Segmentation fault (core dumped)

I suspect there is bug in some VDPAU library causing this error and the subsequent fail to use hardware acceleration. Just guessing, though.

Real world

Reality can disappointingly diverge from our desires.

Play a video (I use Youtube) on a tab, then on another tab open chrome://media-internals, select the Players tab. In the Recent players select the item called blob:https://www.youtube.com/....

In the Player properties you can find a line saying something like:

kVideoDecoderName   "Dav1dVideoDecoder"

This is not the hardware decoder, which should be VDAVideoDecoder instead.

In the next Log area you can find some clues:

00:00:00.321    info    "Selected FFmpegAudioDecoder for audio decoding, config: codec: opus, profile: unknown, bytes_per_channel: 4, channel_layout: STEREO, channels: 2, samples_per_second: 48000, sample_format: Float 32-bit, bytes_per_frame: 8, seek_preroll: 80000us, codec_delay: 312, has extra data: true, encryption scheme: Unencrypted, discard decoder delay: true, target_output_channel_layout: STEREO, has aac extra data: false"
00:00:00.321    info    "Failed to initialize DecryptingVideoDecoder"
00:00:00.321    info    "Failed to initialize VDAVideoDecoder"
00:00:00.321    info    "Failed to initialize VpxVideoDecoder"
00:00:00.322    info    "Effective playback rate changed from 0 to 1"
00:00:00.322    event   "kPlay"
00:00:00.325    kIsVideoDecryptingDemuxerStream false
00:00:00.325    kVideoDecoderName   "Dav1dVideoDecoder"
00:00:00.325    kIsPlatformVideoDecoder false

You can also use intel_gpu_top in another terminal window (sudo is needed in ArchLinux, not sure about Ubuntu).

I have four "Engines" available: "Render/3D", "Blitter", "Video" and "Video Enhance".

During the browser play I can see the first two engines being busy, while "Video" is just idling. The video decoder engine provided by my GPU isn't in use at all!

It seems like the browser is not able to use hardware accelerated video, despite it thinks it should.

Let's make a different check.

VLC

It looks like VLC can make use of the hardware acceleration. Start it up with the GUI and go to Tools > Preferences > Input & Codecs and choose "Automatic" option under Hardware-accelerated decoding. Then close it and play a test video from command line (to get some diagnostics output).

[enzo@Feynman ~] vlc ATestVideo.AC3.1080p.x264-WRM.mkv 
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[00005597db23e640] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00005597db311900] main audio output error: too low audio sample frequency (0)
[00007ff9e8d2fc00] main decoder error: failed to create audio output
[00005597db311900] vlcpulse audio output error: digital pass-through stream connection failure: Not supported
[00005597db311900] main audio output error: module not functional
[00007ff9e8d2fc00] main decoder error: failed to create audio output
[00007ff9c8005d20] gl gl: Initialized libplacebo v3.120.3 (API v120)
[00007ff9e8c0d6b0] avcodec decoder: Using Intel iHD driver for Intel(R) Gen Graphics - 21.4.3 () for hardware decoding

In the last two lines is says it is using hardware decoding. As we don't trust the logs, in another terminal window you can run intel_gpu_top and see that the "Video" resource is now being actively used.

Firefox

I know this is a little bit beyond the original scope (Chrome), but I think it's worth mentioning it. With Firefox it is possible to see some hardware accelerated video decode in action, thanks to VA-API, both under XOrg and Wayland.

A guide on ArchLinux' wiki (link below) will guide you (at your own risk) on how to modify a few toggles to enable hardware accelerated video while our usual intel_gpu_top will show whether the GPU is working or not.

Vimeo, for example, seems to be able to take advantage of this support, while YouTube requires a specific browser extension in order to disable the VP9 video codec.

Similarly, WebRTC-based applications like Google Meet seem to work, if you also set media.webrtc.platformencoder to true. Mirosoft Teams is not supported under Firefox.

That same extension exists for Chrome, but it seems it is not as effective as in Firefox.

Wrap up

It looks like hardware acceleration for video decoding is kicking and live in Linux.

This would then point at bugs in the Chromium-based browser(s) more than in the environment.

Maybe the future will be brighter. But not now.

References

Mainly from ArchLinux wiki, but I think those details can be applied to a large number of other distros.

https://wiki.archlinux.org/title/Hardware_video_acceleration https://wiki.archlinux.org/title/Chromium#Hardware_video_acceleration https://wiki.archlinux.org/title/VLC_media_player#Hardware_video_acceleration https://wiki.archlinux.org/title/firefox#Hardware_video_acceleration

6
  • Thank you for the response! I installed some of the packages you mentioned which I did not have. After that Chrome still says that nothing is enabled on chrome://gpu tab, but Chromium now claims that it uses video acceleration. However, while playing videos on Youtube intel_gpu_top shows that video engine is not used which is similar to what you wrote.
    – FGarbuzov
    Commented Dec 23, 2021 at 21:26
  • What about VLC?
    – EnzoR
    Commented Dec 25, 2021 at 11:04
  • VLC uses hardware acceleration.
    – FGarbuzov
    Commented Dec 27, 2021 at 12:22
  • So hardware acceleration for video is there. Only the browser isn't able to use it. Just like everyone else on Linux... :-(
    – EnzoR
    Commented Dec 28, 2021 at 13:58
  • @FGarbuzov if you found my answer useful, please accept it. ;-)
    – EnzoR
    Commented Jan 8, 2022 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .