Solved graphics/nvidia-drm-kmods depends on x11/nvidia-driver

Hi,

does anybody known why nvidia-drm-kmods RUN_DEPENDS on x11/nvidia-driver? I created local poudriere repo for building kmods and was surprised nvidia-drm-kmods brings looots of dependencies.
 
It uses the NVidia driver (more specifically, the 'blob' NVidia supplies with their driver). What were you expecting?
 
Hi,

does anybody known why nvidia-drm-kmods RUN_DEPENDS on x11/nvidia-driver? I created local poudriere repo for building kmods and was surprised nvidia-drm-kmods brings looots of dependencies.
As the maintainer who did it, it's intentional and unavoidable at least with current form.

For conventional, old-school UMS driver (in contrast with KMS), installing x11/nvidia-driver{-304|-340|-390|-470|-580|-devel} as before pulls corresponding x11/nvidia-kmod{-304|-340|-390|-470|-580|-devel} in. So no worries.

On the other hand, when the change was made, graphics/nvidia-drm-{510|515|61|66}-kmod depended on x11/nvidia-driver, as kmods part was NOT YET splitted out from it.

When the split was done as per request from kmod builder admins, graphics/nvidia-drm-{510|515|61|66}-kmod, which are actually the kmod ports, are no longer allowed to depend on x11/nvidia-driver, but depending on x11/nvidia-kmod was still allowed by the admins. So the dependency was switched.

But to use above-mentioned "actual" kmod ports to run X11 (Xorg or XLibre) or Wayland, any one of x11/nvidia-driver{-304|-340|-390|-470|-devel} supporting the GPU to be used is mandatory.

So, knowing it's NOT 100% ideal way, we (NVIDIA driver ports team) decided to pull x11/nvidia-driver{-devel} in from graphics/nvidia-drm-kmod{-devel} ports, which are metaport to choose which actual kmod port to pull in as per OSVERSION.

graphics/nvidia-drm-kmod{-devel} itself doesn't build anything. Just for convenient metaport to automatically pull in actually needed components, directly and indirectly.

And after the split / reconstruction is done, -580 variants are added as new legacy branch for GPUs that NVIDIA dropped supports from Production Branch of their drivers starting from 595 branch (actually, dropped from earlier New Feature Branch, 590 series).

More, in addition of graphics/drm-612-kmod, corresponding graphics/nvidia-drm-612-kmod{-580|devel} were added.

Note that graphics/nvidia-drm-kmod/Makefile.common is NOT used by graphics/nvidia-drm-kmod port itself, but it's there just to be included from each actual kmod ports, not to make common parts out of sync by accident.
 
> But to use above-mentioned "actual" kmod ports to run X11 (Xorg or XLibre) or Wayland, any one of x11/nvidia-driver{-304|-340|-390|-470|-devel} supporting the GPU to be used is mandatory.

I think this statement deserves explanation. Running X with the "nvidia" driver requires /usr/local/lib/xorg/modules/drivers/nvidia_drv.so which is shipped by nvidia-driver. But does using "modesetting" via nvidia-drm really require all those nvidia-driver libs?
 
But does using "modesetting" via nvidia-drm really require all those nvidia-driver libs?
My understanding is yes.

Each graphics/nvidia-drm-*-kmod (master port of corresponding graphics/nvidia-drm-*-kmod-580 and graphics/nvidia-drm-*-kmod-devel) installs /usr/local/share/X11/xorg.conf.d/20-nvidia-drm-outputclass.conf, which should be picked as system default. Linked above is the source file (20-nvidia-drm-outputclass.conf.in) that %%LOCALBASE%% is replaced with configured LOCALBASE (default: /usr/local).

For this, ashafer should have the best explanation, as the codes for nvidia-drm.ko provided by NVIDIA side is his work, and graphics/nvidia-drm*-kmod ports are initially created by him.

And /usr/local/lib/xorg/modules/drivers/nvidia_drv.so is NOT the only library x11/nvidia-driver{-304|-340|-390|-470|-580|devel} provides.
You can see, for example, below in /var/log/Xorg.0.log.

