Jump to content

Ubuntu 20.04.1 - Ryzen HWA


ArminS

Recommended Posts

Hello dear users and emby team,

i am running emby on an Ryzen 3200G, in a fresh ubuntu server 20.04.1 installation with so far only xubuntu-desktop (xfce4 - lightdm) installed and was trying to get emby to work with hardware accelleration.

The images are in german, but you get the point.

empty list.PNG

 

I am not asking for help right now, because i got it working after 1 hour of troubleshooting, but i want to share my solution with you. didn't seem too work that well

I will share the steps i have taken so far.

 

I was pretty confident that HWA was working because i could run 12 instances of glxgears with steady 60fps without the cpu breaking a sweat.

armin@srv1:~$ cat test.sh
for i in $(seq -f "%02g" 1 12)
do
  DISPLAY=:0 glxgears | ts "instance ${i}:" &
  sleep .05
done
armin@srv1:~$ sh test.sh
[..]
instance 01: 301 frames in 5.0 seconds = 60.000 FPS
instance 02: 300 frames in 5.0 seconds = 59.994 FPS
instance 03: 300 frames in 5.0 seconds = 59.997 FPS
instance 04: 300 frames in 5.0 seconds = 59.987 FPS
instance 05: 301 frames in 5.0 seconds = 60.002 FPS
instance 06: 300 frames in 5.0 seconds = 59.989 FPS
instance 07: 301 frames in 5.0 seconds = 60.002 FPS
instance 08: 300 frames in 5.0 seconds = 59.998 FPS
instance 10: 300 frames in 5.0 seconds = 59.983 FPS
instance 09: 300 frames in 5.0 seconds = 59.993 FPS
instance 11: 301 frames in 5.0 seconds = 60.001 FPS
instance 12: 300 frames in 5.0 seconds = 59.971 FPS
[..]

 

vainfo (after a quick apt install) is also telling me that HWA should be available.

armin@srv1:~$ DISPLAY=:0 vainfo
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_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: Mesa Gallium driver 20.0.8 for AMD RAVEN (DRM 3.35.0, 5.4.0-52-generic, LLVM 10.0.0)
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

 

Checking the user rights for access also seemed to check out.

root@srv1:~# ls -lha /dev/dri
total 0
drwxr-xr-x   3 root root        100 Oct 22 16:37 .
drwxr-xr-x  24 root root       4.6K Oct 22 16:37 ..
drwxr-xr-x   2 root root         80 Oct 22 16:37 by-path
crw-rw----+  1 root video  226,   0 Oct 22 16:37 card0
crw-rw----+  1 root render 226, 128 Oct 22 16:37 renderD128
root@srv1:~# groups emby
emby : emby video render

 

In another thread ( hardware-encoders-list-is-blank ) i found this handy command with told me a was missing some libraries.

root@srv1:~# sudo -u emby sh -c '/opt/emby-server/bin/ffdetect vaenc'
/opt/emby-server/bin/ffdetect: error while loading shared libraries: libmfx.so.1: cannot open shared object file: No such file or directory

Sadly emby only states "Failed to initialize VA /dev/dri/renderD128. Error -1" in the hardware_detection log, but i thought of course it is throwing an error at me if it tries to use ffdetect to check for available hardware enc/decoders. At this point it would be probably a good idea to add a more detailed output of the probe of the detection log. ( kindly asking :-), i'll attach the log for comparison )

 

A quick lookup (ubuntu.pkgs.org) for the package told me is was part of the Intel Media SDK which i don't think i will be needing in full on my ryzen so i just tried to install only this particular package.

