Call For Testing: nvidia-drm kernel module

elgrande, ashafer, I must apologize, I am out of my depth here. I thought this driver could get my NVIDIA T550 working in the Optimus config in an Alder Lake laptop (P14s). I am not sure what "right branch" here means, I've just grabbed the latest drm-kmod from the Github. I appreciate your help, but I guess I'll just sit tight and wait for more experience people to get this built.
 
The "right" branch is the branch of drm-kmod that matches your system. This is the branch that the "drm-kmod" metaport chooses when you install it. i.e. if you're running CURRENT you would use drm-kmod's master branch, otherwise you probably want the 5.10-lts branch. nvidia-drm should help with the hardware you described btw.
 
ashafer, thank you very much for not letting me give up. Cloned the correct branches, built the driver. Getting blank black screen with graphics mouse cursor in the middle and a non-blinking text-mode cursor (white rectangle) in the top left corner. Nothing else happens. I have attached my logs and the config I have used.

kldstat output:

Code:
/home/blackhaz % kldstat | grep nvidia
41    1 0xffffffff837e0000    13998 nvidia-drm.ko
42    2 0xffffffff83800000  33924c0 nvidia.ko
43    1 0xffffffff86b93000   108330 nvidia-modeset.ko

hwprobe is here: https://bsd-hardware.info/?probe=b7a491a010
 

Attachments

  • Xorg.0.txt
    21.5 KB · Views: 77
  • nvidia.txt
    158 bytes · Views: 75
Yes, it works on all resolutions supported by the hardware just like the base nvidia driver.
base nvidia driver, i assume is the default freebsd drivers ( as in x11/nvidia-driver port ) ? it does not give native resolution, like Intel KMS. the one for the tty aka console resolution. with nvidia i always have text mode, and efifb gives what it defaults to, usually 640x480.
 
Yess for all configurations in rc.conf,
Code:
kld_list="drm linux nvidia nvidia-modeset"
I have no idea how to debug/trace see what is happening ?
 
I have some interesting test,
first i disabled moused in rc.conf
Then i set kern.vty=sc in loader.conf and this gave better results.
kldload nvidia works
kldload nvidia-modeset works
But kldload nvidia-drm sometimes hangs forever
And kldunload nvidia-drm creates a kernel panic page-fault reboot

I could launch
Code:
seatd-launch labwc
And start a terminal & firefox. But then the mouse went away. A weird problem...
 
I have some interesting test,
first i disabled moused in rc.conf
Then i set kern.vty=sc in loader.conf and this gave better results.
kldload nvidia works
kldload nvidia-modeset works
But kldload nvidia-drm sometimes hangs forever
And kldunload nvidia-drm creates a kernel panic page-fault reboot

I could launch
Code:
seatd-launch labwc
And start a terminal & firefox. But then the mouse went away. A weird problem...
nvidia-drm needs to be loaded once, preferably in rc.conf and cannot be unloaded. I thinf the github page mentions this.
As for the mouse, there was some required parameter disabling hardware rendering in order to have it work. I have no access to my machine now, but I can check later if you did not sort it out.
 
ashafer, thank you very much for not letting me give up. Cloned the correct branches, built the driver. Getting blank black screen with graphics mouse cursor in the middle and a non-blinking text-mode cursor (white rectangle) in the top left corner. Nothing else happens. I have attached my logs and the config I have used.

kldstat output:

Code:
/home/blackhaz % kldstat | grep nvidia
41    1 0xffffffff837e0000    13998 nvidia-drm.ko
42    2 0xffffffff83800000  33924c0 nvidia.ko
43    1 0xffffffff86b93000   108330 nvidia-modeset.ko

hwprobe is here: https://bsd-hardware.info/?probe=b7a491a010
Sorry for the delay. Seeing a black screen on a prime machine like this usually means you're rendering to the nvidia GPU, but it can't display since the monitor is controlled by the intel GPU.

