How to properly run Chromium with NVIDIA support?

I have Hybrid laptop with intel and NVIDIA driver on it. By following Hardware video acceleration - ArchWiki, I was able to enable Hardware Acceleration through mpv, smplayer, chromium-vaapi. This local video player ran smoothly with intel backend by using vaapi. But chromium-vaapi is using intel as backend and it lags if I open multiple tabs simultaneously. My cpu is quite old. And doesn’t accelerate properly if I use intel as backend using vaapi. Chrome runs smoothly in windows 10.

However Chromium - ArchWiki says it’s possible to run chromium-vaapi with proprietary nvidia support.

I have already installed chromium-vaapi, libva-vdpau-driver-chromium packages. But I am sure chromium is using intel as backed not NVIDIA. How can I run chromium-vaapi using proprietary NVIDIA as backend?

What I tried so far:

I followed Arch wiki exactly what it said.

  • I installed Translation layers [ libva-vdpau-driver-chromium, libvdpau-va-gl]

  • Tested mpv with vaapi. WORKING

  • Verified vainfo and vdpauinfo.

      $ vainfo
    
      vainfo: VA-API version: 1.8 (libva 2.8.0)
      vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.4.1
      vainfo: Supported profile and entrypoints
            VAProfileMPEG2Simple            : VAEntrypointVLD
            VAProfileMPEG2Simple            : VAEntrypointEncSlice
            VAProfileMPEG2Main              : VAEntrypointVLD
            VAProfileMPEG2Main              : VAEntrypointEncSlice
            VAProfileH264ConstrainedBaseline: VAEntrypointVLD
            VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
            VAProfileH264Main               : VAEntrypointVLD
            VAProfileH264Main               : VAEntrypointEncSlice
            VAProfileH264High               : VAEntrypointVLD
            VAProfileH264High               : VAEntrypointEncSlice
            VAProfileH264MultiviewHigh      : VAEntrypointVLD
            VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
            VAProfileH264StereoHigh         : VAEntrypointVLD
            VAProfileH264StereoHigh         : VAEntrypointEncSlice
            VAProfileVC1Simple              : VAEntrypointVLD
            VAProfileVC1Main                : VAEntrypointVLD
            VAProfileVC1Advanced            : VAEntrypointVLD
            VAProfileNone                   : VAEntrypointVideoProc
            VAProfileJPEGBaseline           : VAEntrypointVLD
    
    
    
    $ 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)
    

Here’s my vdpau drivers

$ grep -iE 'vdpau | dri driver' /var/log/Xorg.0.log

[    11.103] (II) modeset(0): [DRI2]   DRI driver: i965
[    11.103] (II) modeset(0): [DRI2]   VDPAU driver: va_gl
[    11.133] (II) NVIDIA(G0): [DRI2]   VDPAU driver: nvidia

I have also set environment variables

/etc/environment

LIBVA_DRIVER_NAME=i965
VDPAU_DRIVER=va_gl

And for Chromium

  • I set the flags

    ~/.config/chromium-flags.conf
    –ignore-gpu-blacklist
    –enable-gpu-rasterization
    –enable-zero-copy

  • installed chromium-vaapi, libva-vdpau-driver-chromium

  • Used this flag on launcher to enable HWAcceleration
    –use-gl=desktop

  • Checked chrome://gpu, it shows Video Decode: Hardware accelerated

  • chrome://media-internals shows MOJOVIDEODECODER in youtube.

  • installed this extension h264ify

For now everything working properly. But it’s using intel as backend. But I want to use NVIDIA as backend using vdpau, Archwiki says it’s possible but doesn’t give any direction of how to achieve this.

I tried prime-run vdpauinfo. This is what it shows

$ prime-run 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                -  

Now can anyone help me to achieve this? I want to run chromium-vaapi using NVIDIA via vdpau.

It’s best to be sure. Install the intel-gpu-tools package and run sudo intel_gpu_top to see if the intel card is really used for video decoding (“Video” row), alternatively, you can run nvidia-smi -q | grep Decoder to see if the nvidia gpu is used for video decoding.

