Bug 1305699 - [Wayland] libvdpau fails on (X)Wayland, trying to load libvdpau_nvidia.so on non-nvidia systems
[Wayland] libvdpau fails on (X)Wayland, trying to load libvdpau_nvidia.so on ...
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: libvdpau (Show other bugs)
27
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Nicolas Chauvet (kwizart)
Fedora Extras Quality Assurance
:
Depends On:
Blocks: WaylandRelated
  Show dependency treegraph
 
Reported: 2016-02-08 17:43 EST by Christian Stadelmann
Modified: 2017-10-27 15:33 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
an outdated /var/log/Xorg.0.log (20.29 KB, text/plain)
2016-02-09 06:24 EST, Christian Stadelmann
no flags Details
a more recent Xorg.0.log from ~/.local/share/xorg (25.74 KB, text/plain)
2016-02-09 06:27 EST, Christian Stadelmann
no flags Details
Return early if vdpau_driver isn't autodetected with DRI2 (1.57 KB, patch)
2016-03-01 10:01 EST, Nicolas Chauvet (kwizart)
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
FreeDesktop.org 98453 None None None 2016-10-26 08:31 EDT

  None (edit)
Description Christian Stadelmann 2016-02-08 17:43:21 EST
Description of problem:
Every time I start a libvdpau-based application it tries to load a library for nvidia although there is no nvidia hardware on my system.


Version-Release number of selected component (if applicable):
libvdpau-1.1.1-2.fc23.x86_64


How reproducible:
always


Steps to Reproduce:
1. start a console
2. start any application which uses libvdpau, e.g. vlc media player or vdpauinfo
3. watch output on console


Actual results:
I am getting this output:

Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory


Expected results:
No error messages


Additional info:
It doesn't matter whether I have libvdpau-va-gl or libva-vdpau-driver 
Output of vdpauinfo:
$ vdpauinfo 
display: :0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
Comment 1 Nicolas Chauvet (kwizart) 2016-02-09 04:54:57 EST
I don't reproduce on non-nvidia hardware

Can you attach the output of /var/log/Xorg.log ?
what's the output of echo $VDPAU_DRIVER ?
Do you have dri2 enabled in xorg.conf ?
Any package outside of the well known repositories for fedora ?
Comment 2 Christian Stadelmann 2016-02-09 06:24 EST
Created attachment 1122383 [details]
an outdated /var/log/Xorg.0.log

