Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2 Make drmkms build without drmkms_pci.
details: https://anonhg.NetBSD.org/src/rev/54b98d340314
branches: trunk
changeset: 366424:54b98d340314
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 15:31:27 2018 +0000
description:
Make drmkms build without drmkms_pci.
diffstat:
sys/external/bsd/drm2/dist/drm/drm_internal.h | 9 +++-
sys/external/bsd/drm2/drm/drm_module.c | 66 +++++++++++++++++++++++++-
sys/external/bsd/drm2/nouveau/files.nouveau | 4 +-
sys/external/bsd/drm2/nouveau/nouveau_module.c | 14 ++++-
sys/external/bsd/drm2/pci/drm_pci.c | 15 +----
sys/external/bsd/drm2/pci/drm_pci_module.c | 14 ++++-
sys/external/bsd/drm2/pci/files.drmkms_pci | 3 +-
7 files changed, 104 insertions(+), 21 deletions(-)
diffs (truncated from 324 to 300 lines):
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/dist/drm/drm_internal.h
--- a/sys/external/bsd/drm2/dist/drm/drm_internal.h Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_internal.h Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_internal.h,v 1.3 2018/08/27 15:22:53 riastradh Exp $ */
+/* $NetBSD: drm_internal.h,v 1.4 2018/08/27 15:31:27 riastradh Exp $ */
/*
* Copyright © 2014 Intel Corporation
@@ -37,6 +37,13 @@
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv);
+#ifdef __NetBSD__
+int drm_pci_set_unique_impl(struct drm_device *, struct drm_master *,
+ struct drm_unique *);
+void drm_pci_set_unique_hook(int (**)(struct drm_device *, struct drm_master *,
+ struct drm_unique *));
+#endif
+
/* drm_vm.c */
#ifndef __NetBSD__
int drm_vma_info(struct seq_file *m, void *data);
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/drm/drm_module.c
--- a/sys/external/bsd/drm2/drm/drm_module.c Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/drm/drm_module.c Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_module.c,v 1.11 2015/04/13 22:24:34 pgoyette Exp $ */
+/* $NetBSD: drm_module.c,v 1.12 2018/08/27 15:31:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,12 +30,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.11 2015/04/13 22:24:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.12 2018/08/27 15:31:27 riastradh Exp $");
#include <sys/types.h>
+#include <sys/condvar.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#ifndef _MODULE
#include <sys/once.h>
#endif
@@ -46,6 +48,7 @@
#include <drm/drmP.h>
#include <drm/drm_encoder_slave.h>
+#include <drm/drm_internal.h>
#include <drm/drm_sysctl.h>
/*
@@ -57,6 +60,14 @@
struct drm_sysctl_def drm_def = DRM_SYSCTL_INIT();
+static struct {
+ kmutex_t lock;
+ kcondvar_t cv;
+ unsigned refcnt;
+ int (*hook)(struct drm_device *,
+ struct drm_master *, struct drm_unique *);
+} set_unique_hook __cacheline_aligned;
+
static int
drm_init(void)
{
@@ -107,6 +118,57 @@
spin_lock_destroy(&drm_minor_lock);
}
+int
+drm_irq_by_busid(struct drm_device *dev, void *data, struct drm_file *file)
+{
+
+ return -ENODEV;
+}
+
+/* XXX Stupid kludge... */
+
+void
+drm_pci_set_unique_hook(int (**hook)(struct drm_device *, struct drm_master *,
+ struct drm_unique *))
+{
+ int (*old)(struct drm_device *, struct drm_master *,
+ struct drm_unique *);
+
+ mutex_enter(&set_unique_hook.lock);
+ while (set_unique_hook.refcnt)
+ cv_wait(&set_unique_hook.cv, &set_unique_hook.lock);
+ old = set_unique_hook.hook;
+ set_unique_hook.hook = *hook;
+ *hook = old;
+ mutex_exit(&set_unique_hook.lock);
+}
+
+int
+drm_pci_set_unique(struct drm_device *dev, struct drm_master *master,
+ struct drm_unique *unique)
+{
+ int ret;
+
+ mutex_enter(&set_unique_hook.lock);
+ while (set_unique_hook.refcnt == UINT_MAX)
+ cv_wait(&set_unique_hook.cv, &set_unique_hook.lock);
+ set_unique_hook.refcnt++;
+ mutex_exit(&set_unique_hook.lock);
+
+ if (set_unique_hook.hook)
+ ret = set_unique_hook.hook(dev, master, unique);
+ else
+ ret = -ENODEV;
+
+ mutex_enter(&set_unique_hook.lock);
+ if (set_unique_hook.refcnt-- == UINT_MAX ||
+ set_unique_hook.refcnt == 0)
+ cv_broadcast(&set_unique_hook.cv);
+ mutex_exit(&set_unique_hook.lock);
+
+ return ret;
+}
+
static int
drmkms_modcmd(modcmd_t cmd, void *arg __unused)
{
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/nouveau/files.nouveau
--- a/sys/external/bsd/drm2/nouveau/files.nouveau Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/nouveau/files.nouveau Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.nouveau,v 1.18 2018/08/27 15:22:55 riastradh Exp $
+# $NetBSD: files.nouveau,v 1.19 2018/08/27 15:31:27 riastradh Exp $
define nouveaufbbus { }
device nouveau: drmkms, drmkms_ttm, nouveaufbbus
@@ -97,7 +97,7 @@
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c nouveau
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c nouveau
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_ctrl.c nouveau
-file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c nouveau
+file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c nouveau_pci
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c nouveau
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_user.c nouveau
file external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_base.c nouveau
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/nouveau/nouveau_module.c
--- a/sys/external/bsd/drm2/nouveau/nouveau_module.c Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/nouveau/nouveau_module.c Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_module.c,v 1.7 2018/08/27 14:17:21 riastradh Exp $ */
+/* $NetBSD: nouveau_module.c,v 1.8 2018/08/27 15:31:27 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.7 2018/08/27 14:17:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.8 2018/08/27 15:31:27 riastradh Exp $");
#include <sys/types.h>
#include <sys/module.h>
@@ -41,6 +41,10 @@
#include <core/device.h>
+#ifdef _KERNEL_OPT
+#include "opt_drmkms_pci.h"
+#endif
+
MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms"); /* XXX drmkms_i2c, drmkms_ttm */
#ifdef _MODULE
@@ -49,12 +53,15 @@
struct drm_sysctl_def nouveau_def = DRM_SYSCTL_INIT();
+#if NDRMKMS_PCI > 0
extern struct drm_driver *const nouveau_drm_driver_stub; /* XXX */
extern struct drm_driver *const nouveau_drm_driver_pci; /* XXX */
+#endif
static int
nouveau_init(void)
{
+#if NDRMKMS_PCI > 0
int error;
*nouveau_drm_driver_pci = *nouveau_drm_driver_stub;
@@ -65,6 +72,7 @@
error = drm_pci_init(nouveau_drm_driver_pci, NULL);
if (error)
return error;
+#endif
nvkm_devices_init();
drm_sysctl_init(&nouveau_def);
@@ -78,7 +86,9 @@
drm_sysctl_fini(&nouveau_def);
nvkm_devices_fini();
+#if NDRMKMS_PCI > 0
drm_pci_exit(nouveau_drm_driver_pci, NULL);
+#endif
}
static int
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/pci/drm_pci.c
--- a/sys/external/bsd/drm2/pci/drm_pci.c Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci.c Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_pci.c,v 1.27 2018/08/27 15:28:39 riastradh Exp $ */
+/* $NetBSD: drm_pci.c,v 1.28 2018/08/27 15:31:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.27 2018/08/27 15:28:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci.c,v 1.28 2018/08/27 15:31:27 riastradh Exp $");
#include <sys/types.h>
#include <sys/errno.h>
@@ -39,8 +39,8 @@
#include <dev/pci/pcivar.h>
#include <drm/drmP.h>
+#include <drm/drm_internal.h>
#include <drm/drm_legacy.h>
-#include <drm/drm_internal.h>
struct drm_bus_irq_cookie {
pci_intr_handle_t *intr_handles;
@@ -276,14 +276,7 @@
}
int
-drm_irq_by_busid(struct drm_device *dev, void *data, struct drm_file *file)
-{
-
- return -ENODEV;
-}
-
-int
-drm_pci_set_unique(struct drm_device *dev, struct drm_master *master,
+drm_pci_set_unique_impl(struct drm_device *dev, struct drm_master *master,
struct drm_unique *unique)
{
char kbuf[64], ubuf[64];
diff -r 5b765c647162 -r 54b98d340314 sys/external/bsd/drm2/pci/drm_pci_module.c
--- a/sys/external/bsd/drm2/pci/drm_pci_module.c Mon Aug 27 15:29:54 2018 +0000
+++ b/sys/external/bsd/drm2/pci/drm_pci_module.c Mon Aug 27 15:31:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_pci_module.c,v 1.5 2018/08/27 15:10:12 riastradh Exp $ */
+/* $NetBSD: drm_pci_module.c,v 1.6 2018/08/27 15:31:27 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.5 2018/08/27 15:10:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci_module.c,v 1.6 2018/08/27 15:31:27 riastradh Exp $");
#include <sys/module.h>
#include <sys/once.h>
#include <drm/drmP.h>
+#include <drm/drm_internal.h>
MODULE(MODULE_CLASS_MISC, drmkms_pci, "drmkms,pci");
@@ -54,6 +55,9 @@
};
#endif
+static int (*drm_pci_set_unique_save)(struct drm_device *, struct drm_master *,
+ struct drm_unique *);
+
static int
drmkms_pci_agp_init(void)
{
@@ -65,6 +69,9 @@
return error;
#endif
+ drm_pci_set_unique_save = drm_pci_set_unique_impl;
+ drm_pci_set_unique_hook(&drm_pci_set_unique_save);
+
return 0;
}
@@ -84,6 +91,9 @@
drmkms_pci_agp_fini(void)
Home |
Main Index |
Thread Index |
Old Index