Bug 250325

Summary: graphics/mesa-gallium-va: libva error: /usr/local/lib/dri/radeonsi_drv_video.so init failed
Product: Ports & Packages Reporter: Alexander Vereeken <Alexander88207>
Component: Individual Port(s)Assignee: freebsd-x11 (Nobody) <x11>
Status: New ---    
Severity: Affects Only Me CC: gja822, jbeich, manu, nsonack, pi, rozhuk.im, zeising
Priority: --- Keywords: regression
Version: LatestFlags: bugzilla: maintainer-feedback? (x11)
Hardware: Any   
OS: Any   

Description Alexander Vereeken 2020-10-13 20:30:48 UTC
Hello,

i saw the new mesa update and i have rebuilt mesa-libs, mesa-dri and installed gallium-va and gallium-vdpau.

Now i wanted to confirm if its working but i get:

libva info: VA-API version 1.9.0
libva info: Trying to open /usr/local/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva error: /usr/local/lib/dri/radeonsi_drv_video.so init failed
libva info: va_openDriver() returns 2
vaInitialize failed with error code 2 (resource allocation failed),exit

and with vdpauinfo i get:

display: :0   screen: 0
Error creating VDPAU device: 23

Have i forgotten something? I using an RX 570

[ 42742.925] (II) AMDGPU(0): [DRI2] Setup complete
[ 42742.925] (II) AMDGPU(0): [DRI2]   DRI driver: radeonsi
[ 42742.925] (II) AMDGPU(0): [DRI2]   VDPAU driver: radeonsi

Before the update, it have worked perfectly. 

Many thanks in advance.
Comment 1 rozhuk.im 2020-10-29 20:52:30 UTC
Same for me:

kodi@kodi# env DISPLAY=unix:0.0 vainfo
libva info: VA-API version 1.9.0
libva info: Trying to open /usr/local/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva error: /usr/local/lib/dri/radeonsi_drv_video.so init failed
libva info: va_openDriver() returns 2
vaInitialize failed with error code 2 (resource allocation failed),exit
Exit 3
kodi@kodi# vainfo
error: can't connect to X server!
libva info: VA-API version 1.9.0
libva info: Trying to open /usr/local/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_9
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.9 (libva 2.9.1)
vainfo: Driver version: Mesa Gallium driver 20.2.0 for AMD RAVEN (DRM 3.27.0, 12.2-STABLE, LLVM 10.0.1)
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
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
Comment 2 wjenkner 2020-10-30 16:03:05 UTC
Same here with the r600 drivers for an AMD CAICOS.

With graphics/mesa-devel things work perfectly (with the default
libmap.d/mesa-devel.conf).
Comment 3 Jan Beich freebsd_committer 2020-10-30 17:26:49 UTC
(In reply to rozhuk.im from comment #1)
> kodi@kodi# vainfo
> error: can't connect to X server!

Likely related to -Dglx=disabled because X11 support requires vl_dri*_screen_create implementation, otherwise stubs are used.

https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-20.2.0/src/gallium/auxiliary/vl/vl_winsys.h#L83-84
https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-20.2.0/src/gallium/frontends/va/context.c#L128-132

(In reply to wjenkner from comment #2)
> With graphics/mesa-devel things work perfectly

Thanks for testing as I don't have AMD GPUs. Like -DPREFER_IRIS in bug 250307 the issue appears to be caused by discrepancy of build options between mesa-* ports.
Comment 4 Jan Beich freebsd_committer 2020-10-30 17:45:12 UTC
Marking as a regression from ports r552109 i.e., mesa-dri + VAAPI split into mesa-gallium-va.
Comment 5 rozhuk.im 2020-10-30 18:58:42 UTC
(In reply to Jan Beich from comment #3)
> env DISPLAY=unix:0.0 vainfo

I run this from ssh + "su -l".
Looks like if no DISPLAY set and it fails connect to it, but show VAAPI caps, probably using "case VA_DISPLAY_DRM".


> Likely related to -Dglx=disabled because X11 support requires vl_dri*_screen_create implementation, otherwise stubs are used.

graphics/mesa-devel have different build options?
Comment 6 Jan Beich freebsd_committer 2020-10-31 00:54:38 UTC
Oops, I was off a bit. -Dglx=disabled doesn't completely disable X11 support, removing "x11" from -Dplatforms="..." would but it isn't explicitly passed by mesa-gallium-*/Makefile. Looking at -DHAVE_*_PLATFORM it seems only Wayland is auto-enabled.

http://beefy6.nyi.freebsd.org/data/latest-per-pkg/mesa-gallium-va/20.2.0_1/121amd64-default.log
http://beefy6.nyi.freebsd.org/data/latest-per-pkg/mesa-gallium-vdpau/20.2.0_1/121amd64-default.log

(In reply to rozhuk.im from comment #5)
> graphics/mesa-devel have different build options?

mesa-devel builds *_drv_video.so with X11 enabled i.e., -Dglx=auto (default) and -Dplatforms=x11,wayland

mesa-dri and mesa-libs have X11 enabled but clover, libosmesa, mesa-gallium-va, mesa-gallium-vdpau, mesa-gallium-xa have X11 disabled.
Comment 7 gja822 2020-11-12 13:36:46 UTC
I have similar problem with radeonkms r600 (HD3000).
Error 23 with vdpauinfo.