summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-07-23 12:52:09 +0000
committerriastradh <riastradh@NetBSD.org>2022-07-23 12:52:09 +0000
commit3f2905226a736dfd7aeec9075df8a1762a2c2f36 (patch)
tree7b30ce3bc8cd5f35e250a5f8c5ac34581cb15c28
parenta65e5cd0d6060c27f000326ae607c82ba96f8068 (diff)
drm: Split scheduler into separate module.
Used only by amdgpu, and it uses something that is currently broken from the gcc update on aarch64, so let's make it a little more optional.
-rw-r--r--sys/external/bsd/drm2/amdgpu/amdgpu_module.c6
-rw-r--r--sys/external/bsd/drm2/amdgpu/files.amdgpu4
-rw-r--r--sys/external/bsd/drm2/drm/files.drmkms12
-rw-r--r--sys/external/bsd/drm2/drm/sched_module.c48
-rw-r--r--sys/modules/drmkms_sched/Makefile18
5 files changed, 79 insertions, 9 deletions
diff --git a/sys/external/bsd/drm2/amdgpu/amdgpu_module.c b/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
index bc51912feba..c28dbccb1f2 100644
--- a/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
+++ b/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
@@ -1,4 +1,4 @@
-/* $NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh Exp $ */
+/* $NetBSD: amdgpu_module.c,v 1.11 2022/07/23 12:52:09 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.11 2022/07/23 12:52:09 riastradh Exp $");
#include <sys/types.h>
#include <sys/module.h>
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh
#include "amdgpu_amdkfd.h"
#include "amdgpu_drv.h"
-MODULE(MODULE_CLASS_DRIVER, amdgpu, "drmkms,drmkms_pci,drmkms_ttm"); /* XXX drmkms_i2c */
+MODULE(MODULE_CLASS_DRIVER, amdgpu, "drmkms,drmkms_pci,drmkms_sched,drmkms_ttm"); /* XXX drmkms_i2c */
#ifdef _MODULE
#include "ioconf.c"
diff --git a/sys/external/bsd/drm2/amdgpu/files.amdgpu b/sys/external/bsd/drm2/amdgpu/files.amdgpu
index e192d784a6d..d4633a2e91e 100644
--- a/sys/external/bsd/drm2/amdgpu/files.amdgpu
+++ b/sys/external/bsd/drm2/amdgpu/files.amdgpu
@@ -1,9 +1,9 @@
-# $NetBSD: files.amdgpu,v 1.27 2022/07/19 23:19:06 riastradh Exp $
+# $NetBSD: files.amdgpu,v 1.28 2022/07/23 12:52:09 riastradh Exp $
version 20180827
define amdgpufbbus { }
-device amdgpu: drmkms, drmkms_pci, drmkms_ttm, amdgpufbbus, firmload
+device amdgpu: drmkms, drmkms_pci, drmkms_sched, drmkms_ttm, amdgpufbbus, firmload
attach amdgpu at pci
makeoptions amdgpu "CPPFLAGS.amdgpu"+="${CPPFLAGS.drmkms}"
diff --git a/sys/external/bsd/drm2/drm/files.drmkms b/sys/external/bsd/drm2/drm/files.drmkms
index 4de38cd8d17..20b73ebd1a4 100644
--- a/sys/external/bsd/drm2/drm/files.drmkms
+++ b/sys/external/bsd/drm2/drm/files.drmkms
@@ -1,4 +1,4 @@
-# $NetBSD: files.drmkms,v 1.79 2022/07/20 10:01:01 riastradh Exp $
+# $NetBSD: files.drmkms,v 1.80 2022/07/23 12:52:10 riastradh Exp $
version 20180827
@@ -98,9 +98,13 @@ file external/bsd/drm2/drm/drm_lock.c drmums
file external/bsd/drm2/drm/drm_scatter.c drmums
# GPU scheduler
-file external/bsd/drm2/dist/drm/scheduler/sched_entity.c drmkms
-file external/bsd/drm2/dist/drm/scheduler/sched_fence.c drmkms
-file external/bsd/drm2/dist/drm/scheduler/sched_main.c drmkms
+define drmkms_sched: drmkms
+makeoptions drmkms_sched "CPPFLAGS.drmsched"+="${CPPFLAGS.drmkms}"
+
+file external/bsd/drm2/dist/drm/scheduler/sched_entity.c drmkms_sched
+file external/bsd/drm2/dist/drm/scheduler/sched_fence.c drmkms_sched
+file external/bsd/drm2/dist/drm/scheduler/sched_main.c drmkms_sched
+file external/bsd/drm2/drm/sched_module.c drmkms_sched
# Generated from drm2netbsd.
#file external/bsd/drm2/dist/drm/drm_agpsupport.c drmkms # drmkms_pci
diff --git a/sys/external/bsd/drm2/drm/sched_module.c b/sys/external/bsd/drm2/drm/sched_module.c
new file mode 100644
index 00000000000..3f4d1774c1a
--- /dev/null
+++ b/sys/external/bsd/drm2/drm/sched_module.c
@@ -0,0 +1,48 @@
+/* $NetBSD: sched_module.c,v 1.1 2022/07/23 12:52:10 riastradh Exp $ */
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: sched_module.c,v 1.1 2022/07/23 12:52:10 riastradh Exp $");
+
+#include <sys/module.h>
+
+MODULE(MODULE_CLASS_MISC, drmkms_sched, "drmkms");
+
+static int
+drmkms_sched_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return 0;
+ case MODULE_CMD_FINI:
+ return 0;
+ default:
+ return ENOTTY;
+ }
+}
diff --git a/sys/modules/drmkms_sched/Makefile b/sys/modules/drmkms_sched/Makefile
new file mode 100644
index 00000000000..5d3fa15cc77
--- /dev/null
+++ b/sys/modules/drmkms_sched/Makefile
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.1 2022/07/23 12:52:10 riastradh Exp $
+
+.include "../Makefile.inc"
+.include "../drmkms/Makefile.inc"
+
+.PATH: ${S}/external/bsd/drm2/dist/drm/scheduler
+.PATH: ${S}/external/bsd/drm2/drm
+
+KMOD= drmkms_sched
+
+SRCS+= sched_entity.c
+SRCS+= sched_fence.c
+SRCS+= sched_main.c
+SRCS+= sched_module.c
+
+WARNS= 3
+
+.include <bsd.kmodule.mk>