git: 9bd6f0145125 - main - graphic/drm-next-kmod: New port tracking latest non-LTS version of DRM drivers

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Thu, 18 Sep 2025 16:19:11 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9bd6f0145125c665c8b962692872b36ce75c6f9f

commit 9bd6f0145125c665c8b962692872b36ce75c6f9f
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-09-17 20:00:07 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2025-09-18 16:18:22 +0000

    graphic/drm-next-kmod: New port tracking latest non-LTS version of DRM drivers
    
    This port will allow users to use the latest version of the DRM drivers.
    It will only be available for FreeBSD -CURRENT and possibly the
    upcoming/latest release (such as the upcoming 15.0-RELEASE at the time
    of this commit), depending how linuxkpi changes are backported to stable
    branches.
    
    This version is unlikely to be LTS because LTS versions are provided
    by dedicated ports such as `graphics/drm-66-kmod`.
    
    Also because this port does not track a specific version (but the
    latest), it may not be as stable as the LTS-tracking ports. It is still
    made available because it will make it easier for users to test that
    latest version of DRM drivers.
    
    Sponsored by:   The FreeBSD Foundation
---
 graphics/Makefile                             |  1 +
 graphics/drm-latest-kmod/Makefile             | 60 +++++++++++++++++++++++++++
 graphics/drm-latest-kmod/Makefile.version     |  5 +++
 graphics/drm-latest-kmod/distinfo             |  3 ++
 graphics/drm-latest-kmod/files/pkg-message.in | 22 ++++++++++
 graphics/drm-latest-kmod/pkg-descr            |  4 ++
 graphics/drm-latest-kmod/pkg-plist            |  6 +++
 7 files changed, 101 insertions(+)

diff --git a/graphics/Makefile b/graphics/Makefile
index 7cad3eaf453d..7a3b1eb528e3 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -155,6 +155,7 @@
     SUBDIR += drm-61-kmod
     SUBDIR += drm-66-kmod
     SUBDIR += drm-kmod
+    SUBDIR += drm-latest-kmod
     SUBDIR += drm_info
     SUBDIR += dspdfviewer
     SUBDIR += dssim
