-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
graphics/nvidia-drm-66-kmod: add new port
This adds the corresponding nvidia-drm port for drm-66-kmod. This chases commit 00508c0. Sponsored by: NVIDIA Reviewed by: kbowling (mentor), manu Differential Revision: https://reviews.freebsd.org/D49065
- Loading branch information
Austin Shafer
authored and
Austin Shafer
committed
Feb 20, 2025
1 parent
e30c064
commit 3dc2b5a
Showing
11 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PORTNAME= nvidia-drm-66-kmod | ||
CATEGORIES= graphics | ||
|
||
BUILD_DEPENDS+= ${KMODDIR}/drm.ko:graphics/drm-66-kmod | ||
RUN_DEPENDS+= ${KMODDIR}/drm.ko:graphics/drm-66-kmod | ||
CONFLICTS_INSTALL= nvidia-drm-510-kmod nvidia-drm-515-kmod nvidia-drm-61-kmod | ||
|
||
.include "${.CURDIR}/../drm-66-kmod/Makefile.version" | ||
.include "${.CURDIR}/../nvidia-drm-kmod/Makefile.common" | ||
|
||
.include <bsd.port.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TIMESTAMP = 1739992459 | ||
SHA256 (NVIDIA-FreeBSD-x86_64-550.127.05.tar.xz) = 74557d328ad74f604599ee2df3d42defc86ebe231e7cbe99c860f928f16a0bc3 | ||
SIZE (NVIDIA-FreeBSD-x86_64-550.127.05.tar.xz) = 143641432 | ||
SHA256 (freebsd-drm-kmod-drm_v6.6.25_1_GH0.tar.gz) = 9de65da6907e2b61b09e9836e923b48dc029e68e2cb4521c17df75f3529fa640 | ||
SIZE (freebsd-drm-kmod-drm_v6.6.25_1_GH0.tar.gz) = 38488410 |
8 changes: 8 additions & 0 deletions
8
graphics/nvidia-drm-66-kmod/files/20-nvidia-drm-outputclass.conf.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
14 changes: 14 additions & 0 deletions
14
graphics/nvidia-drm-66-kmod/files/extra-patch-nvidia-drm-conftest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
54 changes: 54 additions & 0 deletions
54
graphics/nvidia-drm-66-kmod/files/extra-patch-nvidia-drm-freebsd-lkpi.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FreeBSD port of Linux's nvidia-drm.ko Kernel module. | ||
|
||
This version is compatible with drm.ko 6.6. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 nvdidia-drm.ko, most easily done by placing the | ||
above in /boot/loader.conf. |