Failed vaapi init

I’ve tried to turn on vaapi support in chrome, but during inspection of installed drivers found that vaapi can’t be initialized:

$ vainfo                                                                                                                                                                                                         
libva info: VA-API version 1.14.0
libva info: Trying to open /run/opengl-driver/lib/dri/iHD_drv_video.so
libva error: /run/opengl-driver/lib/dri/iHD_drv_video.so has no function __vaDriverInit_1_0
libva info: Trying to open /usr/lib/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib32/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /run/opengl-driver/lib/dri/i965_drv_video.so
libva error: /run/opengl-driver/lib/dri/i965_drv_video.so has no function __vaDriverInit_1_0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Trying to open /usr/lib32/dri/i965_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

So I getting this error.

My video configuration:

  hardware.opengl = {
      enable = true;
      driSupport = true;
      extraPackages = with pkgs; [
          intel-compute-runtime
          intel-media-driver
          vaapiIntel
          vaapiVdpau
          libvdpau-va-gl
      ];
  };
  services.xserver.videoDrivers = ["intel"];
  services.xserver.deviceSection = ''
    Option "TearFree" "true"
  '';

Nix-info output:

$ nix-info -m            
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.77, NixOS, 22.11 (Raccoon), 22.11.20221107.667e558`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(gdr): `""`
 - channels(root): `"home-manager-22.05.tar.gz, nixos-22.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Any ideas what am I doing wrong?

The nixos-hardware module for intel GPUs also sets this variable, which might be required: nixos-hardware/intel.nix at e0452b33ab0ef16ffe075e980644ed92a6a200bb · NixOS/nixos-hardware · GitHub

Which is to say, maybe use the nixos-hardware module? :slight_smile:

If you have a recentish intel CPU you only need intel-media-driver. Otherwise you want vaapiIntel.
vaapiVdpau is something for nvidia and vaapi. You don’t need that. libvdpau-va-gl is some legacy comp layer you also don’t really need. driSupport is true by default but doesn’t hurt also.

For Chrome/Chromium you also most likely need the following overlay otherwise the blacklist is way to strict.

  chromium = prev.chromium.override {
    # enable hardware accerlation with vaapi
    commandLineArgs = "--enable-features=VaapiVideoEncoder,VaapiVideoDecoder";
  }

Are you using the vainfo from nixpkgs? Do /run/opengl-driver/lib/dri/iHD_drv_video.so and /run/opengl-driver/lib/dri/i965_drv_video.so exist and lead to valid shared objects?

That is not shown on NixOS Search . Is that even valid?

1 Like