Hardware Video Decoding on Chromium using Nouveau

Issues related to hardware problems
Post Reply
hpschmid
Posts: 4
Joined: 2018/10/02 09:31:14

Hardware Video Decoding on Chromium using Nouveau

Post by hpschmid » 2021/07/28 12:50:37

Dear Centos Community,
I upgraded my notebook to Centos 8, because I thought I can eanble hardware accelerated video decoding on the Nvidia card for watching e.g. Eurosport. I want to use the Nouveau driver. Bevore doing so, I tried it "quickly" on Kubuntu, where I succeeded, so principially it seems to be possible. I'm very proud how far I came, but at the end there is a part of the puzzle still missing...

After the fresh setup I did the following steps:

Code: Select all

[gerhard@mandarin ~]$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GT218M [NVS 3100M] (rev a2)

[gerhard@mandarin ~]$ inxi -G
Graphics:  Device-1: NVIDIA GT218M [NVS 3100M] driver: nouveau v: kernel 
           Device-2: Chicony type: USB driver: uvcvideo 
           Display: x11 server: X.Org 1.20.10 driver: loaded: nouveau resolution: 1600x900~60Hz 
           OpenGL: renderer: NVA8 v: 3.3 Mesa 20.3.3
           
[gerhard@mandarin ~]$ lsmod | grep nouveau
nouveau              2256896  13
mxm_wmi                16384  1 nouveau
i2c_algo_bit           16384  1 nouveau
drm_kms_helper        233472  1 nouveau
ttm                   114688  1 nouveau
drm                   569344  16 drm_kms_helper,ttm,nouveau
wmi                    32768  4 hp_wmi,wmi_bmof,mxm_wmi,nouveau
video                  49152  1 nouveau

[root@mandarin ~]$ dnf install libva-utils
[root@mandarin ~]$ dnf install libva-vdpau-driver
[root@mandarin ~]$ dnf install mesa-vdpau-drivers

[gerhard@mandarin ~]$ vainfo 
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

[gerhard@mandarin ~]$ ls -n /usr/lib64/dri/
[...]
lrwxrwxrwx. 1 0 0       18 28. Jul 13:15 nvidia_drv_video.so -> vdpau_drv_video.so
-rwxr-xr-x. 8 0 0 22190464 27. Mär 06:11 r600_dri.so
-rwxr-xr-x. 8 0 0 22190464 27. Mär 06:11 radeonsi_dri.so
lrwxrwxrwx. 1 0 0       18 28. Jul 13:15 s3g_drv_video.so -> vdpau_drv_video.so
-rwxr-xr-x. 1 0 0   660136 28. Jul 13:15 vdpau_drv_video.so
[...]
As you see, the Vdpau driver could not be loaded. I reconized the symlink for the nvidia_drv_video.so, so I created a link also for nouveau. Here, in this step I'm not sure, however, it resulted in a promising output of vainfo:

Code: Select all

[root@mandarin ~]$ ln -s /usr/lib64/dri/vdpau_drv_video.so /usr/lib64/dri/nouveau_drv_video.so
[gerhard@mandarin ~]$ ls -n /usr/lib64/dri/
[...]
-rwxr-xr-x. 8 0 0 22190464 27. Mär 06:11 nouveau_dri.so
lrwxrwxrwx. 1 0 0       18 26. Jul 01:01 nouveau_drv_video.so -> vdpau_drv_video.so
lrwxrwxrwx. 1 0 0       18 28. Jul 13:15 nvidia_drv_video.so -> vdpau_drv_video.so
-rwxr-xr-x. 1 0 0   660136 28. Jul 13:15 vdpau_drv_video.so
[...]

[gerhard@mandarin ~]$ vainfo 
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.5 (libva 2.5.0)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API (arekinath) - 0.7.4
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
      <unknown profile>               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD

[gerhard@mandarin ~]$ vdpauinfo 
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420     8192  8192  NV12 YV12 
422     8192  8192  UYVY YUYV 
444     8192  8192  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                   --- not supported ---
MPEG2_MAIN                     --- not supported ---
H264_BASELINE                  --- not supported ---
H264_MAIN                      --- not supported ---
H264_HIGH                      --- not supported ---
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      --- not supported ---
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- 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 ---

Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8          8192  8192    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
R8G8B8A8          8192  8192    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
R10G10B10A2       8192  8192    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
B10G10R10A2       8192  8192    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 

Bitmap surface:

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

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             y
DEINTERLACE_TEMPORAL_SPATIAL     -
INVERSE_TELECINE                 -
NOISE_REDUCTION                  y
SHARPNESS                        y
LUMA_KEY                         y
HIGH QUALITY SCALING - L1        y
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              y        48     2048
VIDEO_SURFACE_HEIGHT             y        48     2048
CHROMA_TYPE                      y  
LAYERS                           y         0        4

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

The next step was obviously to get the firmware running, I did

Code: Select all


cd /tmp
mkdir nouveau
cd nouveau
wget https://raw.github.com/envytools/firmware/master/extract_firmware.py
wget http://us.download.nvidia.com/XFree86/Linux-x86/340.108/NVIDIA-Linux-x86-340.108.run
sh NVIDIA-Linux-x86-340.108.run --extract-only
python2 extract_firmware.py
mkdir /lib/firmware/nouveau
cp -d nv* vuc-* /lib/firmware/nouveau/

[gerhard@mandarin ~]$ vdpauinfo 
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420     8192  8192  NV12 YV12 
422     8192  8192  UYVY YUYV 
444     8192  8192  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                           0 16384  2048  2048
MPEG2_SIMPLE                    3 16384  2048  2048
MPEG2_MAIN                      3 16384  2048  2048
H264_BASELINE                  41 16384  2048  2048
H264_MAIN                      41 16384  2048  2048
H264_HIGH                      41 16384  2048  2048
VC1_SIMPLE                      1 16384  2048  2048
VC1_MAIN                        2 16384  2048  2048
VC1_ADVANCED                    4 16384  2048  2048
MPEG4_PART2_SP                  3 16384  2048  2048
MPEG4_PART2_ASP                 5 16384  2048  2048
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       0 16384  2048  2048
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- 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 ---
And got a promising result of vdpauinfo, especially the h.264_high decoder seems to be supported.

