Solved Nvidia DRM not working

Hi guys,

I noticed that my Xorg states I do not have enable DRM on my system:

Code:
[ 18072.672] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support

[ 18073.063] (WW) NVIDIA: No DRM device: No direct render devices found.

[ 18074.158] (WW) NVIDIA(0): Failed to request fliplock.

This my GPU:

Code:
pciconf -lv|grep -B4 VGA
vgapci0@pci0:1:0:0:    class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1618 subvendor=0x1558 subdevice=0x7703
    vendor     = 'NVIDIA Corporation'
    device     = 'GM204M [GeForce GTX 970M]'
    class      = display
    subclass   = VGA

nvidia-driver and nvidia-drm-kmod are installed, below my (partial) rc.conf:

Code:
dbus_enable="YES"
kld_list="nvidia nvidia-modeset fusefs"
lightdm_enable="YES"
cupsd_enable="YES"
devfs_system_ruleset="system"
avahi_daemon_enable="YES"
dsbmd_enable="YES"
#wlans_iwm0="wlan0"
#ifconfig_wlan0="WPA DHCP"
saned_enable="YES"

Xorg:

Code:
$ cat 10-screen.conf
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-5"
    Option         "metamodes" "DP-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DP-3: nvidia-auto-select +1920+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

$ cat 20-nvidia.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce GTX 970M"
EndSection

What am I doing wrong? ?

Thanks! ?
 
Remove nvidia and nvidia-modeset and add nvidia-drm. Also add hw.nvidiadrm.modeset=1 to /boot/loader.conf.

Thank you, this is not written in the handbook... This might be the cause behind my issues with XFCE... ?
 
You should read messages shown on install, or read pkg-message of the port you installed. The same pkg-message file are in graphics/nvidia-drm-[510|515|61]-kmod ports.

Note that some ports which need some substitutions depending on build options etc. has it as files/pkg-message.in.

If it is properly recorded in pkg database, you can read, for example, with pkg info --pkg-message nvidia-drm-kmod.
 
You should read messages shown on install, or read pkg-message of the port you installed. The same pkg-message file are in graphics/nvidia-drm-[510|515|61]-kmod ports.

Note that some ports which need some substitutions depending on build options etc. has it as files/pkg-message.in.

If it is properly recorded in pkg database, you can read, for example, with pkg info --pkg-message nvidia-drm-kmod.
I do believe that I read it and added hw.nvidiadrm.modeset=1 to /boot/loader.conf but I didn't replace part on the rc.conf ?

I can check only in the evening... ?‍♂️
 
