Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145161702
D53128.1777497742.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D53128.1777497742.diff
View Options
diff --git a/graphics/Makefile b/graphics/Makefile
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -637,6 +637,8 @@
SUBDIR += nvidia-drm-66-kmod-devel
SUBDIR += nvidia-drm-kmod
SUBDIR += nvidia-drm-kmod-devel
+ SUBDIR += nvidia-drm-latest-kmod
+ SUBDIR += nvidia-drm-latest-kmod-devel
SUBDIR += nvidia-texture-tools
SUBDIR += ocaml-cairo
SUBDIR += ocaml-images
diff --git a/graphics/nvidia-drm-latest-kmod-devel/Makefile b/graphics/nvidia-drm-latest-kmod-devel/Makefile
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod-devel/Makefile
@@ -0,0 +1,7 @@
+NVIDIA_DISTVERSION?= 580.95.05
+# Explicitly set PORTREVISION as it can be overridden by the master port
+PORTREVISION= 0
+MASTERDIR= ${.CURDIR}/../nvidia-drm-latest-kmod
+PKGNAMESUFFIX= -devel
+
+.include "${MASTERDIR}/Makefile"
diff --git a/graphics/nvidia-drm-latest-kmod-devel/distinfo b/graphics/nvidia-drm-latest-kmod-devel/distinfo
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod-devel/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1760509612
+SHA256 (NVIDIA-FreeBSD-x86_64-580.95.05.tar.xz) = 6ce64e84ede8b8a3e7c1579e9d08d53e2da9dd50590b398d9a816adc6a00f160
+SIZE (NVIDIA-FreeBSD-x86_64-580.95.05.tar.xz) = 288883876
+SHA256 (freebsd-drm-kmod-drm_v6.9_GH0.tar.gz) = a7599c2124e1fb65a270d5195d8592b0f69d0702a23938b73d097c079501129e
+SIZE (freebsd-drm-kmod-drm_v6.9_GH0.tar.gz) = 41511351
diff --git a/graphics/nvidia-drm-latest-kmod/Makefile b/graphics/nvidia-drm-latest-kmod/Makefile
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/Makefile
@@ -0,0 +1,11 @@
+PORTNAME= nvidia-drm-latest-kmod
+PORTREVISION= 0
+CATEGORIES= graphics
+
+RUN_DEPENDS+= ${KMODDIR}/drm.ko:graphics/drm-latest-kmod
+CONFLICTS_INSTALL= nvidia-drm-510-kmod* nvidia-drm-515-kmod* nvidia-drm-61-kmod* nvidia-drm-66-kmod*
+
+.include "${.CURDIR}/../drm-latest-kmod/Makefile.version"
+.include "${.CURDIR}/../nvidia-drm-kmod/Makefile.common"
+
+.include <bsd.port.mk>
diff --git a/graphics/nvidia-drm-latest-kmod/distinfo b/graphics/nvidia-drm-latest-kmod/distinfo
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1760509263
+SHA256 (NVIDIA-FreeBSD-x86_64-580.95.05.tar.xz) = 6ce64e84ede8b8a3e7c1579e9d08d53e2da9dd50590b398d9a816adc6a00f160
+SIZE (NVIDIA-FreeBSD-x86_64-580.95.05.tar.xz) = 288883876
+SHA256 (freebsd-drm-kmod-drm_v6.9_GH0.tar.gz) = a7599c2124e1fb65a270d5195d8592b0f69d0702a23938b73d097c079501129e
+SIZE (freebsd-drm-kmod-drm_v6.9_GH0.tar.gz) = 41511351
diff --git a/graphics/nvidia-drm-latest-kmod/files/20-nvidia-drm-outputclass.conf.in b/graphics/nvidia-drm-latest-kmod/files/20-nvidia-drm-outputclass.conf.in
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/files/20-nvidia-drm-outputclass.conf.in
@@ -0,0 +1,8 @@
+Section "OutputClass"
+ Identifier "nvidia"
+ MatchDriver "nvidia-drm"
+ Driver "nvidia"
+ Option "PrimaryGPU" "yes"
+ ModulePath "%%LOCALBASE%%/lib/nvidia/xorg"
+ ModulePath "%%LOCALBASE%%/lib/xorg/modules"
+EndSection
diff --git a/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-conftest.h b/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-conftest.h
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-conftest.h
@@ -0,0 +1,14 @@
+--- nvidia-drm-conftest.h.orig 2024-02-22 01:03:15 UTC
++++ nvidia-drm-conftest.h
+@@ -85,7 +85,11 @@
+
+ /* For nv_drm_gem_prime_force_fence_signal */
+ #ifndef spin_is_locked
++#if ((__FreeBSD_version >= 1500000) && (__FreeBSD_version < 1500018)) || (__FreeBSD_version < 1401501)
+ #define spin_is_locked(lock) mtx_owned(lock.m)
++#else
++#define spin_is_locked(lock) mtx_owned(lock)
++#endif
+ #endif
+
+ #ifndef rwsem_is_locked
diff --git a/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c b/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c
@@ -0,0 +1,54 @@
+--- nvidia-drm-freebsd-lkpi.c.orig 2024-02-22 01:03:15 UTC
++++ nvidia-drm-freebsd-lkpi.c
+@@ -115,6 +115,7 @@ int nv_drm_probe_devices(void)
+ * by the native nvidia.ko by using our devclass.
+ */
+ for (int i = 0; i < NV_MAX_DEVICES; i++) {
++ struct pci_dev *pdev;
+ nv_gpu_info_t gpu_info;
+ struct nvidia_softc *sc = devclass_get_softc(nvidia_devclass, i);
+ if (!sc) {
+@@ -124,11 +125,33 @@ int nv_drm_probe_devices(void)
+ nv_state_t *nv = sc->nv_state;
+
+ /*
++ * Set the ivars for this device if they are not already populated. This
++ * is the bus specific data, and linuxkpi will try to use it.
++ */
++ if (!device_get_ivars(sc->dev)) {
++ device_t parent = device_get_parent(sc->dev);
++ struct pci_devinfo *dinfo = device_get_ivars(parent);
++ device_set_ivars(sc->dev, dinfo);
++ }
++
++ /*
+ * Now we have the state (which gives us the device_t), but what nvidia-drm
+ * wants is a pci_dev suitable for use with linuxkpi code. We can use
+- * lkpinew_pci_dev to fill in a pci_dev struct,
++ * lkpinew_pci_dev to fill in a pci_dev struct, or linux_pci_attach on more
++ * recent kernels (introduced by 253dbe7487705).
+ */
+- struct pci_dev *pdev = lkpinew_pci_dev(sc->dev);
++#if __FreeBSD_version < 1300093
++ pdev = lkpinew_pci_dev(sc->dev);
++#else
++ pdev = malloc(sizeof(*pdev), M_DEVBUF, M_WAITOK|M_ZERO);
++ if (!pdev) {
++ return -ENOMEM;
++ }
++
++ if (linux_pci_attach_device(sc->dev, NULL, NULL, pdev)) {
++ return -ENOMEM;
++ }
++#endif
+ nv_lkpi_pci_devs[i] = pdev;
+
+ gpu_info.gpu_id = nv->gpu_id;
+@@ -148,7 +171,6 @@ MODULE_DEPEND(nvidia_drm, linuxkpi, 1, 1, 1);
+ LKPI_DRIVER_MODULE(nvidia_drm, nv_drm_init, nv_drm_exit);
+ LKPI_PNP_INFO(pci, nvidia_drm, nv_module_device_table);
+ MODULE_DEPEND(nvidia_drm, linuxkpi, 1, 1, 1);
+-MODULE_DEPEND(nvidia_drm, linuxkpi_gplv2, 1, 1, 1);
+ MODULE_DEPEND(nvidia_drm, drmn, 2, 2, 2);
+ MODULE_DEPEND(nvidia_drm, dmabuf, 1, 1, 1);
+ MODULE_DEPEND(nvidia_drm, nvidia, 1, 1, 1);
diff --git a/graphics/nvidia-drm-latest-kmod/files/patch-nvidia-drm-freebsd-lkpi.c-20250918-01 b/graphics/nvidia-drm-latest-kmod/files/patch-nvidia-drm-freebsd-lkpi.c-20250918-01
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/files/patch-nvidia-drm-freebsd-lkpi.c-20250918-01
@@ -0,0 +1,47 @@
+--- nvidia-drm-freebsd-lkpi.c.orig 2025-08-27 17:59:14 UTC
++++ nvidia-drm-freebsd-lkpi.c
+@@ -104,6 +104,35 @@ lkpinew_pci_dev(device_t dev)
+ * FreeBSD linuxkpi based loading support code.
+ *************************************************************************/
+
++static int
++dummy_nv_pci_probe(struct pci_dev *pci_dev __unused,
++ const struct pci_device_id *id_table __unused)
++{
++ return (0);
++}
++
++static void
++dummy_nv_pci_remove(struct pci_dev *pci_dev __unused)
++{
++}
++
++static void
++dummy_nv_pci_shutdown(struct pci_dev *pci_dev __unused)
++{
++}
++
++struct pci_driver nv_pci_driver = {
++ .name = "drmn",
++ .id_table = nv_pci_table,
++ .probe = dummy_nv_pci_probe,
++ .remove = dummy_nv_pci_remove,
++ .shutdown = dummy_nv_pci_shutdown,
++#if defined(__FreeBSD__)
++ /* FreeBSD internal/specifc. */
++ .isdrm = true,
++#endif
++};
++
+ static struct pci_dev *nv_lkpi_pci_devs[NV_MAX_DEVICES];
+
+ int nv_drm_probe_devices(void)
+@@ -153,7 +182,7 @@ int nv_drm_probe_devices(void)
+ return -ENOMEM;
+ }
+
+- if (linux_pci_attach_device(sc->dev, NULL, NULL, pdev)) {
++ if (linux_pci_attach_device(sc->dev, &nv_pci_driver, NULL, pdev)) {
+ NV_DRM_LOG_ERR("Failed to attach linuxkpi PCI device");
+ free(pdev, M_DEVBUF);
+ return -ENOMEM;
diff --git a/graphics/nvidia-drm-latest-kmod/pkg-descr b/graphics/nvidia-drm-latest-kmod/pkg-descr
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/pkg-descr
@@ -0,0 +1,3 @@
+FreeBSD port of Linux's nvidia-drm.ko Kernel module.
+
+This version is compatible with drm.ko 6.9.
diff --git a/graphics/nvidia-drm-latest-kmod/pkg-message b/graphics/nvidia-drm-latest-kmod/pkg-message
new file mode 100644
--- /dev/null
+++ b/graphics/nvidia-drm-latest-kmod/pkg-message
@@ -0,0 +1,8 @@
+Modesetting must be enabled to use nvidia-drm.ko for graphics. This can be done
+by setting the modeset sysctl, the equivalent of the modeset kernel parameter
+on Linux.
+
+hw.nvidiadrm.modeset=1
+
+This must be set before loading nvidia-drm.ko, most easily done by placing the
+above in /boot/loader.conf.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 29, 9:22 PM (1 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28468151
Default Alt Text
D53128.1777497742.diff (8 KB)
Attached To
Mode
D53128: [New port]graphics/nvidia-drm-latest-kmod, graphics/nvidia-drm-latest-kmod-devel: Add new port
Attached
Detach File
Event Timeline
Log In to Comment