git: e86cd62dba7a - main - graphics/drm-515-kmod: Add new port

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Fri, 17 Feb 2023 14:08:50 UTC
The branch main has been updated by manu:

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

commit e86cd62dba7ae097b9c07edc4b0774bf768f6d07
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-02-17 14:05:27 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-02-17 14:08:20 +0000

    graphics/drm-515-kmod: Add new port
    
    This port track drm code from Linux 5.15.25
    Only FreeBSD-CURRENT is supported for now.
    
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 graphics/Makefile                 |  1 +
 graphics/drm-510-kmod/Makefile    |  2 +-
 graphics/drm-515-kmod/Makefile    | 53 +++++++++++++++++++++++++++++++++++++++
 graphics/drm-515-kmod/distinfo    |  3 +++
 graphics/drm-515-kmod/pkg-descr   |  3 +++
 graphics/drm-515-kmod/pkg-message | 18 +++++++++++++
 graphics/drm-515-kmod/pkg-plist   |  7 ++++++
 7 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/graphics/Makefile b/graphics/Makefile
index 70d6c13748ea..beb2cd85c48e 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -145,6 +145,7 @@
     SUBDIR += drawing
     SUBDIR += drawpile
     SUBDIR += drm-510-kmod
+    SUBDIR += drm-515-kmod
     SUBDIR += drm-fbsd12.0-kmod
     SUBDIR += drm-kmod
     SUBDIR += drm_info
diff --git a/graphics/drm-510-kmod/Makefile b/graphics/drm-510-kmod/Makefile
index 1fe8590e8bf2..c772517a383e 100644
--- a/graphics/drm-510-kmod/Makefile
+++ b/graphics/drm-510-kmod/Makefile
@@ -13,7 +13,7 @@ LICENSE_COMB=	multi
 ONLY_FOR_ARCHS=	aarch64 amd64 i386 powerpc64 powerpc64le
 ONLY_FOR_ARCHS_REASON=	the new KMS components are only supported on amd64, i386, aarch64, and powerpc64
 
-CONFLICTS_INSTALL=	drm-devel-kmod drm-current-kmod drm-54-kmod
+CONFLICTS_INSTALL=	drm-515-kmod
 
 USES=		kmod uidfix compiler:c++11-lang
 
diff --git a/graphics/drm-515-kmod/Makefile b/graphics/drm-515-kmod/Makefile
new file mode 100644
index 000000000000..f0aebce53da4
--- /dev/null
+++ b/graphics/drm-515-kmod/Makefile
@@ -0,0 +1,53 @@
+PORTNAME=	drm-515-kmod
+PORTVERSION=	5.15.25
+CATEGORIES=	graphics kld
+
+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=	aarch64 amd64 i386 powerpc64 powerpc64le
+ONLY_FOR_ARCHS_REASON=	the new KMS components are only supported on amd64, i386, aarch64, and powerpc64
+
+CONFLICTS_INSTALL=	drm-510-kmod
+
+USES=		kmod uidfix compiler:c++11-lang
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	freebsd
+GH_PROJECT=	drm-kmod
+GH_TAGNAME=	drm_v5.15.25
+
+.include <bsd.port.options.mk>
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1400081
+IGNORE=		not supported on older than 14.0, 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-515-kmod/distinfo b/graphics/drm-515-kmod/distinfo
new file mode 100644
index 000000000000..73b13e906c2a
--- /dev/null
+++ b/graphics/drm-515-kmod/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1676642447
+SHA256 (freebsd-drm-kmod-5.15.25-drm_v5.15.25_GH0.tar.gz) = 50c36652a8c6b60799c2499e12eec6efc01b02459ae07e4d177580bfb56d63ed
+SIZE (freebsd-drm-kmod-5.15.25-drm_v5.15.25_GH0.tar.gz) = 26082555
diff --git a/graphics/drm-515-kmod/pkg-descr b/graphics/drm-515-kmod/pkg-descr
new file mode 100644
index 000000000000..4f137a75d5eb
--- /dev/null
+++ b/graphics/drm-515-kmod/pkg-descr
@@ -0,0 +1,3 @@
+amdgpu, i915, and radeon DRM drivers modules.
+Currently corresponding to Linux 5.15 DRM.
+This version is for FreeBSD 14.0 and above.
diff --git a/graphics/drm-515-kmod/pkg-message b/graphics/drm-515-kmod/pkg-message
new file mode 100644
index 000000000000..e8371da62e5a
--- /dev/null
+++ b/graphics/drm-515-kmod/pkg-message
@@ -0,0 +1,18 @@
+[
+{ type: install
+  message: <<EOM
+The drm-515-kmod 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.
+EOM
+}
+]
diff --git a/graphics/drm-515-kmod/pkg-plist b/graphics/drm-515-kmod/pkg-plist
new file mode 100644
index 000000000000..8cc848853a47
--- /dev/null
+++ b/graphics/drm-515-kmod/pkg-plist
@@ -0,0 +1,7 @@
+/%%KMODDIR%%/dmabuf.ko
+%%AMDGPU%%/%%KMODDIR%%/amdgpu.ko
+/%%KMODDIR%%/drm.ko
+%%I915%%/%%KMODDIR%%/i915kms.ko
+/%%KMODDIR%%/linuxkpi_gplv2.ko
+/%%KMODDIR%%/radeonkms.ko
+/%%KMODDIR%%/ttm.ko