Jump to content

Enable hardware acceleration on FreeBSD


Recommended Posts

Posted (edited)

I don't understand why you get defensive, I'm not complaining about the tool, especially a free tool I have not paid 1$ for. I know how hard it is to make a good one. I'm just sharing personal experience for similar people in the same situation, hoping to gain time by starting from True Nas core vs from scratch. And yes my experience with it was quite bad, that's just a fact. For me, the time I gained thanks to True Nas core (mostly the one click configuration of smbfs, zfs, smartd, mail notification,...) was negligible compared to the time lost trying to make jails work properly with the true nas openvpn server, trying to enable GPU acceleration, dealing with automatically deleted files, disabled pkg at each reboot... Also thanks to the fact that ZFS was much simpler on Debian than what I first expected. So indeed the tool was not for me, and obviously people with different use cases, patience and background might think otherwise, I respect that and hope to see True nas improve.

 

 

 

Edited by hadr0n
  • 2 years later...
Posted

I'll absolutely necro-post this;

Just got emby with hw acceleration working on FreeBSD 15.0. What a journey... I followed this guide as close as possible, however the tar for the fake /sys is offline in the meantime, so a bit of trial and error was key. For everyone trying to replicate here is my working one:

sys/
sys/bus
sys/bus/pci
sys/bus/pci/devices
sys/bus/pci/devices/pci0000:00
sys/bus/pci/devices/pci0000:00/boot_vga		=> 1
sys/bus/pci/devices/pci0000:00/vendor		=> 0x10de
sys/bus/pci/devices/pci0000:00/device		=> 0x1ff2
sys/bus/pci/devices/pci0000:00/drm
sys/bus/pci/devices/pci0000:00/drm/render0	=> link to /dev/dri/render0
sys/bus/pci/devices/pci0000:00/class		=> 0x030000
sys/bus/pci/devices/pci0000:00/subsystem_vendor	=> 0x17aa
sys/bus/pci/devices/pci0000:00/subsystem_device => 0x1613
sys/bus/pci/devices/pci0000:00/enable		=> 1

This gets ffdetect to a point where it tries to use the card.

Next hurdle is vaapi... for an nvidia card you need libva-nvidia-driver, that however is a bit special itself. its not enough to hand it /dev/dri and /dev/drm, it also wants /dev/nvidiactl and /dev/nvidia0 (yes, nvidia0; thats hard-coded; my host always creates nvidia1, so symlink that). for good measure I also put /dev/nvidia-modeset into the jail even though it might not be needed.

Next this little beast also needs CUDA... this made me pull my hair and have me install half a linux in /compat, more precise the libc6-shim package. With that you get the nv-sglrun ruby script that somehow (don't ask me how, I stopped digging deeper at that point) makes CUDA available. Bare with me, we're almost there... just one little wrapper around the ff* binaries in /usr/local/lib/emby-server/bin and we're there. So rename the original binaries to _real and for each put a wrapper like this in:

#!/bin/sh
export PATH=$PATH:/usr/local/bin
/usr/local/bin/nv-sglrun /usr/local/lib/emby-server/bin/ffdetect_real $@

And will you believe it, it freaking works.

All this crazy setup just to find out that libva-nvidia-driver only implements hardware decoding, no encoding (╯°□°)╯︵ ┻━┻

 

Well, its better that nothing i guess. And maybe some day claude will be good enough in generating code to close that gap; the humans don't seem very interested in implementing it.

 

DISCLAIMER:

This is a very striped down version of my pain, i faced lots of missing symbols, version mismatches and spontaneous reboots on the way.

I might have missed some steps but I'm happy to help anyone brave enough to try.

 

FINAL RANT:

Is this really the way to go? This seems unnecessary complicated, doesn't it? Can we not just have nice things, please?!?

 

/cheers

  • Thanks 1
Posted (edited)

Going through some libva shim is definitely not the way to go with Nvidia hardware (nowhere).

The it's supposed to work is  via NVDEC, NVENC and CUDA, same like on Linux - albeit I haven't seen any recent evidence that it's working on FreeBSD (neither the opposite, though).

Have you tried to install the Nvidia drivers from the Nvidia Website? (https://www.nvidia.com/en-us/drivers/)

Edited by softworkz
Posted

Hi,

I'd love to get rid of using libva at all, but HOW?

Is there native support for NVDEV/NVENC in the ffmpeg binaries you ship? If so, how do i use that? what magic do I need to put in the fake /sys ?

The method described above is based on the 'solution' thats drawn out in this thread.

 

No, I havent tried the drivers from nvidia directly and currently I don't see what they would improve. Its not a driver problem afaik (even though i did have some of these on the way :).

 

/cheers

Posted

Can you post the hw detection log,. please?

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