FreeBSD 16 (pkg) + Nvidia 4080 + nvidia-drm-latest-kmod-devel

Hello,

I try to check if FreeBSD 16 (pkg mode) work with Nvidia latest drivers, but have some problems.
Installation:
Bash:
pkg update
pkg upgrade
pkg install nvidia-drm-latest-kmod-devel nvidia-driver-devel nvidia-settings

Bash:
acquiring duplicate lock of same type: "os.rwlock_sx"
 1st os.rwlock_sx @ nvidia_os.c:777
 2nd os.rwlock_sx @ nvidia_os.c:777
stack backtrace:
#0 0xffffffff80c54c1c at witness_debugger+0x6c
#1 0xffffffff80be4580 at _sx_xlock+0x60
#2 0xffffffff849391e2 at os_acquire_rwlock_write+0x32
#3 0xffffffff84619690 at _nv049023rm+0x10
nvidia0: <NVIDIA GeForce RTX 4080 SUPER> on vgapci0
vgapci0: child nvidia0 requested pci_enable_io
vgapci0: child nvidia0 requested pci_enable_io
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  595.58.03

Bash:
# kldstat
3    1 0xffffffff83a68000   14c2f8 nvidia-modeset.ko
4    1 0xffffffff83c00000  5b78790 nvidia.ko


sway: no gpu found
nvidia-smi : No devices were found
in dmesg at that time:
Bash:
firmware_get_flags: insufficient privileges to load firmware image nvidia_gsp_ga10x_fw
NVRM: GPU 0000:01:00.0: RmInitAdapter failed! (0x61:0x56:2726)
nvidia0: NVRM: rm_init_adapter() failed!

but under root it works and found GPU
groups for my user contains wheel and video already

How can i fix this issue ? (I know that stable driver and stable system using is answer, but...)
Thx, for your patience.
 
Solved O_o (on half way, need fix USB but it's not related to NVIDIA)

Bash:
cat /boot/loader.conf

kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
zfs_load="YES"
hw.nvidia.registry.EnableGpuFirmware=1 // this fix nvidia-smi under user, and now I can run sway or niri :)

Bash:
cat /etc/rc.conf

kld_list="nvidia-drm linux linux64" // this fix nvidia-smi under user, and now I can run sway or niri :) 
dbus_enable="YES"
linux_enable="YES"
seatd_enable="YES"
 
Glad you sorted it out.
Note that the CURRENT version of FreeBSD isn't usually supported on this forum (it's in the rules).
Anyway, I waited for an answer from T-Aoki as he's knowledgeable on this topic.
Cool you post your solution.
 
Why you've encountered the issue on non-root user would be because on startup of sway firmware for NVIDIA GPU (would be nvidia_gsp_ga10x_fw.ko for RTX 4080 SUPER) which is running as non-root.

Or worse, as of dependency chain on running, relevant driver kmods (/boot/modules/nvidia.ko, /boot/modules/nvidia-modeset.ko and /boot/modules/nvidia-drm.ko are attempted to be kldloaded as non-root user, which is impossible (unlikely, though, if devmatch, devd and devfs handle it as usual).

And for this, your solution is correct.
Setting hw.nvidia.registry.EnableGpuFirmware=1 (17 would be OK, too, to allow fallback) in /boot/loader.conf would let /boot/modules/nvidia.ko to loading the GSP firmware.
Or setting to 0 to disallow to attempt to load GSP firmware if you want suspend/resume to work.

But you need hw.nvidiadrm.modeset=1 in your /boot/loader.conf, otherwise /boot/modules/nvidia-drm.ko shouldn't work even if loaded and old-school driver (x11/nvidia-driver and x11/nvidia-kmod alone works.
 
Yeah, it's strange but it works. Only issue that is no cursor I have :(
I try to pass hw.nvidiadrm into loader and see what's happen next ;)
 
If you cannot see mouse cursor all over the screen under sway, try setting WLR_NO_HARDWARE_CURSORS=1 in your environment variable before starting sway.
If you're starting sway from script you've created yourself using /bin/sh, add export WLR_NO_HARDWARE_CURSORS=1 line in your script.

If you don't use your own script and your login shell is /bin/sh (current default), add the above-mentioned line in your ~/.profile.
If your login shell is /bin/csh (/bin/tcsh is the same), the line to add would be setenv WLR_NO_HARDWARE_CURSORS=1.
For other (not in base) shell, follow the way the shell sets environment variable.

If you're using any login manager (like xdm, sddm, ...), I don't know as I've never tried any login manager (always start X11 from command line after CLI login).
 
Back
Top