Libva-vdpau-driver VS libva-nvidia-driver

The driver was not configured properly. Kernel module parameter nvidia-drm.modeset=1 was not set. You need to follow the instructions from here

As for SMPlayer, try to set Preferences → General → Video → Output driver to gpu or gpu-next and Performance → Performance → Hardware decoding to Auto

1 Like
inxi -Gz                                                                      ✔  at 12:34:11 
Graphics:
  Device-1: NVIDIA GP107GL [Quadro P620] driver: nvidia v: 550.67
  Display: x11 server: X.Org v: 21.1.12 driver: X: loaded: nvidia
    gpu: nvidia,nvidia-nvswitch s-res: 9600x2160 resolution: 1: 3840x2160
    2: 1920x1080 3: 1920x1080 4: 1920x1080
  API: EGL v: 1.5 drivers: nvidia,swrast
    platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 550.67
    renderer: Quadro P620/PCIe/SSE2
  API: Vulkan v: 1.3.279 drivers: nvidia surfaces: xcb,xlib
sudo cat /sys/module/nvidia_drm/parameters/modeset                            ✔  at 12:34:18 
[sudo] password for: 
Y

Thank you I now enabled it. I’m getting tearing with all FF settings but “Use recommended performance settings”. So that’s ok I think. However Video Engine Utilization: 0%
Now that I added the kernel module to be loaded, SMPlayer (with your settings above) and VLC (default settings) do not get >0%. However before the restart it did work on these settings.
For me it’s complicating things though now … :slight_smile:
Edit, it’s working on VLC most of the time and in SMPlayer with the setting Performance > nvdec-copy as well, just not for 4k videos in both apps, but still all tear-free.

Could you provide output of vainfo?
If that command is not recognized install libva-utils package first.

1 Like
vainfo                                                                       ✔  at 17:42:54 
Trying display: wayland
Trying display: x11
libva error: vaGetDriverNames() failed with unknown libva error
vaInitialize failed with error code -1 (unknown libva error),exit

 printenv | grep -i libva                                     ✔  took 1m 41s    at 17:45:08   
 LIBVA_DRIVER_NAME=nvidia vainfo                                           0|1 ✘  at 17:47:36   