Code:
   (snip)
[   120.431] (II) Platform probe for /dev/dri/card0
[   120.619] (**) OutputClass "nvidia" ModulePath extended to "/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/xorg/modules"
[   120.619] (**) OutputClass "nvidia" ModulePath extended to "/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/xorg/modules"
[   120.619] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU
[   120.620] (--) PCI:*(1@0:0:0) 10de:25b2:10de:1879 rev 161, Mem @ 0x6b000000/16777216, 0x4000000000/4294967296, 0x4100000000/33554432, I/O @ 0x00003000/128, BIOS @ 0x????????/65536
[   120.620] (II) LoadModule: "glx"
[   120.621] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so
[   120.627] (II) Module glx: vendor="X.Org Foundation"
[   120.627]     compiled for 1.21.1.23, module version = 1.0.0
[   120.627]     ABI class: X.Org Server Extension, version 10.0
[   120.628] (II) Applying OutputClass "nvidia" to /dev/dri/card0
[   120.628]     loading driver: nvidia
[   120.628] (II) Applying OutputClass "nvidia" to /dev/dri/card0
[   120.628]     loading driver: nvidia
[   120.628] (==) Matched nvidia as autoconfigured driver 0
[   120.628] (==) Matched nv as autoconfigured driver 1
[   120.628] (==) Matched modesetting as autoconfigured driver 2
[   120.628] (==) Matched scfb as autoconfigured driver 3
[   120.628] (==) Matched vesa as autoconfigured driver 4
[   120.628] (==) Assigned the driver to the xf86ConfigLayout
[   120.628] (II) LoadModule: "nvidia"
[   120.628] (II) Loading /usr/local/lib/xorg/modules/drivers/nvidia_drv.so
[   120.630] (II) Module nvidia: vendor="NVIDIA Corporation"
[   120.630]     compiled for 1.16.99.901, module version = 1.0.0
[   120.630]     Module class: X.Org Video Driver
[   120.631] (II) LoadModule: "nv"
[   120.631] (WW) Warning, couldn't open module nv
[   120.631] (EE) Failed to load module "nv" (module does not exist, 0)
[   120.631] (II) LoadModule: "modesetting"
[   120.631] (II) Loading /usr/local/lib/xorg/modules/drivers/modesetting_drv.so
[   120.632] (II) Module modesetting: vendor="X.Org Foundation"
[   120.632]     compiled for 1.21.1.23, module version = 1.21.1
[   120.632]     Module class: X.Org Video Driver
[   120.632]     ABI class: X.Org Video Driver, version 25.2

   (snip)

[   120.638] (II) NVIDIA dlloader X Driver  610.43.02  Tue May 19 10:39:03 UTC 2026
[   120.638] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[   120.639] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[   120.639] (II) scfb: driver for wsdisplay framebuffer: scfb
[   120.639] (--) Using syscons driver with X support (version 2.0)
[   120.639] (--) using VT number 9

   (snip)