Then I installed and configured chromium beta, as I learned here (https://www.linuxuprising.com/2018/08/h ... rated.html)

Code: Select all

[root@mandarin ~]$ dnf install snapd
[root@mandarin ~]$ systemctl enable snapd --now
[root@mandarin ~]$ snap install chromium --beta
I enabled the flag
chrome://flags enable "Override software rendering list"
and I start chromium using
[gerhard@mandarin ~]$ chromium --use-gl=desktop --enable-features=VaapiVideoDecoder --enable-gpu-rasterization --ignore-gpu-blocklist

When I check chrom://gpu I see
chrome_gpu.png
chrome_gpu.png (37.3 KiB) Viewed 1540 times
exactly how it should look like, all green, except Vulkan.

Very happy about that I tried to watch a video on Eurosport-Player. But the CPU load is still high, about 50%-70% on all 4 cores, the fan runs loud, it gets hot. When analyzing the media with Ctrl + Shift + i, more tools -> media I see
chrome_accel.png
chrome_accel.png (33.89 KiB) Viewed 1540 times
, the VA hardware acceleration seems not to be used, it uses the FFmpeg software decoder instead.

The codec seems to be a h.264_high,
chrome_codec.png
chrome_codec.png (42.29 KiB) Viewed 1540 times
, so what might be wrong?

I found somewhere that I can increase the Libva debug output,

Code: Select all

[gerhard@mandarin XFits]$ LIBVA_MESSAGING_LEVEL=2 chromium --use-gl=desktop --enable-features=VaapiVideoDecoder --ignore-gpu-blocklist --enable-accelerated-video-decode --enable-gpu-rasterization
/home/gerhard/Bilder was removed, reassigning PICTURES to homedir
libva info: VA-API version 1.9.0
libva info: Trying to open /snap/chromium/1685/gnome-platform/usr/lib/x86_64-linux-gnu/dri/nouveau_drv_video.so
libva info: va_openDriver() returns -1
[36749:36749:0728/141641.534528:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is desktop
[36749:36749:0728/141641.595865:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
The /snap/ directory didn't exist at all, I thought, I know already the solution, just create a symlink,

Code: Select all

[root@mandarin tmp]# ln -s /usr/lib64/dri/nvidia_drv_video.so /snap/chromium/1685/gnome-platform/usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
, but it does not help, I get the same error message. Why chromium might search in the /snap/... directory, not in /usr/lib64/dri?

I also tried google-chrome, google-chrome-beta and -unstable, always the same, I even tried to force the libva driver path,

Code: Select all

[gerhard@mandarin XFits]$ LIBVA_DRIVERS_PATH=/usr/lib64/dri/ LIBVA_MESSAGING_LEVEL=2 chromium[...]
, also without success.

Does anybody know which part or the puzzle I'm still missing? Do I need at some part another version? Can I get somehow more debug-info? Am I too naive just creating these symlinks to make it working?

hpschmid
Posts: 4
Joined: 2018/10/02 09:31:14

Re: Hardware Video Decoding on Chromium using Nouveau

Post by hpschmid » 2021/08/02 18:05:53

Update: Luckily i have the Kubuntu installation still on the HDD, because I changed to an SSD before installing Centos 8. I recognized that I have used --use-gl=egl instead of desktop:

Code: Select all

gerhard@mandarin:~$ LIBVA_MESSAGING_LEVEL=2 chromium-browser --use-gl=egl --enable-features=VaapiVideoDecoder
libva info: VA-API version 1.7.0
libva info: User environment variable requested driver 'nouveau'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
[2756:2756:0802/194117.360157:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is egl
[2756:2756:0802/194117.367235:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
libva info: VA-API version 1.7.0
libva info: User environment variable requested driver 'nouveau'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
So it seems that I can ignore these two error messages and I see that I used --use-gl=egl instead of desktop.

The result looks like this:
Ubuntu.png
Ubuntu.png (173.57 KiB) Viewed 1322 times
It says that the hardware decoder is active. On the other hand, the cpu load is similar to that what I achieved in Centos 8. Here, the VA driver is present, just in a different folder:

Code: Select all

gerhard@mandarin:~$ ls -n /usr/lib/x86_64-linux-gnu/dri/
[... ]
-rw-r--r-- 1 0 0 22209536 Dez 18  2020 nouveau_dri.so
-rw-r--r-- 3 0 0  9759104 Dez 18  2020 nouveau_drv_video.so
-rw-r--r-- 1 0 0 14697248 Dez 18  2020 nouveau_vieux_dri.so
[...]
When I try to use egl on Centos 8 I get

Code: Select all

gerhard@mandarin~$ LIBVA_DEBUG_LEVEL=2 chromium --use-gl=egl --enable-features=VaapiVideoDecoder --ignore-gpu-blacklist --enable-gpu-rasterization
[5162:5162:0802/223810.035057:ERROR:gl_implementation.cc(403)] Failed to load libGLESv2.so.2: libGLESv2.so.2: cannot open shared object file: No such file or directory
[5162:5162:0802/223810.045048:ERROR:viz_main_impl.cc(162)] Exiting GPU process due to errors during initialization
[5179:5179:0802/223810.139199:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
Warning: Couldn't open libvulkan.so.1
Info: Couldn't load Vulkan
but libGLESv2.so.2 is well present in /usr/lib64/. Interestingly, it does not show in which folder it is searching for this library. Is this a hint for somebody?

Post Reply

Return to “CentOS 8 - Hardware Support”