If nvidia still doesn't seem to be working, there's an nvidia-xconfig package that will automagically give you an /etc/X11/xorg.conf that should work with nvidia drivers. Or you can configure /usr/local/etc/X11/xorg.conf.d/10-nvidia.conf, (you'll have to create the directory and the file) to read
Code:
Section "Device"
        Identifier "NVIDIA Card"
        VendorName "NVIDIA Corporation"
        Driver "nvidia"
EndSection
or possibly Identifier "Device 0" (which is what the nvidia-xconfig package will put in your /etc/X11/xorg.conf)
 
If you use nvidia-drm.ko, usually /etc/X11/xorg.conf is no longer needed, as it can be auto-detected, if working correctly.
Try renaming it not to be picked. (Deleting it is not recommended for now, because once if you need to stop using nvidia-drm.ko and switch back, legacy configurations for nvidia[-modeset].ko is required again.)
One thing to mention.
Always keep x11/nvidia-driver and graphics/nvidia-drm*-kmod in sync.
(x11/nvidia-driver is used via graphics/nvidia-drm*-kmod.)
Once they becomes out of sync, /dev/dri does not appear and X (would be Wayland, too) should hesitate to start.
 
A bit of follow-ups.
For non-DRM version of drivers, Xorg detects nvidia GPUs as hardwares for open source nv driver, which does NOT exists on FreeBSD.
So we MUST specify to use x11/nvidia-driver (nvidia proprietary driver) manually.
x11/nvidia-xconfig mentioned by scottro does things including it.

For DRM version of drivers, Xorg detects hardwares differently via /dev/dri.
This allows Xorg to auto-configure on the fly for GPUs.

Related part of logs for DRM version are like below. Note that I'm sniffing BETA branch of driver now, so its version is 555.52.04.
(snip)
[ 321.779] (II) Module ABI versions: │
[ 321.779] X.Org ANSI C Emulation: 0.4 │
[ 321.779] X.Org Video Driver: 25.2 │
[ 321.779] X.Org XInput driver : 24.4 │
[ 321.779] X.Org Server Extension : 10.0 │
[ 321.783] (II) xfree86: Adding drm device (/dev/dri/card0) │
[ 321.783] (II) Platform probe for /dev/dri/card0 │
[ 322.905] (**) OutputClass "nvidia" ModulePath extended to "/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/xorg/modules" │
[ 322.905] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU │
[ 322.905] (--) PCI:*(1@0:0:0) 10de:1cbb:17aa:2262 rev 161, Mem @ 0xa3000000/16777216, 0x60000000/268435456, 0x70000000/33554432, I/O @ 0x00002000/128, BIOS │
[ 322.905] (II) LoadModule: "glx" │
[ 322.906] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so │
[ 322.911] (II) Module glx: vendor="X.Org Foundation" │
[ 322.911] compiled for 1.21.1.13, module version = 1.0.0 │
[ 322.911] ABI class: X.Org Server Extension, version 10.0 │
[ 322.911] (II) Applying OutputClass "nvidia" to /dev/dri/card0 │
[ 322.911] loading driver: nvidia │
[ 322.911] (==) Matched nvidia as autoconfigured driver 0 │
[ 322.911] (==) Matched nv as autoconfigured driver 1 │
[ 322.912] (==) Matched modesetting as autoconfigured driver 2 │
[ 322.912] (==) Matched scfb as autoconfigured driver 3 │
[ 322.912] (==) Matched vesa as autoconfigured driver 4 │
[ 322.912] (==) Assigned the driver to the xf86ConfigLayout │
[ 322.912] (II) LoadModule: "nvidia" │
[ 322.912] (II) Loading /usr/local/lib/xorg/modules/drivers/nvidia_drv.so │
[ 322.915] (II) Module nvidia: vendor="NVIDIA Corporation" │
[ 322.915] compiled for 1.6.99.901, module version = 1.0.0 │
[ 322.915] Module class: X.Org Video Driver │
[ 322.916] (II) LoadModule: "nv" │
[ 322.916] (WW) Warning, couldn't open module nv │
[ 322.916] (EE) Failed to load module "nv" (module does not exist, 0) │
[ 322.916] (II) LoadModule: "modesetting" │
[ 322.916] (II) Loading /usr/local/lib/xorg/modules/drivers/modesetting_drv.so │
[ 322.918] (II) Module modesetting: vendor="X.Org Foundation" │
[ 322.918] compiled for 1.21.1.13, module version = 1.21.1 │
[ 322.918] Module class: X.Org Video Driver │
[ 322.918] ABI class: X.Org Video Driver, version 25.2 │
(snip)
[ 322.922] (II) NVIDIA dlloader X Driver 555.52.04 Tue Jun 4 13:11:17 UTC 2024 │
[ 322.922] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs │
[ 322.922] (II) modesetting: Driver for Modesetting Kernel Drivers: kms │
[ 322.922] (II) scfb: driver for wsdisplay framebuffer: scfb │
[ 322.922] (II) VESA: driver for VESA chipsets: vesa │
[ 322.922] (--) Using syscons driver with X support (version 2.0) │
[ 322.922] (--) using VT number 9 │
(snip)
[ 322.925] (II) NVIDIA(0): Creating default Display subsection in Screen section │
"Default Screen Section" for depth/fbbpp 24/32 │
[ 322.925] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32 │
[ 322.925] (==) NVIDIA(0): RGB weight 888 │
[ 322.925] (==) NVIDIA(0): Default visual is TrueColor │
[ 322.925] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0) │
[ 322.925] (II) Applying OutputClass "nvidia" options to /dev/dri/card0 │
[ 322.925] (**) NVIDIA(0): Enabling 2D acceleration │
[ 322.925] (II) Loading sub module "glxserver_nvidia" │
[ 322.925] (II) LoadModule: "glxserver_nvidia" │
[ 322.925] (II) Loading /usr/local/lib/xorg/modules/extensions/libglxserver_nvidia.so │
[ 322.965] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation" │
[ 322.965] compiled for 1.6.99.901, module version = 1.0.0 │
[ 322.965] Module class: X.Org Server Extension │
[ 322.965] (II) NVIDIA GLX Module 555.52.04 Tue Jun 4 13:16:05 UTC 2024 │
[ 322.966] (II) NVIDIA: The X server supports PRIME Render Offload. │
 
T-Aoki, thanks for the information that one doesn't need xorg.conf. I just tested it, and sure enough, after moving xorg.conf to xorg.conf-working, I did a complete restart, (not really necessary, but it's hot and I'm sleepy, so wasn't thinking too clearly) and then ran startx with no problem. Nice to know.
 
You should read messages shown on install, or read pkg-message of the port you installed. The same pkg-message file are in graphics/nvidia-drm-[510|515|61]-kmod ports.

Note that some ports which need some substitutions depending on build options etc. has it as files/pkg-message.in.

If it is properly recorded in pkg database, you can read, for example, with pkg info --pkg-message nvidia-drm-kmod.
what the difference between pkg named (1) nvidia-driver (2) nvidia-hybrid and (3)nvidia-drm-kmod? The first two works well for me.
 
what the difference between pkg named (1) nvidia-driver (2) nvidia-hybrid and (3)nvidia-drm-kmod? The first two works well for me.
The 2nd one (should be x11/nvidia-hybrid-graphics) is already removed from the main branch of ports tree. Should be dissapear on 2024Q3 of quarterly, too. So you're advised to at least try the 3rd instead of the 2nd.

The 2nd one are created because the 3rd one didn't exist at the moment.
Just my guess, though.
The 1st one supports non-DRM parts of the driver and the 3rd (the 2nd, too) requires it to run.
On the other hand, if you don't need DRM, you don't need the 2nd or 3rd.
 
What's the advantage of running the DRM stuff?
If you want Optimus enabled (usual case for notebooks which has CPUs having internal GPU and nvidia discrete GPU and no option in its BIOS/UEFI firmware to physically disable iGPU), DRM stuff is mandatory.

If you have nvidia dGPU only (including the case you have nvidia based graphics card on the physical PCIe slot and connect display cable only to it), there would be no advantage if you had already configured /etc/X11/xorg.conf for it.
But if it's a fresh installation and you've not configured /etc/X11/xorg.conf at all, using DRM stuff would allow you running X with auto-configuration.
 
Back
Top