Trying display: wayland
Trying display: x11
libva error: vaGetDriverNames() failed with unknown libva error
vainfo: VA-API version: 1.20 (libva 2.20.1)
vainfo: Driver version: VA-API NVDEC driver [egl backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

lib32-libva-vdpau-driver is still installed.

vainfo --display drm                                                          ✔  at 17:51:33   
Trying display: drm
vainfo: VA-API version: 1.20 (libva 2.20.1)
vainfo: Driver version: VA-API NVDEC driver [egl backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

I see that you didn’t set necessary environmental variables system wide. Did you put them in firefox.desktop file? Post “Exec=” sting from firefox.desktop.

Exec=/usr/lib/firefox/firefox %u

I did not put MOZ_DISABLE_RDD_SANDBOX=1 into /etc/environment because it was said to have been fixed and a security risk.
Oh and in that file I have

LIBVA_DRIVER_NAME nvidia

should that be :smiley:

LIBVA_DRIVER_NAME=nvidia

didnt pay attention there :slight_smile:

MOZ_DISABLE_RDD_SANDBOX was fixed for Mesa i.e. for AMD GPUs, it can’t possibly be fixed for libva-nvidia-driver.

You need to set NVD_BACKEND=direct MOZ_DISABLE_RDD_SANDBOX=1 LIBVA_DRIVER_NAME=nvidia.

So you ignored a lot of required parameters. Which raises the question - what else did you ignore?

You should configure all parameters exactly as it said on the driver configuration page otherwise HW acceleration is not going to work.

1 Like

Ok thanks, next try.

Here is what I was referring to:

I knew what you were referring to. That bug was in mesa driver which provides VA-API.

libva-nvidia-driver doesn’t really provide VA-API, it’s a wrapper around NVDEC, pretending to be VA-API. So fixes of mesa bugs have nothing to do with our driver.

1 Like

Ok I do not seem to get it working in Firefox. Thank for the help with SMPlayer and most likely VLC (that auto-configured correctly).
I concluded also that my small GPU can’t help/handle 4K videos so CPU’s gotta do that job.
Here is me summarizing myself of what I did:

  • set what @Mirdarthos set in about:config but also later tried without it, kept his settings for now
  • did what is prbb. not needed because it’s in the libva-nvidia-driver is in the repos but these are building dependencies: sudo pacman -S meson gst-plugins-bad ffnvcodec-headers
  • installed libva-nvidia-driver (with Pacman which uninstalled the default libva-vdpau-driver) However, lib32libva-vdpau-driver is still installed!
  • rebooted
  • set a required kernel parameter so my grub file looks like:
# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=UUID=Y:luks-Y root=/dev/mapper/luks-Y splash resume=/dev/mapper/luks-Z udev.log_priority=3 nvidia-drm.modeset=1"
[...] [Y,Z=uuids]
  • grub-mkconfig -o /boot/grub/grub.cfg
  • first set global environment variables which didn’t work, then later only applied them in the /usr/share/applications/firefox.desktop file (which for some reason is not ~/.local/share/applications, must I link or copy it there to work?) which I kept like that:
#Exec=/usr/lib/firefox/firefox %u
Icon=firefox
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupNotify=true
Categories=Network;WebBrowser;
Actions=new-window;new-private-window;profile-manager-window;
StartupWMClass=firefox

#Exec=/usr/lib/firefox/firefox --ProfileManager

Exec=env LIBVA_DRIVER_NAME=nvidia NVD_BACKEND=direct NVD_MAX_INSTANCES=11 MOZ_DISABLE_RDD_SANDBOX=1 NVD_LOG=1 /usr/lib/firefox/firefox --ProfileManager

or must the last line end in %u ?

  • ^ guess my fault is somewhere in the above point

  • in about:config set:

media.ffmpeg.vaapi.enabled 	true 	
media.rdd-ffmpeg.enabled 	true 	
media.av1.enabled 	false 	(but also tried with true)
gfx.x11-egl.force-enabled true

  • cat /etc/libva.conf
    LIBVA_MESSAGING_LEVEL=1

rebooted several times between the steps.

my next step would be to try in the dev edition of Ff, but other than that, I’m clueless. And even that would just be trial and error.

Greetings.

Does HW acceleration work for videos having lower resolution than 4K?
Can you navigate to about:support page, scroll down and take a screenshot of Codec Support Information?

1 Like

Yes, it shows in nvidia-settings.

Thanks this may provide useful info, after a logout/in, screen-tearing seems to be gone.
I had set the media.av1.enabled setting in about:config to false and use enhanced-h264ify addon to block Vp8 and Av1 now. However, still 0% in nvidia-settings :).

Looks like you set up everything right. Lets see some logs.

  • close all firefox instances
  • open Konsole and type
LIBVA_DRIVER_NAME=nvidia NVD_BACKEND=direct NVD_LOG=1 MOZ_DISABLE_RDD_SANDBOX=1 firefox 2>&1 | tee nvdec.log
  • in firefox navigate to any youtube video with resolution >= 720p and play it for 5-10 sec
  • close firefox
  • upload ~/nvdec.log to any free file hosting and provide a link to that file here
2 Likes

The first two tries, Ff crashed when I tried to resize the window (before trying to navigate to Yt respectively playing a video). I had wanted to debug that and I think the Dark Reader addon is the culprit, anyway these logs then got overwritten:

I played 1 4K video, afterwards an HD vid, also skipped a bit forward, both for a bit more than 15-20 seconds in total. Looks like my 2 GB VRAM memory is the issue?

The crash only happens when I resize the newly opened browser with last sessions’ tabs to smaller. Initially the size is around 3K. Then it logs as follows:

LIBVA_DRIVER_NAME=nvidia NVD_BACKEND=direct NVD_LOG=1 MOZ_DISABLE_RDD_SANDBOX=1 firefox 2>&1 | tee nvdec.log
[Parent 3174666, Main Thread] WARNING: Theme directory 64/devices of theme Gruvbox has no size field
: 'glib warning', file /usr/src/debug/firefox/firefox-125.0.1/toolkit/xre/nsSigHandlers.cpp:187

(firefox:3174666): Gtk-WARNING **: 18:35:35.342: Theme directory 64/devices of theme Gruvbox has no size field

[GFX1-]: GFX: RenderThread detected a device reset in PostUpdate
[Parent 3174666, Main Thread] WARNING: The program 'firefox' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 1979 error_code 2 request_code 156 (NV-GLX) minor_code 24)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.): 'glib warning', file /usr/src/debug/firefox/firefox-125.0.1/toolkit/xre/nsSigHandlers.cpp:187