Have you tried running chromium with prime-run?

This is unecessary … the ‘chromium-vaapi’ packages are redundant as the chromium in the repos is now built with the relevant flags.

but
your issue seems to be you want to run chromium with the nvidia card.
I am not entirely sure why … but sure, go ahead.
All you need to do is use prime-run like you would with any other scenario, ie:

prime-run chromium

(you can also make this default when you launch chromium any way, such as through the menu, if you take some extra steps … but lets make sure we understand eachother first :wink:)

I have installed intel-gpu-tools and if I play youtube video I can see video/0 moving and using the intel video decoder.
I tried using

prime-run /usr/bin/chromium %U --use-gl=desktop

and

prime-run /usr/bin/chromium %U

Both doesn’t help. First one shows black screen. Looks like Nvidia doesn’t work. But Audio is working.
Second one doesn’t enable video decode in chrome://gpu

Also … its kinda known that nvidia doesnt work well with others hw-accel and browsers … for example it doesnt work in FF after they made it possible recently.

I have tried prime-run chromium. It shows black screen. But audio is working.
This is what terminal log is saying.

prime-run /usr/bin/chromium %U --use-gl=desktop
[7311:14:0924/141253.917059:ERROR:batching_media_log.cc(38)] MediaEvent: {"error":"video decode error!"}

Also, yes I want to use NVIDIA as backend. Because my cpu is from 2014 and is quite old. HWAcceleration works but I open multiple tabs or 2-3 new windows Chromium starts to lag. But everything works well in Windows 10.

Are you sure the problem is that the intel gpu is struggling? Because if it’s not, then using the nvidia gpu won’t really make a difference.

is it entirely impossible?
Arch wiki says it’s possible to run with NVIDIA as vdpau backend. But doesn’t give further direction how to achieve this. That’s why I am asking in this forum if anybody got it working.

Not really … as in … the whole system.

But beyond that - yes its a proprietary dream. Which is why nvidia (and other terrible code) work fine.

But the point is … its a false comparison.

Nvidia and its proprietary drivers do not release the information for opensource to work well with it.
(and dont take it upon themselves to do it… because they dont care about you :wink:)

So … as in the example of vaapi/vdpau hardware acceleration in browsers in linux … it hasnt been perfect for a while. But it is now possible on all GPUs … except nvidia.

I am sorry … but I am pretty sure this is something that you just have to yell at nvidia about.
(or wait … or get a different GPU … or …)

I may (and hope to) be wrong.
I am roughly just regurgitating what I know from the Firefox example … as I dont have an nvidia.
As you experience the same scenario - either HW accel doesnt work, or the browser itself doesnt when run on the nvidia… I assume its pretty much the same deal … but welcome anyone to chime in otherwise.

1 Like

I’m pretty sure you do not need libvdpau-va-gl only libva-vdpau-driver, and VDPAU_DRIVER should be nvidia and LIBVA_DRIVER_NAME should be vdpau. If you run vainfo, it should say “Driver version: Splitted-Desktop Systems VDPAU backend for VA-API …”.

I tried those in default Manjaro setup. I set LIBVA_DRIVER_NAME=vdpau and VDPAU_DRIVER=nvidia.
It doesn’t show vainfo and vadpauinfo. I guess it only works in Optimus system if NVIDIA is running x-org. Because yesterday I ran xorg using NVIDIA. I used Optimus Manager to achive this.

LIBVA_DRIVER_NAME=vdpau and VDPAU_DRIVER=nvidia only works if NVIDIA is running xorg not intel.

EDIT: I tried VDPAU_DRIVER=nvidia in /etc/environment. Restarted PC.
This is what it shows.

$ vdpauinfo
display: :0   screen: 0
Error creating VDPAU device: 1

$ prime-run vdpauinfo
display: :0   screen: 0
Error creating VDPAU device: 1