root@srv1:~# apt-get install libmfx1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  libmfx1
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 2773 kB of archives.
After this operation, 24.7 MB of additional disk space will be used.
Get:1 http://de.archive.ubuntu.com/ubuntu focal/universe amd64 libmfx1 amd64 20.1.0-0ubuntu1 [2773 kB]
Fetched 2773 kB in 1s (3745 kB/s)
Selecting previously unselected package libmfx1:amd64.
(Reading database ... 164519 files and directories currently installed.)
Preparing to unpack .../libmfx1_20.1.0-0ubuntu1_amd64.deb ...
Unpacking libmfx1:amd64 (20.1.0-0ubuntu1) ...
Setting up libmfx1:amd64 (20.1.0-0ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
root@srv1:~# 

 

Having that done i've tried the command once again and ffdetect could be executed.

armin@srv1:~$ sudo -u emby sh -c '/opt/emby-server/bin/ffdetect vaenc'
ffdetect version 4.3.0-emby_2020_05_23 Copyright (c) 2018-2019 softworkz for Emby LLC
  built with gcc 8.3.0 (crosstool-NG 1.24.0)
  configuration: --cc=x86_64-unknown-linux-gnu-gcc --prefix=/home/embybuilder/Buildbot/x64/ffmpeg-x64/staging --disable-amf --disable-debug --disable-doc --disable-ffplay --disable-vdpau --disable-xlib --enable-fontconfig --enable-gnutls --enable-gpl --enable-iconv --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzvbi --enable-version3 --enable-libsmbclient --enable-libdav1d --enable-libvpx --enable-cuda-llvm --enable-cuvid --enable-libmfx --enable-nvdec --enable-nvenc --enable-vaapi --enable-cross-compile --cross-prefix=x86_64-unknown-linux-gnu- --extra-libs='-lexpat -lfreetype -lfribidi -lfontconfig -liconv -lpng -lz -lvorbis -logg -lnettle -lhogweed -lgmp -laddns-samba4 -lasn1util-samba4 -lauthkrb5-samba4 -lCHARSET3-samba4 -lcliauth-samba4 -lcli-cldap-samba4 -lcli-ldap-common-samba4 -lcli-nbt-samba4 -lcli-smb-common-samba4 -lcom_err -lcommon-auth-samba4 -ldbwrap-samba4 -ldcerpc-binding -ldcerpc-samba-samba4 -ldl -lflag-mapping-samba4 -lgenrand-samba4 -lgensec-samba4 -lgse-samba4 -lgssapi_krb5 -llibcli-lsa3-samba4 -llibsmb-samba4 -linterfaces-samba4 -liov-buf-samba4 -lk5crypto -lkrb5 -lkrb5samba-samba4 -lkrb5support -lldb -lldbsamba-samba4 -lm -lmessages-dgm-samba4 -lmessages-util-samba4 -lmsghdr-samba4 -lmsrpc3-samba4 -lndr -lndr-krb5pac -lndr-nbt -lndr-samba-samba4 -lndr-standard -lreplace-samba4 -lsamba-cluster-support-samba4 -lsamba-credentials -lsamba-debug-samba4 -lsamba-errors -lsamba-hostconfig -lsamba-modules-samba4 -lsamba-security-samba4 -lsamba-sockets-samba4 -lsamba-util -lsamba3-util-samba4 -lsamdb -lsamdb-common-samba4 -lsecrets3-samba4 -lserver-id-db-samba4 -lserver-role-samba4 -lsmbconf -lsmbd-shim-samba4 -lsmb-transport-samba4 -lsocket-blocking-samba4 -lsys-rw-samba4 -ltalloc -ltalloc-report-samba4 -ltdb -ltdb-wrap-samba4 -ltevent -ltevent-util -ltime-basic-samba4 -lutil-cmdline-samba4 -lutil-reg-samba4 -lutil-setid-samba4 -lutil-tdb-samba4 -luuid -lwbclient -lwinbind-client-samba4 -ldrm' --arch=x86_64 --target-os=linux --pkg-config=pkg-config --enable-shared --disable-static
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 36.100 / 56. 31.100
[DEVICE]
DeviceIndex=0
DEVICEINFO:VendorName=Advanced Micro Devices, Inc. [AMD/ATI]
DEVICEINFO:DeviceName=Picasso
DEVICEINFO:SubsytemVendorName=Advanced Micro Devices, Inc. [AMD/ATI]
DEVICEINFO:SubsytemDeviceName=Picasso
DEVICEINFO:VendorId=4098
DEVICEINFO:DeviceId=5592
DEVICEINFO:SubsytemVendorId=4098
DEVICEINFO:SubsytemDeviceId=5592
DEVICEINFO:DevPath=/sys/bus/pci/devices/0000:0b:00.0
DEVICEINFO:DrmCard=/dev/dri/card0
DEVICEINFO:DrmRender=/dev/dri/renderD128
DEVICEINFO:IsEnabled=1
DEVICEINFO:IsBootVga=1
DEVICEINFO:ApiVersionMajor=1
DEVICEINFO:ApiVersionMinor=7
DEVICEINFO:Driver=Mesa Gallium driver 20.0.8 for AMD RAVEN (DRM 3.35.0, 5.4.0-52-generic, LLVM 10.0.0)
[DECODER]
CodecName=MPEG2VIDEO
CodecProfile=MPEG2_SIMPLE
CodecId=2
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=MPEG2VIDEO
CodecProfile=MPEG2_MAIN
CodecId=2
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=WMV3
CodecProfile=VC1_SIMPLE
CodecId=71
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VC1
CodecProfile=VC1_SIMPLE
CodecId=70
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=WMV3
CodecProfile=VC1_MAIN
CodecId=71
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VC1
CodecProfile=VC1_MAIN
CodecId=70
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=WMV3
CodecProfile=VC1_COMPLEX
CodecId=71
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=WMV3
CodecProfile=VC1_ADVANCED
CodecId=71
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VC1
CodecProfile=VC1_COMPLEX
CodecId=70
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VC1
CodecProfile=VC1_ADVANCED
CodecId=70
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=H264
CodecProfile=H264_CONSTRAINED_BASELINE
CodecId=27
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=H264
CodecProfile=H264_MAIN
CodecId=27
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=H264
CodecProfile=H264_HIGH
CodecId=27
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=HEVC
CodecProfile=HEVC_MAIN
CodecId=173
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=HEVC
CodecProfile=HEVC_MAIN_10
CodecId=173
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12 P010
RTFormat=257
[/DECODER]
[DECODER]
CodecName=MJPEG
CodecProfile=MJPEG_HUFFMAN_BASELINE_DCT
CodecId=7
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VP9
CodecProfile=VP9_0
CodecId=167
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12
RTFormat=1
[/DECODER]
[DECODER]
CodecName=VP9
CodecProfile=VP9_2
CodecId=167
MaxWidth=4096
MaxHeight=4096
ColorFormats=NV12 P010
RTFormat=257
[/DECODER]
[/DEVICE]

 

After a quick system reboot (service restart would probably be fine too), i've got the hardware accelleration up and running.

working list.PNG

hardware_detection-63738981472.txt

Edited by ArminS
after comparing the list with the actual output, this is only part of the solution to this issue
Link to comment
Share on other sites

Just as a disclaimer:

I haven't tried HWA yet, so as far as i am aware, i only got emby to detect at least some form of HWA.
Since this is a fresh system and emby installation, it is not yet populated with any files.

 

If you have any suggestions on how i would get it working, i would be glad to try and evaluate them.

ffdetect vaencdec json.txt

Edited by ArminS
attached ffdetect vaencdec json
Link to comment
Share on other sites

Hi, what's not working at this point? It looks like in your screenshot you got the decoders to populate?

Link to comment
Share on other sites

So far i've been able to get it working out of the box on ubuntu 18.04-dekstop with virtually the same out from vainfo.

armin@srv1:~$ DISPLAY=:0 sudo vainfo
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Mesa Gallium driver 20.0.8 for AMD RAVEN (DRM 3.35.0, 5.4.0-52-generic, LLVM 10.0.0)
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

 

For some reason i am not able to get the gpu hwa recognized on the other 3 tested environments: 18.04-server, 20.04.1-desktop, 20.04.1-server.
I've attached the image of the Transcoding overview inside emby on 18.04-desktop and the working detection log.

I will probably throw another boot drive in the maschine and maybe in my other computer with a ryzen prozessor to test this behaviour and maybe get an idea what is causing this issue with those installations, if anyone on the forum already has some insight into this, feel free to share your information. :)

