git: 7377fed7a063 - main - graphics/drm-510-kmod: Add new port

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Sun, 01 May 2022 17:24:24 UTC
The branch main has been updated by manu:

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

commit 7377fed7a063420992359af3a15006fa4fee6303
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-04-28 12:25:42 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-05-01 17:23:25 +0000

    graphics/drm-510-kmod: Add new port
    
    Add new ports that track drm from Linux 5.10
    This ports works on 13.1 and above.
    
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 graphics/Makefile                 |  1 +
 graphics/drm-510-kmod/Makefile    | 52 +++++++++++++++++++++++++++++++++++++++
 graphics/drm-510-kmod/distinfo    |  3 +++
 graphics/drm-510-kmod/pkg-descr   |  5 ++++
 graphics/drm-510-kmod/pkg-message | 18 ++++++++++++++
 graphics/drm-510-kmod/pkg-plist   |  7 ++++++
 graphics/drm-54-kmod/Makefile     |  2 +-
 7 files changed, 87 insertions(+), 1 deletion(-)

diff --git a/graphics/Makefile b/graphics/Makefile
index 85c3ab1499c3..b5d543ae6c0f 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -140,6 +140,7 @@
     SUBDIR += drawing
     SUBDIR += drawpile
     SUBDIR += drm-54-kmod
+    SUBDIR += drm-510-kmod
     SUBDIR += drm-current-kmod
     SUBDIR += drm-devel-kmod
     SUBDIR += drm-fbsd12.0-kmod
diff --git a/graphics/drm-510-kmod/Makefile b/graphics/drm-510-kmod/Makefile
new file mode 100644
index 000000000000..b6975c2d7c3a
--- /dev/null
+++ b/graphics/drm-510-kmod/Makefile
@@ -0,0 +1,52 @@
+PORTNAME=	drm-510-kmod
+PORTVERSION=	5.10.0
+CATEGORIES=	graphics kld
+
+MAINTAINER=	x11@FreeBSD.org
+COMMENT=	DRM drivers modules
+
+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-devel-kmod drm-current-kmod drm-54-kmod
+
+USES=		kmod uidfix compiler:c++11-lang
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	freebsd
+GH_PROJECT=	drm-kmod
+GH_TAGNAME=	drm_v5.10_4
+
+.include <bsd.port.options.mk>
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1301000
+IGNORE=		not supported on older than 13.1, 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-510-kmod/distinfo b/graphics/drm-510-kmod/distinfo
new file mode 100644
index 000000000000..55598c2c28e9
--- /dev/null
+++ b/graphics/drm-510-kmod/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1651420970
+SHA256 (freebsd-drm-kmod-5.10.0-drm_v5.10_4_GH0.tar.gz) = fa546dfc17f5326a0e7e4cd87c78d03bad4f7ef998003244177beded00f9cc64
+SIZE (freebsd-drm-kmod-5.10.0-drm_v5.10_4_GH0.tar.gz) = 20088981
diff --git a/graphics/drm-510-kmod/pkg-descr b/graphics/drm-510-kmod/pkg-descr
new file mode 100644
index 000000000000..313bdaf6da76
--- /dev/null
+++ b/graphics/drm-510-kmod/pkg-descr
@@ -0,0 +1,5 @@
+amdgpu, i915, and radeon DRM drivers modules.
+Currently corresponding to Linux 5.10 DRM.
+This version is for FreeBSD 13.1 and above.
+
+WWW: https://github.com/freebsd/drm-kmod/
diff --git a/graphics/drm-510-kmod/pkg-message b/graphics/drm-510-kmod/pkg-message
new file mode 100644
index 000000000000..75ee1546e0ba
--- /dev/null
+++ b/graphics/drm-510-kmod/pkg-message
@@ -0,0 +1,18 @@
+[
+{ type: install
+  message: <<EOM
+The drm-510-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 (similar to amdgpu).
+
+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-510-kmod/pkg-plist b/graphics/drm-510-kmod/pkg-plist
new file mode 100644
index 000000000000..8cc848853a47
--- /dev/null
+++ b/graphics/drm-510-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
diff --git a/graphics/drm-54-kmod/Makefile b/graphics/drm-54-kmod/Makefile
index 0ff437562ba5..520dc17ea59a 100644
--- a/graphics/drm-54-kmod/Makefile
+++ b/graphics/drm-54-kmod/Makefile
@@ -11,7 +11,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
+CONFLICTS_INSTALL=	drm-devel-kmod drm-current-kmod drm-510-kmod
 
 USES=		kmod uidfix compiler:c++11-lang