[   120.654] (II) NVIDIA(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[   120.654] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[   120.654] (==) NVIDIA(0): RGB weight 888
[   120.654] (==) NVIDIA(0): Default visual is TrueColor
[   120.654] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[   120.654] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[   120.654] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[   120.654] (**) NVIDIA(0): Enabling 2D acceleration
[   120.654] (II) Loading sub module "glxserver_nvidia"
[   120.654] (II) LoadModule: "glxserver_nvidia"
[   120.654] (II) Loading /usr/local/lib/xorg/modules/extensions/libglxserver_nvidia.so
[   120.738] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[   120.738]     compiled for 1.16.99.901, module version = 1.0.0
[   120.738]     Module class: X.Org Server Extension
[   120.738] (II) NVIDIA GLX Module  610.43.02  Tue May 19 10:37:27 UTC 2026
[   120.739] (II) NVIDIA: The X server supports PRIME Render Offload.

   (snip to the end of file)
 
> My understanding is yes.

Can't you just try that? My NVIDIA GPU died, so I can't

> [ 120.628] (II) LoadModule: "nvidia"

Xorg might just load all modules it finds in /usr/local/lib/xorg/modules/drivers.

Try removing /usr/local/lib/xorg/modules/extensions/libglxserver_nvidia.so and /usr/local/lib/xorg/modules/drivers/nvidia_drv.so
 
> [ 120.628] (II) LoadModule: "nvidia"

Xorg might just load all modules it finds in /usr/local/lib/xorg/modules/drivers.

Try removing /usr/local/lib/xorg/modules/extensions/libglxserver_nvidia.so and /usr/local/lib/xorg/modules/drivers/nvidia_drv.so
Tried renaming instead of removing not to be picked but easier to restore.
Confirmed these mandatory.
xorg does NOT start, and restoring the 2 shared objects allows xorg to start.

On screen started invoked startx (partioally stroke out with ***):
Code:
% startx &
[1] 11182
% xauth:  file /***/***/.serverauth.***** does not exist

X.Org X Server 1.21.1.23
X Protocol Version 11, Revision 0
Current Operating System: FreeBSD ***.***.local 15.1-STABLE FreeBSD 15.1-STABLE #143 stable/15-n284117-ae9f66486df6-dirty: Fri Jun 26 13:17:17 JST 2026     root@***a.***.local:/usr/obj/usr/src/amd64.amd64/sys/TEST15 amd64

Current version of pixman: 0.46.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Jun 26 19:54:22 2026
(==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
scfb trace: probe start
scfb trace: probe done
(EE)
Fatal server error:
(EE) failed to create screen resources(EE)
(EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

[1]  + exit 1     startx
%

On /var/log/Xorg.0.log:
Code:
   (snip)

[   193.004] (II) xfree86: Adding drm device (/dev/dri/card0)
[   193.004] (II) Platform probe for /dev/dri/card0
[   193.172] (**) OutputClass "nvidia" ModulePath extended to "/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/xorg/modules"
[   193.172] (**) OutputClass "nvidia" ModulePath extended to "/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/nvidia/xorg,/usr/local/lib/xorg/modules,/usr/local/lib/xorg/modules"
[   193.172] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU
[   193.172] (--) PCI:*(1@0:0:0) 10de:25b2:10de:1879 rev 161, Mem @ 0x6b000000/16777216, 0x4000000000/4294967296, 0x4100000000/33554432, I/O @ 0x00003000/128, BIOS @ 0x????????/65536

   (snip)

[   193.180] (II) Applying OutputClass "nvidia" to /dev/dri/card0
[   193.180]     loading driver: nvidia
[   193.180] (II) Applying OutputClass "nvidia" to /dev/dri/card0
[   193.180]     loading driver: nvidia
[   193.180] (==) Matched nvidia as autoconfigured driver 0
[   193.180] (==) Matched nv as autoconfigured driver 1
[   193.180] (==) Matched modesetting as autoconfigured driver 2
[   193.180] (==) Matched scfb as autoconfigured driver 3
[   193.180] (==) Matched vesa as autoconfigured driver 4
[   193.180] (==) Assigned the driver to the xf86ConfigLayout
[   193.180] (II) LoadModule: "nvidia"
[   193.181] (WW) Warning, couldn't open module nvidia
[   193.181] (EE) Failed to load module "nvidia" (module does not exist, 0)

   (snip)

[   193.181] (II) LoadModule: "modesetting"
[   193.181] (II) Loading /usr/local/lib/xorg/modules/drivers/modesetting_drv.so
[   193.182] (II) Module modesetting: vendor="X.Org Foundation"
[   193.182]     compiled for 1.21.1.23, module version = 1.21.1
[   193.182]     Module class: X.Org Video Driver
[   193.182]     ABI class: X.Org Video Driver, version 25.2

   (snip)

[   193.189] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[   193.189] (II) scfb: driver for wsdisplay framebuffer: scfb
[   193.189] (--) Using syscons driver with X support (version 2.0)
[   193.189] (--) using VT number 9

[   193.200] (II) modeset(0): using drv /dev/dri/card0
[   193.200] (WW) Falling back to old probe method for scfb
[   193.200] scfb trace: probe start
[   193.200] scfb trace: probe done
[   193.200] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
[   193.201] (II) modeset(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[   193.201] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[   193.201] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[   193.201] (II) Applying OutputClass "nvidia" options to /dev/dri/card0
[   193.201] (==) modeset(0): RGB weight 888
[   193.201] (==) modeset(0): Default visual is TrueColor
[   193.201] (II) Loading sub module "glamoregl"
[   193.201] (II) LoadModule: "glamoregl"
[   193.201] (II) Loading /usr/local/lib/xorg/modules/libglamoregl.so
[   193.207] (II) Module glamoregl: vendor="X.Org Foundation"
[   193.207]     compiled for 1.21.1.23, module version = 1.0.1
[   193.207]     ABI class: X.Org ANSI C Emulation, version 0.4
[   193.650] (II) modeset(0): glamor: Using OpenGL 3.1 context.
[   193.650] (II) modeset(0): glamor X acceleration enabled on NVIDIA RTX A400/PCIe/SSE2
[   193.650] (II) modeset(0): glamor initialized
[   193.650] (==) modeset(0): VariableRefresh: disabled
[   193.650] (==) modeset(0): AsyncFlipSecondaries: disabled
[   193.650] (II) modeset(0): Output DP-1 has no monitor section
[   193.651] (II) modeset(0): Output DP-2 has no monitor section
[   193.689] (II) modeset(0): Output DP-3 has no monitor section
[   193.689] (II) modeset(0): Output DP-4 has no monitor section

   (snip)

[   193.730] (==) modeset(0): DPI set to (96, 96)
[   193.730] (II) Loading sub module "fb"
[   193.730] (II) LoadModule: "fb"
[   193.730] (II) Module "fb" already built-in
[   193.730] (II) UnloadModule: "scfb"
[   193.730] (II) Unloading scfb
[   193.823] (==) modeset(0): Backing store enabled
[   193.823] (==) modeset(0): Silken mouse enabled
[   193.827] (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
[   193.827] (==) modeset(0): DPMS enabled
[   193.827] (WW) modeset(0): Option "PrimaryGPU" is not used
[   193.828] (II) modeset(0): [DRI2] Setup complete
[   193.828] (II) modeset(0): [DRI2]   DRI driver: nouveau
[   193.828] (II) modeset(0): [DRI2]   VDPAU driver: nouveau

   (snip)

[   193.833] (II) Initializing extension GLX
[   193.834] (EE) AIGLX error: dlopen of /usr/local/lib/dri/nouveau_dri.so failed (Cannot open "/usr/local/lib/dri/nouveau_dri.so")
[   193.834] (EE) AIGLX error: unable to load driver nouveau
[   193.836] (II) IGLX: Loaded and initialized swrast
[   193.836] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[   193.836] (II) Initializing extension XFree86-VidModeExtension
[   193.836] (II) Initializing extension XFree86-DGA
[   193.836] (II) Initializing extension XFree86-DRI
[   193.836] (II) Initializing extension DRI2
[   193.836] (EE) modeset(0): Failed to create pixmap
[   193.836] (EE)
Fatal server error:
[   193.836] (EE) failed to create screen resources(EE)
[   193.837] (EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
[   193.837] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[   193.837] (EE)
[   193.843] (EE) Server terminated with error (1). Closing log file.
 
Keep in mind, nvidia.ko is from x11/nvidia-kmod, not from x11/nvidia-driver. So nvidia-driver is needed for Xorg, not for a drm. Anybody can install nvidia-driver by hands. Or without breaking anything it can be an optional dependency in nvidia-drm-kmod, like:

Makefile:
OPTIONS_DEFINE= RUNTIME
OPTIONS_DEFAULT= RUNTIME

RUNTIME_RUN_DEPENDS= nvidia-driver${PKGNAMESUFFIX}>0:x11/nvidia-driver${PKGNAMESUFFIX}
 
Keep in mind, nvidia.ko is from x11/nvidia-kmod, not from x11/nvidia-driver. So nvidia-driver is needed for Xorg, not for a drm. Anybody can install nvidia-driver by hands. Or without breaking anything it can be an optional dependency in nvidia-drm-kmod, like:

Makefile:
OPTIONS_DEFINE= RUNTIME
OPTIONS_DEFAULT= RUNTIME

RUNTIME_RUN_DEPENDS= nvidia-driver${PKGNAMESUFFIX}>0:x11/nvidia-driver${PKGNAMESUFFIX}
Actual DRM/KMS (additional) kmod ports, graphics/nvidia-drm-{510|515|61|66|612|latest}-kmod{-580|-devel} are basically for adding hybrid graphics (aka Optimus) support. This is because recent iGPUs want DRM/KMS to work, so running NVIDIA dGPUs with iGPUs without using tricky way using OSMESA (Off Screen MESA) need DRM/KMS supports.

As I've shown in comment #7 here, libraries and others provided by x11/nvidia-driver{-580|-devel} are still needed even on DRM/KMS environment.
graphics/nvidia-drm-*-kmod*, corresponding graphics/drm-*-kmod and corresponding x11/nvidia-kmod* kmod ports alone are insufficient.

This was because graphics/nvidia-drm-*-kmod originally depended upon x11/nvidia-driver before kmod parts are splitted out to x11/nvidia-kmod*.

And, as far as I could hear from kmod builder repo's admins, kmod ports built built on the builder are NOT allowed to pull in non-kmod dependencies like x11-servers/xorg-server or alike as of the limitations in resources and how builds are done there.

So we needed to somehow pull in corresponding x11/nvidia-driver* at least on initial installation outside ACTUAL kmod ports, so we chose graphics/nvidia-drm-kmod* metaport to do so, as it's NOT ACTUAL kmod ports.

So the option would be meaningless. Or does any of Wayland compositor work without x11/nvidia-driver* ports installed? If so, the option should be WAYLAND, not RUNTIME. But I think it would be falling back to scfb (for UEFI boots) or vesa (for legacy BIOS boots) as NVIDIA drivers doesn't work.
 
Each graphics/nvidia-drm-*-kmod (master port of corresponding graphics/nvidia-drm-*-kmod-580 and graphics/nvidia-drm-*-kmod-devel) installs /usr/local/share/X11/xorg.conf.d/20-nvidia-drm-outputclass.conf, which should be picked as system default.
I see now. This config causes loading of nvidia_drv.so, which means that nvidia-driver is indeed a required runtime dependency.

So nvidia-driver is needed for Xorg, not for a drm.
What use does DRM have without DRI (which is the case for nvidia-drm, if I understand it correctly)? I doubt you can use nvidia-drm in headless scenarios, but even if you can it is too much niche to add an option to the port. But I'm not a maintainer anyways.
 
I see now. This config causes loading of nvidia_drv.so, which means that nvidia-driver is indeed a required runtime dependency.


What use does DRM have without DRI (which is the case for nvidia-drm, if I understand it correctly)? I doubt you can use nvidia-drm in headless scenarios, but even if you can it is too much niche to add an option to the port. But I'm not a maintainer anyways.
And I'm one of the maintainers for NVIDIA GPU driver related ports.
 
What use does DRM have without DRI (which is the case for nvidia-drm, if I understand it correctly)?
DRM (Direct Rendering Manager) and DRI (Direct Rendering Infrastructure) are underlying infrastructures for X11 / Wayland, but not all of infrastructures.

And DRM for managing resources and accesses by DRI. So both can be considered as (quite roughly) a 2 aspects of single thing. Implementing single needed things via different aspects.

DRM cannot run without the existence of DRI, and applications and middlewares (including X11 and Wayland) should NOT access DRI without arbitrations by DRM in resources and access control.

See Freedesktop page here.
 
Back
Top