I am running GDM as display manager and Gnome 3 or KDE Plasma as desktop environments, so there is no recent /var/log/Xorg.log. More stuff to follow.
Comment 3 Christian Stadelmann 2016-02-09 06:27 EST
Created attachment 1122384 [details]
a more recent Xorg.0.log from ~/.local/share/xorg
Comment 4 Christian Stadelmann 2016-02-09 07:13:52 EST
(In reply to Nicolas Chauvet (kwizart) from comment #1)
> what's the output of echo $VDPAU_DRIVER ?

Nothing, i.e. an empty line

> Do you have dri2 enabled in xorg.conf ?

Not to my knowledge. How do I test that?
I've searched /etc/X11 and /usr/share/X11 and the only file there with reference to DRI2 is /usr/share/X11/XErrorDB which ends with these lines:

! DRI2 extension
XRequest.DRI2.0: DRI2QueryVersion
XRequest.DRI2.1: DRI2Connect
XRequest.DRI2.2: DRI2Authenticate
XRequest.DRI2.3: DRI2CreateDrawable
XRequest.DRI2.4: DRI2DestroyDrawable
XRequest.DRI2.5: DRI2GetBuffers
XRequest.DRI2.6: DRI2CopyRegion
XRequest.DRI2.7: DRI2GetBuffersWithFormat	
XRequest.DRI2.8: DRI2SwapBuffers		
XRequest.DRI2.9: DRI2GetMSC			
XRequest.DRI2.10: DRI2WaitMSC			
XRequest.DRI2.11: DRI2WaitSBC			
XRequest.DRI2.12: DRI2SwapInterval

> Any package outside of the well known repositories for fedora ?

As noted above: It happens with and without having libva-intel-driver or libvdpau-va-gl (both from rpmfusion) installed. Otherwise I have VLC and some codec support packages from rpmfusion. Nothing video-related otherwise.
I am on F23 updates-testing but that shouldn't matter since I'm seeing this issue for months now.


Another note: I am running a Gnome+Wayland session, and this issue seems to be specific to wayland sessions (I changed the bug title). On a Gnome+X11 session most videos don't even start to play with this error repeating several times per second on cli (address varies):
[h264 @ 0x7f2dafxxxxxx] hardware accelerator failed to decode picture

VLC keeps repeating these lines when playing videos:

[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0

So this seems to be another issue. Let's keep this report about the issue that libvdpau tries to load nvidia libraries in Gnome+Wayland sessions. Is there any more info I can provide?

This issue can be reproduced with weston when following these steps:
1. run `weston --modules=xwayland.so`
2. inside weston, run vlc or vdpauinfo
Comment 5 Nicolas Chauvet (kwizart) 2016-02-11 02:34:18 EST
Can you enforce VDPAU_DRIVER=va-gl under wayland and have it work ?
Comment 6 Christian Stadelmann 2016-02-11 03:58:30 EST
No, it doesn't work, but it tries to load the correct backend at least:

$ VDPAU_DRIVER=va-gl vdpauinfo 
display: :0   screen: 0
Failed to open VDPAU backend libvdpau_va-gl.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1


$ LC_ALL=C VDPAU_DRIVER=va-gl vlc --avcodec-hw=vdpau
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
shm_open() failed: No such file or directory
[000055f2be6e9308] pulse audio output error: PulseAudio server connection failure: Protocol error
[000055f2be5db198] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Gtk-Message: Failed to load module "canberra-gtk-module"
"sni-qt/3501" WARN  09:44:33.670 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
Failed to open VDPAU backend libvdpau_va-gl.so: cannot open shared object file: No such file or directory
Failed to open VDPAU backend libvdpau_va-gl.so: cannot open shared object file: No such file or directory
[00007fa768001268] xcb_xv vout display error: no available XVideo adaptor


Note: /usr/lib64/vdpau/libvdpau_va_gl.so.1 exists and works fine under pure X11 sessions.
Comment 7 Christian Stadelmann 2016-02-11 04:16:56 EST
Ok, I've should have used the correct name (va_gl instead of va-gl). vdpauinfo shows some information now at least, but both vdpauinfo and vlc run into errors:


$ VDPAU_DRIVER=va_gl vdpauinfo
display: :0   screen: 0
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
API version: 1
Information string: OpenGL/VAAPI/libswscale backend for VDPAU

Video surface:

name   width height types
-------------------------------------------
420     1920  1080  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8
[…]



$ LC_ALL=C VDPAU_DRIVER=va_gl vlc --avcodec-hw=vdpau
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
shm_open() failed: No such file or directory
[00005583ba812308] pulse audio output error: PulseAudio server connection failure: Protocol error
[00005583ba704198] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Gtk-Message: Failed to load module "canberra-gtk-module"
"sni-qt/5832" WARN  10:15:11.700 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[00007f46cc0009c8] vdpau_avcodec generic error: decoder profile not supported: 7
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[00007f46e0001d18] vdpau_display vout display error: video mixer surface width capabilities query failure: VDP_STATUS_NO_IMPLEMENTATION
[00007f46e0001d18] xcb_xv vout display error: no available XVideo adaptor
Comment 8 Olivier Fourdan 2016-02-18 12:12:50 EST
The reason for this is simple, I think.

libvdpau loads the driver in this order:

1. Check for the driver name to load from the env variable VDPAU_DRIVER
2. If not set, try to get the driver name from dri2
3. If fails, use nvidia.

On Wayland, xdriinfo fails with "not direct rendering capable" which is probably why libvdpau can;t get the driver name from dri2, and thus falls back to nvidia as hardcoded.
Comment 9 Nicolas Chauvet (kwizart) 2016-03-01 09:59:36 EST
libvdpau still is Xlib/xcb_xv based IIRC. So I don't expect it to work under wayland (or even DRI3) for any driver. At least It shouldn't fall back to nvidia and later send an error that it won't work.

BTW, is there a crash triggered by trying to use vdpau under wayland ? Because right now this is just an unrelated and pointless information with no crash.

I can try to error out earlier to see if that helps but I don't think the patch I have will fix the issue that some player are experiencing with trying vdpau and not to fallback to vaapi if possible.
Comment 10 Nicolas Chauvet (kwizart) 2016-03-01 10:01 EST
Created attachment 1131965 [details]
Return early if vdpau_driver isn't autodetected with DRI2
Comment 11 Nicolas Chauvet (kwizart) 2016-03-01 10:01:57 EST
koji scratch build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=13189367
Comment 12 Christian Stadelmann 2016-03-01 10:35:43 EST
(In reply to Nicolas Chauvet (kwizart) from comment #9)
> libvdpau still is Xlib/xcb_xv based IIRC. So I don't expect it to work under
> wayland (or even DRI3) for any driver. At least It shouldn't fall back to
> nvidia and later send an error that it won't work.

That's bad. Is there any chance to change that? It would be pretty bad having no video acceleration for playing videos e.g. with VLC. LibVA seems to have the same issue.

> BTW, is there a crash triggered by trying to use vdpau under wayland ?
> Because right now this is just an unrelated and pointless information with
> no crash.

I don't see crashes from vdpau. 
 
> I can try to error out earlier to see if that helps but I don't think the
> patch I have will fix the issue that some player are experiencing with
> trying vdpau and not to fallback to vaapi if possible.

Ok.


With your scratch build, on a gnome+wayland session, I ran vdpauinfo and vlc again. It looks better now, with vdpau not trying to load nvidia drivers by default. Still doesn't work on wayland as you noted above.

$ vdpauinfo
display: :0   screen: 0
No vdpau backend found, try to set one using VDPAU_DRIVER=nvidia
Error creating VDPAU device: 1

$ VDPAU_DRIVER=va_gl vdpauinfo
display: :0   screen: 0
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
API version: 1
Information string: OpenGL/VAAPI/libswscale backend for VDPAU

Video surface:

name   width height types
-------------------------------------------
420     1920  1080  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 
422     1920  1080  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 
444     1920  1080  NV12 YV12 UYVY YUYV 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         21928 21928    -  
R8G8B8A8         21928 21928    -  
R10G10B10A2      21928 21928    -  
B10G10R10A2      21928 21928    -  
A8               21928 21928    -  

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             -
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                -  


$ LC_ALL=C VDPAU_DRIVER=va_gl vlc --avcodec-hw=vdpau
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
[0000564813beb198] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Gtk-Message: Failed to load module "canberra-gtk-module"
"sni-qt/31875" WARN  16:30:40.300 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[00007f09280009c8] vdpau_avcodec generic error: decoder profile not supported: 8
[VS] Software VDPAU backend library initialized
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
[00007f0940003b88] vdpau_display vout display error: video mixer surface width capabilities query failure: VDP_STATUS_NO_IMPLEMENTATION
[00007f0940003b88] xcb_xv vout display error: no available XVideo adaptor
Comment 13 Nick Lee 2016-10-22 02:36:33 EDT
The same issue.
Fedora 25
GPU [AMD/ATI] RV620/M82 [Mobility Radeon HD 3450/3470]

==================
$ vdpauinfo
display: :0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
==================

With VDPAU_DRIVER=radeonsi:

==================
$ VDPAU_DRIVER=radeonsi 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                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                 --- not supported ---
==================

==================
$ VDPAU_DRIVER=radeonsi mpv --vo=vdpau 'movie [720p].mp4' 
Playing: movie [720p].mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) (aac)
AO: [pulse] 44100Hz stereo 2ch float
VO: [vdpau] 1280x720 yuv420p
[vo/vdpau] Compositing window manager detected. Assuming timing info is inaccurate.
(Paused) AV: 00:00:00 / 00:07:16 (0%) A-V:  0.000 Cache: 10s+78MB
[+-----------------------------------------------------------------------------]
Comment 14 Nicolas Chauvet (kwizart) 2016-10-22 04:00:36 EDT
(In reply to Nick Lee from comment #13)
> The same issue.
> Fedora 25
> GPU [AMD/ATI] RV620/M82 [Mobility Radeon HD 3450/3470]
Thx for your report.
This is very interesting as it seems to prove that you can run vdpau under XWayland.

Can you try with a vaapi enabled player (as you are using radeonsi, you should be able to use vaapi under wayland).

Thx
Comment 15 Nick Lee 2016-10-22 08:48:23 EDT
(In reply to Nicolas Chauvet (kwizart) from comment #14)
> Can you try with a vaapi enabled player (as you are using radeonsi, you
> should be able to use vaapi under wayland).

Thanks for replay. Here you are:
============================
$ LIBVA_DRIVER_NAME=radeonsi vainfo
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib64/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.2)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264Baseline           :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

============================
$ LIBVA_DRIVER_NAME=radeonsi mpv 'movie [720p].mp4' --hwdec=vaapi --vo=vaapi
Playing: movie [720p].mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=und (*) (aac)
libva info: VA-API version 0.39.3
libva info: va_getDriverName() returns -1
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib64/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
AO: [pulse] 44100Hz stereo 2ch float
Using hardware decoding (vaapi).
VO: [vaapi] 1280x720 vaapi
AV: 00:02:14 / 00:07:16 (30%) A-V:  0.000 Cache: 10s+56MB
[-----------------------+------------------------------------------------------]
=============================
I can't check gstreamer. I filed the bug report https://bugzilla.redhat.com/show_bug.cgi?id=1387852
Comment 16 Christian Stadelmann 2017-05-24 05:42:29 EDT
Backend detection is still broken under wayland. Upstream (mesa) refuses to fix this bug, as it is a bug in vdpau in their opinion.

I was unable to find an upstream bug tracker and it seems the project is dead.

Note You need to log in before you can comment on or make changes to this bug.