You are not logged in.

#1 2017-06-05 09:27:20

gkmcd
Member
Registered: 2016-05-15
Posts: 3

[solved] VLC hardware video decoding (VDPAU/VA-API) with AMDGPU

I have been unable to get VLC to properly use hardware decoding with my XFX Radeon RX480. Im using the mainline AMDGPU kernel driver (not AMDGPU-PRO). Unfortunately the Hardware Video Acceleration wiki page doesn't provide much clear information as it still refers mainly to the Catalyst drivers.

With environment vars set as follows:

   VDPAU_DRIVER=radeonsi
   LIBVA_DRIVER_NAME=radeonsi

VLC reports:

	❯ vlc channels.xspf
	VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
	[0000000001284148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
	[000000000136bed8] core playlist: stopping playback
	libva info: VA-API version 0.40.0
	libva info: va_getDriverName() returns 1
	libva info: User requested driver 'radeonsi'
	libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
	libva info: Found init function __vaDriverInit_0_40
	amdgpu: amdgpu_device_initialize failed.
	do_winsys_init: DRM version is 3.10.0 but this driver is only compatible with 2.12.0 (kernel 3.2) or later.
	libva error: /usr/lib/dri/radeonsi_drv_video.so init failed
	libva info: va_openDriver() returns 2
	[00007f027400a1a8] vaapi_drm generic error: Failed to initialize the VAAPI device

With environment vars set as follows:

   VDPAU_DRIVER=va_gl
   LIBVA_DRIVER_NAME=radeonsi

VLC output is similar but seems to repeat for some reason:

	❯ vlc channels.xspf
	VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
	[0000000000837148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
	[000000000091eed8] core playlist: stopping playback
	libva info: VA-API version 0.40.0
	libva info: va_getDriverName() returns 1
	libva info: User requested driver 'radeonsi'
	libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
	libva info: Found init function __vaDriverInit_0_40
	amdgpu: amdgpu_device_initialize failed.
	do_winsys_init: DRM version is 3.10.0 but this driver is only compatible with 2.12.0 (kernel 3.2) or later.
	libva error: /usr/lib/dri/radeonsi_drv_video.so init failed
	libva info: va_openDriver() returns 2
	[00007f8c3400a9d8] vaapi_drm generic error: Failed to initialize the VAAPI device
	libva info: VA-API version 0.40.0
	libva info: va_getDriverName() returns -1
	libva info: User requested driver 'radeonsi'
	libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
	libva info: Found init function __vaDriverInit_0_40
	libva info: va_openDriver() returns 0

If I set LIBVA_DRIVER_NAME=vdpau, VLC segfaults upon loading a video.

VDPAU output:

	display: :0   screen: 0
	API version: 1
	Information string: G3DVL VDPAU Driver Shared Library version 1.0

	Video surface:

	name   width height types
	-------------------------------------------
	420    16384 16384  NV12 YV12 
	422    16384 16384  UYVY YUYV 
	444    16384 16384  Y8U8V8A8 V8U8Y8A8 

	Decoder capabilities:

	name                        level macbs width height
	----------------------------------------------------
	MPEG1                          --- not supported ---
	MPEG2_SIMPLE                    3 65536  4096  4096
	MPEG2_MAIN                      3 65536  4096  4096
	H264_BASELINE                  52 65536  4096  4096
	H264_MAIN                      52 65536  4096  4096
	H264_HIGH                      52 65536  4096  4096
	VC1_SIMPLE                      1 65536  4096  4096
	VC1_MAIN                        2 65536  4096  4096
	VC1_ADVANCED                    4 65536  4096  4096
	MPEG4_PART2_SP                  3 65536  4096  4096
	MPEG4_PART2_ASP                 5 65536  4096  4096
	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       0 65536  4096  4096
	H264_EXTENDED                  --- not supported ---
	H264_PROGRESSIVE_HIGH          --- not supported ---
	H264_CONSTRAINED_HIGH          --- not supported ---
	H264_HIGH_444_PREDICTIVE       --- not supported ---
	HEVC_MAIN                      186 65536  4096  4096
	HEVC_MAIN_10                   186 65536  4096  4096
	HEVC_MAIN_STILL                --- not supported ---
	HEVC_MAIN_12                   --- not supported ---
	HEVC_MAIN_444                  --- not supported ---

	Output surface:

	name              width height nat types
	----------------------------------------------------
	B8G8R8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
	R8G8B8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
	R10G10B10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 
	B10G10R10A2      16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A8I8 I8A8 

	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             y
	DEINTERLACE_TEMPORAL_SPATIAL     -
	INVERSE_TELECINE                 -
	NOISE_REDUCTION                  y
	SHARPNESS                        y
	LUMA_KEY                         y
	HIGH QUALITY SCALING - L1        y
	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              y        48     4096
	VIDEO_SURFACE_HEIGHT             y        48     4096
	CHROMA_TYPE                      y  
	LAYERS                           y         0        4

	attribute name                  sup      min      max
	-----------------------------------------------------
	BACKGROUND_COLOR                 y  
	CSC_MATRIX                       y  
	NOISE_REDUCTION_LEVEL            y      0.00     1.00
	SHARPNESS_LEVEL                  y     -1.00     1.00
	LUMA_KEY_MIN_LUMA                y  
	LUMA_KEY_MAX_LUMA                y  

vainfo output:

	libva info: VA-API version 0.40.0
	libva info: va_getDriverName() returns 0
	libva info: User requested driver 'radeonsi'
	libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
	libva info: Found init function __vaDriverInit_0_40
	libva info: va_openDriver() returns 0
	vainfo: VA-API version: 0.40 (libva )
	vainfo: Driver version: mesa gallium vaapi
	vainfo: Supported profile and entrypoints
	      VAProfileMPEG2Simple            :	VAEntrypointVLD
	      VAProfileMPEG2Main              :	VAEntrypointVLD
	      VAProfileVC1Simple              :	VAEntrypointVLD
	      VAProfileVC1Main                :	VAEntrypointVLD
	      VAProfileVC1Advanced            :	VAEntrypointVLD
	      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
	      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
	      VAProfileH264Main               :	VAEntrypointVLD
	      VAProfileH264Main               :	VAEntrypointEncSlice
	      VAProfileH264High               :	VAEntrypointVLD
	      VAProfileH264High               :	VAEntrypointEncSlice
	      VAProfileHEVCMain               :	VAEntrypointVLD
	      VAProfileHEVCMain10             :	VAEntrypointVLD
	      VAProfileNone                   :	VAEntrypointVideoProc

Solved

Force VDPAU in VLC settings. Set only VDPAU_DRIVER=radeonsi.  Do not set LIBVA_DRIVER_NAME .

Last edited by gkmcd (2017-06-06 08:57:47)

Offline

#2 2017-06-05 14:57:59

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [solved] VLC hardware video decoding (VDPAU/VA-API) with AMDGPU

try LIBVA_DRIVER_NAME=vdpau and NOT setting VDPAU_DRIVER

In vlc, set hw acceleration to anything-but-automatic , apply .
change hw acceleration to automatic , apply again.
quit vlc and restart.

Vlc seems to save what it autodetects and use it every time after that.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2017-06-05 16:09:53

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] VLC hardware video decoding (VDPAU/VA-API) with AMDGPU

Lone_Wolf wrote:

try LIBVA_DRIVER_NAME=vdpau

That would set the use of a vaapi-vdpau wrapper, which is not good. The overhead of these wrappers negates any benefit you gain from hardware decoding, if they work at all (the other wrapper, libvdpau-va-gl, does not work with VLC anymore).

Setting both variables (LIBVA_DRIVER_NAME and VDPAU_DRIVER) to radeonsi is the only correct setting. Or not setting any variables at all, they're not needed anymore with the latest mesa. All you need is the libva-mesa-driver package for VAAPI and the mesa-vdpau package for VDPAU.

@gkcmd: It seems VLC wants to use VAAPI in your case. While this should work (no idea why it doesn't for you, I can't make sense of that error), I'd recommend VDPAU, VLC has better support for it. So go into VLC settings and set VDPAU both in the decoder section and the video output section. Also, to avoid the use of wrappers, uninstall libva-vdpau-driver and libvdpau-va-gl if you have them installed.

Offline

#4 2017-06-06 08:51:06

gkmcd
Member
Registered: 2016-05-15
Posts: 3

Re: [solved] VLC hardware video decoding (VDPAU/VA-API) with AMDGPU

With neither env set, and VLC changed from automatic to VDPAU, VLC says:

❯ vlc channels.xspf
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
[00000000013cf148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00000000014b6ed8] core playlist: stopping playback
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[00007ffb80009f98] core video output error: video output creation failed
[00007ffb8809cac8] core decoder error: failed to create video output

Why does VLC try to use the nvidia VDPAU driver?

According to the Arch wiki, the default can be found with the following command:

❯ grep -iE 'vdpau|dri driver' ~/.local/share/xorg/Xorg.0.log 
[    26.626] (II) AMDGPU(0): [DRI2]   DRI driver: radeonsi
[    26.626] (II) AMDGPU(0): [DRI2]   VDPAU driver: radeonsi

So for some reason VLC defaults to looking for nvida driver for some reason, despite the above.

So if I set VDPAU_DRIVER=radeonsi, and do not set LIBVA_DRIVER_NAME at all, VLC says:

❯ vlc channels.xspf
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
[000000000085f148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000000000946ed8] core playlist: stopping playback
[00007ffa440962e8] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.

Success! Thanks for the help guys, this has been annoying me for some time. I have also uninstalled libvdpau-va-gl and libva-vdpau-driver.

Last edited by gkmcd (2017-06-06 08:53:54)

Offline

#5 2017-06-06 11:48:42

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: [solved] VLC hardware video decoding (VDPAU/VA-API) with AMDGPU

If libvdpau can't find a suitable driver it will fall back to nvidia (yeah that's weird, but Nvidia created vdpau and was for some time the only user of it). The question is, why can't libvdpau find a suitable driver in your case. Most likely it's because of libglvnd, it wouldn't be the first time libglvnd has caused problems. So it seems setting VDPAU_DRIVER is now a strict requirement.

Offline

Board footer

Powered by FluxBB