As I mentioned in comment #7 you'll need to build a patched X server if you want a truly working dual-gpu prime setup. You'll also want to use a prime-aware xorg.conf (such as generated with nvidia-xconfig -prime). I've been waiting for the last MR to get merged before writing up how it's done, but there's also a way to have X autoconfigure prime systems in xorg.conf.d. Like I said, I'll get around to doing a nice writeup about that once my patch is merged.

Also yes, you will want to load nvidia-drm.ko.
 
I noticed that despite having upgraded to 525.78.01 the message in /var/run/dmesg.boot still says:
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms 525.60.11 Wed Nov 23 22:41:38 UTC 2022
:(
 
Re making a port, I still need to have some conversations with the drm-kmod and nvidia-driver maintainers to see how they would like this packaged. So probably be a few more months before there's a concrete direction we have picked. I know that will drastically simplify using nvidia-drm for the average person, so it is definitely something that needs doing in the medium-term future.

I noticed that despite having upgraded to 525.78.01 the message in /var/run/dmesg.boot still says:
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms 525.60.11 Wed Nov 23 22:41:38 UTC 2022
:(
The timestamp in that dmesg line looks like it's from last year. I'm guessing you either didn't install the new module or didn't unload/reload. Or you're just seeing an out of date dmesg line I guess.
 
As it seems this is still a current thread, I am having some difficulty compiling nvidia-drm.

Am using FreeBSD 14.0-CURRENT #1 main-n261575-58436df347de, so /usr/src is populated, the first time the compile error reared it's head, I thought maybe it was an improper git clone, so I deleted the files and reran git.

My git folder is in my userdir/git, I compiled and installed drm-kmod first, then attempted to make nvidia-drm, here's the error message

In file included from nvidia-drm-connector.c:23:
In file included from ./nvidia-drm-conftest.h:84:
In file included from /home/ronf/git/drm-kmod//include/drm/drm_gem.h:38:
/home/ronf/git/drm-kmod//linuxkpi/gplv2/include/linux/dma-resv.h:304:38: error: too many arguments to function call, expected single argument 'lock', have 2 arguments
return ww_mutex_trylock(&obj->lock, NULL);
~~~~~~~~~~~~~~~~ ^~~~
/usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
#define NULL ((void *)0)
^~~~~~~~~~~
/usr/src/sys/compat/linuxkpi/common/include/linux/ww_mutex.h:80:1: note: 'ww_mutex_trylock' declared here
ww_mutex_trylock(struct ww_mutex *lock)
^
1 error generated.
*** Error code 1

Stop.

I have just recently done a system re-install as I had previously used UFS and wanted to use ZFS instead, when I compiled nvidia-drm while it was on UFS both drm-kmod & nvidia-drm compiled and installed without error.

I ensured I downloaded the correct one as I did a git master for nvidia-drm, system runs great otherwise.
 
I have just completed a buildworld/kernel, reinstall of nvidia-driver/linux-nvidia-libs, drm-kmod. All completed without error.

Ran make clean in ~/git/nvidia-driver/nvidia, git pull, then make, and once again it stops @

In file included from nvidia-drm-connector.c:23:
In file included from ./nvidia-drm-conftest.h:84:
In file included from /home/ronf/git/drm-kmod/include/drm/drm_gem.h:38:
/home/ronf/git/drm-kmod/linuxkpi/gplv2/include/linux/dma-resv.h:304:38: error: too many arguments to function call, expected single argument 'lock', have 2 arguments
return ww_mutex_trylock(&obj->lock, NULL);
 
Yes, sorry this has been fixed in the latest 530.30.02 branch. Can you please try building again with that?
 
Update: there is a work in progress port that should make it easier for people running release versions. Going to start upstreaming that in a bit. Also did a writeup about how to get PRIME working.


WIP port: https://github.com/amshafer/freebsd-ports
You'll need to install xorg-server, nvidia-driver, and graphics/nvidia-drm-510-kmod to get things working. Also make sure you have libudev-devd version 0.5.1, which is in the main ports tree.
 
Did any of you got sway working on 13.2 ? I installed nvidia-driver and nvidia-drm. Sway complains that there is no PRIME capability on the DRM device and bails out. drm_info indeed confirm this, no prime caps on nvidia drm.

I'm not sure why it would need prime capabilities, as its a desktop with the integrated GPU disabled and the only video card FreeBSD can use is an Nvidia 1070 TI. Am I missing something ?
 
At Jan.24,2024, nvidia released driver 550.40.07 from their BETA branch.
This states "Added support for nvidia-drm on FreeBSD via linuxkpi." in its Release Highlights but it doesn't seem to be hooked to regular build using x11/nvidia-driver port.

ashafer, does this mean that your work is now incorporated to official (currently beta branch, though) driver? And if so, what do you think the right direction to go?

And for x11/linux-nvidia-libs port, a patch which I've not yet filed PR is required to support this version, as 2 libraries are bumped async from DISTVERSION. Fixes for non-production branch only shouldn't be accepted and simply I have not enough time to create patch to catch up with latest production branch driver. Too frequently massive rebuilds for poudriere related with subpackages and/or man pages relocations are coming.
 
Hello to everyone.

What I would like to do is to use Stable Diffusion on FreeBSD and also to install the AUTOMATIC1111 / stable-diffusion-webui natively on FreeBSD. I'm investigating about what could be a doable method do that that,actually. I've sent an email message to ports@freebsd.org to ask more informations. A developer replied to me with the following message :




So,I can't use stable diffusion and its webui directly and natively on FreeBSD. This is the reason why I'm looking for some alternative methods to achieve that goal. One could be to install pytorch and all its dependencies as well as the stable-diffusion-webui using the Linuxulator. I don't know if it will work,anyway,if it will work,the next step would be to install your nvidia-drm driver. I know for sure that it will not work if it will be installed within the linuxulator chroot,so it should be installed natively on FreeBSD. The third step will be to install Wayland and sway natively on FreeBSD,I imagine. The 4 step could be to configure Xorg to enable the support for the Prime Render Offload and the 5 and last step would be to enable it in FreeBSD issuing more or less the following commands :

__NV_PRIME_RENDER_OFFLOAD=1 vkcube
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor


is everything right ? What do you think about this project ? Do you think that it could work ?

I see that between the ports of my current FreeBSD installation (13.1-RELEASE-p3) I can see only the nvidia driver version 510.60.02,but on your repository there is an updated driver,version : 525.60.11. What should I do ? should I remove the 510.60.02 and install the 525.60.11 from your github ?

And I have another question to ask. Someone of you can provide a good tutorial to learn how to install Wayland and sway natively on FreeBSD ? I never did that before but I read that easily it could not work because it is a new feature,not free from bugs. I don't want to waste my time fixing bugs because I've found a tutorial that will not work.

What else ? my goal is to try to accomplish the project that I've explained and I will share the results that I will get.

These are the hardware specs of my system :

Code:
# lspci

00:00.0 Host bridge: Intel Corporation 8th/9th Gen Core 8-core Desktop Processor Host Bridge/DRAM Registers [Coffee Lake S] (rev 0d)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 0d)
00:01.1 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x8) (rev 0d)
00:02.0 Display controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630] (rev 02)
00:12.0 Signal processing controller: Intel Corporation Cannon Lake PCH Thermal Controller (rev 10)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake PCH SATA AHCI Controller (rev 10)
00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #17 (rev f0)
00:1c.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #1 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 (rev f0)
00:1f.0 ISA bridge: Intel Corporation Z390 Chipset LPC/eSPI Controller (rev 10)
00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
00:1f.5 Serial bus controller: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (7) I219-V (rev 10)
01:00.0 VGA compatible controller: NVIDIA Corporation GP106 [GeForce GTX 1060 3GB] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP106 High Definition Audio Controller (rev a1)
02:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX 2080 Ti] (rev a1)
02:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio Controller (rev a1)
02:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host Controller (rev a1)
02:00.3 Serial bus controller: NVIDIA Corporation TU102 USB Type-C UCSI Controller (rev a1)
03:00.0 Non-Volatile memory controller: Micron/Crucial Technology Device 5403 (rev 03)
Eh, I thought that getting A1111 SD NVIDIA acceleration requires CUDA, which is not supported natively on FBSD?
 
Back
Top