(firefox:3174666): Gdk-WARNING **: 18:35:44.945: The program 'firefox' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 1979 error_code 2 request_code 156 (NV-GLX) minor_code 24)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.

Driver works for a while and then crashes with ‘out of memory’ error.
Try to use

NVD_MAX_INSTANCES=2

Value of 11 is way too much for 2 Gb

1 Like

Thank you for your debugging support. Then maybe it’s also a bug that nothing shows in nvidia-settings? Or I have to p(l)ay closer attention.

Is the exec file fine like this and is ok it stays outside home folder in /user/share/applications/firefox.desktop ?

Exec=env LIBVA_DRIVER_NAME=nvidia NVD_BACKEND=direct NVD_MAX_INSTANCES=2 MOZ_DISABLE_RDD_SANDBOX=1 NVD_LOG=1 /usr/lib/firefox/firefox %u

Try

LIBVA_DRIVER_NAME=nvidia NVD_BACKEND=direct NVD_LOG=1 NVD_MAX_INSTANCES=2 MOZ_DISABLE_RDD_SANDBOX=1 firefox 2>&1 | tee nvdec.log

from the Konsole first and see if ‘out of memory’ error is gone

If it’s gone, then modify .desktop file. If not, then I’m afraid it’s not gonna work

No I played the same videos again and also the error came twice.

    256130.718570267 [3227829-3227892] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:1754 nvQuerySurfaceAttributes with 10 (8) (nil) 0
    256130.718572314 [3227829-3227892] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:1754 nvQuerySurfaceAttributes with 10 (8) 0x7fc34c0c0100 8
    256130.720470931 [3227829-3227892] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:1821 nvQuerySurfaceAttributes Returning constraints: width: 128 - 8192, height: 128 - 8192
    256130.720478029 [3227829-3227892] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c: 984          nvCreateContext with 18 render targets, 18 surfaces, at 1920x1080
    256130.975393439 [3227829-3227892] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:1037          nvCreateContext CUDA ERROR 'out of memory' (2)

[...]


256312.122275263 [3227829-3228089] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:2064              nvTerminate Now have 1 (2 max) instances
    256312.368993184 [3227829-3228084] ../nvidia-vaapi-driver-0.0.11/src/vabackend.c:1037          nvCreateContext CUDA ERROR 'out of memory' (2)

Would you keep it like that, or change the exec lines back to default?

Will try with the untouched dev-edition later.

You can comment exec line containing environmental variables with # and use the default line.
Switch between them when necessary.

1 Like

Do you per chance know which one it is?

#Exec=/usr/lib/firefox/firefox %u

#Exec=/usr/lib/firefox/firefox --ProfileManager

I mean, do I have to uncomment both? The last one is at the bottom and lists default-release, default, dev-edition-default to me (create, delete, rename them).