18.04-desktop.PNG

hardware_detection-63739238986.txt

Link to comment
Share on other sites

Hi, this is all running on the same machine. Every time i cross tested the OS, i switched to a spare ssd and made a fresh install.

I would've understood when only the server installations wouldn't work that i am missing something while manually installing the desktop packages, but since 20.04.1 desktop also won't work i am in the assumption that there is an dependency issue. Maybe there are some libs missing, not loaded or are shipped with incompatible versions when installing anything  but 18.04-desktop from ubuntu?

There was a monitor connected at all times with the desktop login prompt running.
Booting without a monitor doesn't make a difference, the HWA on 18.04 still works fine without any display available.

And since my probably unneccessary amount of glxgears instances were running all fine and the same in all 4 environments, i am pretty sure the drivers were also working.
vainfo in my last post is from the working 18.04-desktop and all outputs on my first post was on 20.04.1-server.

Link to comment
Share on other sites

  • 2 weeks later...

@ArminS - This is all wrong. QuickSync will not work with AMD GPUs. 

Please uninstall libmfx1 and install the AMD drivers (amdgpu) from the AMD website just like it is described in our hwa setup guide.

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry, i haven't had found the time and motivation recently to work on this.
I currently still have the system running on 18.04 with working HWA,
i will try to get some spare time for this on the coming weekend and set up 20.04.1 again.

I just don't see why the same driver version (according to vainfo at least) would work fine in 18.04 but not in 20.04 with emby.
Both installation were up to date and reporting the same drivers, the only difference in 20.04 would be it is using a more recent VA-API version.

So you would be suggestion i just ignore the bundled/repository driver and install the driver from Radeon instead, although it is running just fine on 18.04?
Am i just not seeing the difference between my currently used 18.04 and 20.04 driver? 😕

 

Best regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...