diff --git a/graphics/drm-latest-kmod/Makefile b/graphics/drm-latest-kmod/Makefile
new file mode 100644
index 000000000000..1f0f2fc41cb3
--- /dev/null
+++ b/graphics/drm-latest-kmod/Makefile
@@ -0,0 +1,60 @@
+PORTNAME=	drm-latest-kmod
+PORTVERSION=	${DRM_KMOD_DISTVERSION}
+CATEGORIES=	graphics kld
+
+.include "Makefile.version"
+
+MAINTAINER=	x11@FreeBSD.org
+COMMENT=	DRM drivers modules
+WWW=		https://github.com/freebsd/drm-kmod/
+
+LICENSE=	BSD2CLAUSE MIT GPLv2
+LICENSE_COMB=	multi
+
+ONLY_FOR_ARCHS=	amd64
+ONLY_FOR_ARCHS_REASON=	the new KMS components are only supported on amd64
+
+CONFLICTS_INSTALL=	drm-510-kmod \
+			drm-515-kmod \
+			drm-61-kmod
+
+USES=		kmod uidfix compiler:c++11-lang
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	freebsd
+GH_PROJECT=	drm-kmod
+GH_TAGNAME=	${DRM_KMOD_GH_TAGNAME}
+
+.include <bsd.port.options.mk>
+
+SUB_FILES=	pkg-message
+SUB_LIST=	PORTNAME=${PORTNAME} OPSYS=${OPSYS} OSREL=${OSREL}
+
+.if ${OPSYS} == FreeBSD && !( ${OSVERSION} >= 1500058 )
+IGNORE=		not supported on older than 1500058, no kernel support
+.endif
+.if ${OPSYS} != FreeBSD
+IGNORE=		not supported on anything but FreeBSD (missing linuxkpi functionality)
+.endif
+
+.if ${ARCH} == "amd64"
+PLIST_SUB+=	AMDGPU=""
+PLIST_SUB+=	I915=""
+.elif ${ARCH} == "i386"
+PLIST_SUB+=	AMDGPU="@comment "
+PLIST_SUB+=	I915=""
+.elif ${ARCH} == "aarch64" || ${ARCH:Mpowerpc*}
+PLIST_SUB+=	AMDGPU=""
+PLIST_SUB+=	I915="@comment "
+.else
+PLIST_SUB+=	AMDGPU="@comment "
+PLIST_SUB+=	I915="@comment "
+.endif
+
+MAKE_ENV+=	MAKEOBJDIRPREFIX=${WRKSRC}/obj
+
+pre-build:
+		${MKDIR} ${WRKSRC}/obj
+		(cd ${WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} obj)
+
+.include <bsd.port.mk>
diff --git a/graphics/drm-latest-kmod/Makefile.version b/graphics/drm-latest-kmod/Makefile.version
new file mode 100644
index 000000000000..e991f7357c70
--- /dev/null
+++ b/graphics/drm-latest-kmod/Makefile.version
@@ -0,0 +1,5 @@
+# drm-kmod common version definition
+#
+# This will be included from consumers such as nvidia-drm
+DRM_KMOD_DISTVERSION=	6.9
+DRM_KMOD_GH_TAGNAME=	drm_v6.9
diff --git a/graphics/drm-latest-kmod/distinfo b/graphics/drm-latest-kmod/distinfo
new file mode 100644
index 000000000000..3beec235aad4
--- /dev/null
+++ b/graphics/drm-latest-kmod/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1758133559
+SHA256 (freebsd-drm-kmod-6.9-drm_v6.9_GH0.tar.gz) = a7599c2124e1fb65a270d5195d8592b0f69d0702a23938b73d097c079501129e
+SIZE (freebsd-drm-kmod-6.9-drm_v6.9_GH0.tar.gz) = 41511351
diff --git a/graphics/drm-latest-kmod/files/pkg-message.in b/graphics/drm-latest-kmod/files/pkg-message.in
new file mode 100644
index 000000000000..95465e0ab188
--- /dev/null
+++ b/graphics/drm-latest-kmod/files/pkg-message.in
@@ -0,0 +1,22 @@
+[
+{ type: install
+  message: <<EOM
+The %%PORTNAME%% port can be enabled for amdgpu (for AMD
+GPUs starting with the HD7000 series / Tahiti) or i915kms (for Intel
+APUs starting with HD3000 / Sandy Bridge) through kld_list in
+/etc/rc.conf. radeonkms for older AMD GPUs can be loaded and there are
+some positive reports if EFI boot is NOT enabled.
+
+For amdgpu: kld_list="amdgpu"
+For Intel: kld_list="i915kms"
+For radeonkms: kld_list="radeonkms"
+
+Please ensure that all users requiring graphics are members of the
+"video" group.
+
+Please note that this package was built for %%OPSYS%% %%OSREL%%.
+If this is not your current running version, please rebuild
+it from ports to prevent panics when loading the module.
+EOM
+}
+]
diff --git a/graphics/drm-latest-kmod/pkg-descr b/graphics/drm-latest-kmod/pkg-descr
new file mode 100644
index 000000000000..af39d0f3fff6
--- /dev/null
+++ b/graphics/drm-latest-kmod/pkg-descr
@@ -0,0 +1,4 @@
+amdgpu, i915, and radeon DRM drivers modules.
+Currently corresponding to Linux 6.9 DRM.
+This version is for FreeBSD 15 1500058
+and above.
diff --git a/graphics/drm-latest-kmod/pkg-plist b/graphics/drm-latest-kmod/pkg-plist
new file mode 100644
index 000000000000..42f54df26cff
--- /dev/null
+++ b/graphics/drm-latest-kmod/pkg-plist
@@ -0,0 +1,6 @@
+/%%KMODDIR%%/dmabuf.ko
+%%AMDGPU%%/%%KMODDIR%%/amdgpu.ko
+/%%KMODDIR%%/drm.ko
+%%I915%%/%%KMODDIR%%/i915kms.ko
+/%%KMODDIR%%/radeonkms.ko
+/%%KMODDIR%%/ttm.ko