[vaapi] libva: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)

Bug #1944088 reported by David Shochat
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mpv (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Since upgrading to 21.04 with wayland, mpv has been issuing warnings (suggesting X session) but performing without any problem, including with mp4 files. Until recently. Now the result is:

wl_drm@22: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
[vaapi] libva: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
[vo/gpu/wayland] Error occurred on the display fd, closing

No problem if mpv is invoked with --hwdec=no. According to the mpv man page, this is the default, Perhaps it was until recently (masking the problem by using SW decoding).

The abort occurs with every mp4 file I have tried, and with no other types.

ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: mpv 0.32.0-2ubuntu2
ProcVersionSignature: Ubuntu 5.13.0-7614.14~1631647151~21.04~930e87c~dev-generic 5.13.1
Uname: Linux 5.13.0-7614-generic x86_64
ApportVersion: 2.20.11-0ubuntu65.3
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Sun Sep 19 14:05:19 2021
InstallationDate: Installed on 2018-04-28 (1240 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: mpv
UpgradeStatus: Upgraded to hirsute on 2021-05-01 (141 days ago)

Revision history for this message
David Shochat (david-shochat) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I can't seem to reproduce any such problem in 21.10 but have not tested 21.04 ...

Please run:

  sudo apt install vainfo
  lspci -kv > lspci.txt
  vainfo > vainfo.txt

and attach the resulting text files here.

Changed in mpv (Ubuntu):
status: New → Incomplete
Revision history for this message
David Shochat (david-shochat) wrote :

vainfo produced no standard output, but gave (in standard error) a very similar error message to the one I reported when attempting mpv on an mp4 file:

wl_drm@7: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
libva info: VA-API version 1.10.0
libva error: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
vaInitialize failed with error code 3 (invalid VADisplay),exit

Revision history for this message
David Shochat (david-shochat) wrote :

I tried running vainfo on my laptop (also running 21.04) and got the same error.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It appears your Mesa and other graphics libraries are not from Ubuntu, but are from LP-PPA-system76-dev-stable and that might be confusing the standard VAAPI driver packages you have installed.

We can't support PPAs here so if you don't need Pop!OS then I would recommend removing the PPA from your system using 'ppa-purge'.

summary: - mpv aborts on mp4 files
+ [vaapi] libva: vaGetDriverNameByIndex() failed with invalid VADisplay,
+ driver_name = (null)
Changed in mpv (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Also I did just freshly install a 21.04 machine and vainfo/mpv work there using either of these drivers:

  sudo apt install intel-media-va-driver # Same as yours
  sudo apt install intel-media-va-driver-non-free

Revision history for this message
David Shochat (david-shochat) wrote :

ppa-purge failed (didn't want to replace running kernel and it couldn't find aptitude), leaving the system unstable. Did a clean reinstall of 21.04 from ISO to get a usable system (obviously without PPAs), restored home dir from nightly backup. Back in business ...
mpv can now do mp4 files without error and vainfo also works without error.
So you were right. But I think ppa-purge needs work.
Thanks.

Revision history for this message
Hernan Gonzalez (nuco) wrote :

Hello, i am getting the same mpv error when trying to play mp4 files.
Using 20.04.3 LTS with no video driver PPAs.

vainfo shows this error:

wl_drm@7: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
libva info: VA-API version 1.7.0
libva error: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
vaInitialize failed with error code 3 (invalid VADisplay),exit

mpv shows the same error:

 (+) Video --vid=1 (*) (h264 1920x1038 23.976fps)
 (+) Audio --aid=1 --alang=spa (*) (aac 2ch 44100Hz)
 (+) Subs --sid=1 (*) (subrip)
[vo/gpu/wayland] GNOME's wayland compositor is known to have many serious issues with mpv. Switch to GNOME's xorg session for the best experience.
wl_drm@22: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
[vaapi] libva: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
[vo/gpu/wayland] Error occurred on the display fd, closing

Exiting... (Quit)

Revision history for this message
David Shochat (david-shochat) wrote :

You say "with no video driver PPAs". As an experiment, you could try, as I did, with NO PPAs (e.g. by doing a clean reinstall from ISO). Perhaps it's due to a PPA that is not obviously related. Also, could the fact that you are on 20.04.3 be a problem? If so, but you require the LTS, you could use the --hwdec=no workaround until 22.04 LTS is available.

Revision history for this message
Hernan Gonzalez (nuco) wrote :

Unfortunately i cant do a clean install since this is my main machine.
As a workarround i set hwdec=drm in /etc/mpv/mpv.conf and it works just fine, don't know if the vaapi error affects any other programs.

if i set the display to drm in vainfo i get no errors.

vainfo --display drm

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 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
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
      VAProfileVP8Version0_3 : VAEntrypointEncSlice
      VAProfileHEVCMain : VAEntrypointVLD
      VAProfileHEVCMain : VAEntrypointEncSlice
      VAProfileHEVCMain : VAEntrypointFEI
      VAProfileHEVCMain10 : VAEntrypointVLD
      VAProfileHEVCMain10 : VAEntrypointEncSlice
      VAProfileVP9Profile0 : VAEntrypointVLD
      VAProfileVP9Profile2 : VAEntrypointVLD

Revision history for this message
Andrei Borzenkov (arvidjaar-s) wrote :

I get the same error on Ubuntu 20.04.3. The problem here is likely caused by Mesa drivers update to 21.2.6. Looks like Mesa 21 has changes in Wayland authentication and it requires fix to libva (https://github.com/intel/libva/pull/476). The fix should be present in libva 2.11 and above while Ubuntu 20.04.3 ships libva 2.6.

I verified it using compiled libva/libva-utils from current upstream git. with current upstream

bor@bor-Latitude-E5450:~/src/intel/libva-utils$ ./vainfo/vainfo
libva info: VA-API version 1.15.0
libva info: Trying to open /home/bor/pkg/lib/dri/iHD_drv_video.so
libva info: va_openDriver() returns -1
libva info: Trying to open /home/bor/pkg/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_6
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.15 (libva 2.15.0.pre1)
vainfo: Driver version: Intel i965 driver for Intel(R) Broadwell - 2.4.0
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
      VAProfileVP8Version0_3 : VAEntrypointVLD
bor@bor-Latitude-E5450:~/src/intel/libva-utils$

With *only* commit 283f776a9649dcef58b47958c1269499adfa1cd4 reverted

bor@bor-Latitude-E5450:~/src/intel/libva-utils$ ./vainfo/vainfo
wl_drm@7: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
libva info: VA-API version 1.15.0
libva error: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)
vaInitialize failed with error code 3 (invalid VADisplay),exit
bor@bor-Latitude-E5450:~/src/intel/libva-utils$

Please update libva/vainfo in 20.04.3 to match Mesa. I can open new bug for 20.04 if needed.

Revision history for this message
Andrei Borzenkov (arvidjaar-s) wrote :

And mpv works just fine with upstream libva under Wayland without any other changes.

bor@bor-Latitude-E5450:~$ mpv video.mkv
 (+) Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 --alang=en (*) (ac3 2ch 48000Hz)
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
wl_drm@22: error 0: authenticate failed
VA error: wayland: Wayland roundtrip error: Protocol error (errno 71)
[vaapi] libva: vaGetDriverNameByIndex() failed with invalid VADisplay, driver_name = (null)

and

bor@bor-Latitude-E5450:~$ LD_LIBRARY_PATH=/home/bor/pkg/lib mpv video.mkv
 (+) Video --vid=1 (*) (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 --alang=en (*) (ac3 2ch 48000Hz)
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
Cannot load libcuda.so.1
Using hardware decoding (vaapi).
VO: [gpu] 1920x1080 vaapi[nv12]

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hernan, Andrei,

This bug is closed and was about a machine-specific issue on 21.04. Please open a new bug to track your issue in 20.04.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.