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 drm: Make some legacy UMS crap build.
details: https://anonhg.NetBSD.org/src/rev/e06e3abdbb6e
branches: trunk
changeset: 1028927:e06e3abdbb6e
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:30:04 2021 +0000
description:
drm: Make some legacy UMS crap build.
diffstat:
sys/external/bsd/drm2/dist/drm/drm_auth.c | 10 +++++-
sys/external/bsd/drm2/dist/drm/drm_bufs.c | 15 +++++++---
sys/external/bsd/drm2/dist/drm/drm_context.c | 5 ++-
sys/external/bsd/drm2/dist/drm/drm_legacy_misc.c | 9 ++++--
sys/external/bsd/drm2/drm/drm_lock.c | 34 +++++++++++++++++++++--
sys/external/bsd/drm2/drm/drm_scatter.c | 5 ++-
sys/external/bsd/drm2/drm/files.drmkms | 4 +-
sys/external/bsd/drm2/include/linux/io.h | 3 +-
sys/external/bsd/drm2/include/linux/seq_file.h | 3 +-
9 files changed, 67 insertions(+), 21 deletions(-)
diffs (290 lines):
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/dist/drm/drm_auth.c
--- a/sys/external/bsd/drm2/dist/drm/drm_auth.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_auth.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_auth.c,v 1.5 2021/12/18 23:44:57 riastradh Exp $ */
+/* $NetBSD: drm_auth.c,v 1.6 2021/12/19 12:30:04 riastradh Exp $ */
/*
* Created: Tue Feb 2 08:37:54 1999 by faith%valinux.com@localhost
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_auth.c,v 1.5 2021/12/18 23:44:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_auth.c,v 1.6 2021/12/19 12:30:04 riastradh Exp $");
#include <linux/slab.h>
@@ -348,6 +348,12 @@
idr_destroy(&master->leases);
idr_destroy(&master->lessee_idr);
+#ifdef CONFIG_DRM_LEGACY
+ /* XXX drm_master_legacy_init unwind */
+ DRM_DESTROY_WAITQUEUE(&master->lock.lock_queue);
+ spin_lock_destroy(&master->lock.spinlock);
+#endif
+
kfree(master->unique);
kfree(master);
}
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/dist/drm/drm_bufs.c
--- a/sys/external/bsd/drm2/dist/drm/drm_bufs.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_bufs.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_bufs.c,v 1.15 2021/12/19 00:55:51 riastradh Exp $ */
+/* $NetBSD: drm_bufs.c,v 1.16 2021/12/19 12:30:04 riastradh Exp $ */
/*
* Legacy: Generic DRM Buffer Management
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_bufs.c,v 1.15 2021/12/19 00:55:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_bufs.c,v 1.16 2021/12/19 12:30:04 riastradh Exp $");
#include <linux/export.h>
#include <linux/log2.h>
@@ -262,14 +262,14 @@
map->offset = (unsigned long)map->handle;
if (map->flags & _DRM_CONTAINS_LOCK) {
/* Prevent a 2nd X Server from creating a 2nd lock */
- spin_lock(&dev->primary->master->lock.spinlock);
+ spin_lock(&dev->master->lock.spinlock);
if (dev->master->lock.hw_lock != NULL) {
spin_unlock(&dev->master->lock.spinlock);
vfree(map->handle);
kfree(map);
return -EBUSY;
}
- spin_unlock(&dev->primary->master->lock.spinlock);
+ spin_unlock(&dev->master->lock.spinlock);
dev->sigdata.lock = dev->master->lock.hw_lock = map->handle; /* Pointer to lock */
}
break;
@@ -588,7 +588,7 @@
* equivalent to having a master set?
*
* XXX There is copypasta of this in
- * drm_fops.c.
+ * drm_lock.c, drm_legacy_lock_master_cleanup.
*/
BUG_ON(master->lock.hw_lock == NULL);
if (dev->sigdata.lock == master->lock.hw_lock)
@@ -1514,8 +1514,13 @@
idx = array_index_nospec(idx, dma->buf_count);
buf = dma->buflist[idx];
if (buf->file_priv != file_priv) {
+#ifdef __NetBSD__
+ DRM_ERROR("Process %d freeing buffer not owned\n",
+ (int)curproc->p_pid);
+#else
DRM_ERROR("Process %d freeing buffer not owned\n",
task_pid_nr(current));
+#endif
return -EINVAL;
}
drm_legacy_free_buffer(dev, buf);
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/dist/drm/drm_context.c
--- a/sys/external/bsd/drm2/dist/drm/drm_context.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_context.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_context.c,v 1.8 2021/12/19 00:56:09 riastradh Exp $ */
+/* $NetBSD: drm_context.c,v 1.9 2021/12/19 12:30:04 riastradh Exp $ */
/*
* Legacy: Generic DRM Contexts
@@ -31,8 +31,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_context.c,v 1.8 2021/12/19 00:56:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_context.c,v 1.9 2021/12/19 12:30:04 riastradh Exp $");
+#include <linux/err.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/dist/drm/drm_legacy_misc.c
--- a/sys/external/bsd/drm2/dist/drm/drm_legacy_misc.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_legacy_misc.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_legacy_misc.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $ */
+/* $NetBSD: drm_legacy_misc.c,v 1.3 2021/12/19 12:30:04 riastradh Exp $ */
/*
* \file drm_legacy_misc.c
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_legacy_misc.c,v 1.2 2021/12/18 23:44:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_legacy_misc.c,v 1.3 2021/12/19 12:30:04 riastradh Exp $");
#include <drm/drm_agpsupport.h>
#include <drm/drm_device.h>
@@ -47,6 +47,8 @@
#include "drm_internal.h"
#include "drm_legacy.h"
+#include <linux/nbsd-namespace.h>
+
void drm_legacy_init_members(struct drm_device *dev)
{
INIT_LIST_HEAD(&dev->ctxlist);
@@ -59,6 +61,7 @@
void drm_legacy_destroy_members(struct drm_device *dev)
{
mutex_destroy(&dev->ctxlist_mutex);
+ spin_lock_destroy(&dev->buf_lock);
}
int drm_legacy_setup(struct drm_device * dev)
@@ -108,5 +111,5 @@
void drm_master_legacy_init(struct drm_master *master)
{
spin_lock_init(&master->lock.spinlock);
- init_waitqueue_head(&master->lock.lock_queue);
+ DRM_INIT_WAITQUEUE(&master->lock.lock_queue, "drmlock");
}
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/drm/drm_lock.c
--- a/sys/external/bsd/drm2/drm/drm_lock.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/drm/drm_lock.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_lock.c,v 1.12 2021/12/19 09:52:00 riastradh Exp $ */
+/* $NetBSD: drm_lock.c,v 1.13 2021/12/19 12:30:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,14 +46,18 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_lock.c,v 1.12 2021/12/19 09:52:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_lock.c,v 1.13 2021/12/19 12:30:05 riastradh Exp $");
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/file.h>
#include <sys/systm.h>
+#include <drm/drm_device.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_file.h>
#include <drm/drm_print.h>
+
#include "../dist/drm/drm_internal.h"
#include "../dist/drm/drm_legacy.h"
@@ -216,7 +220,31 @@
out0: mutex_lock(&drm_global_mutex);
return error;
}
-#endif
+
+void
+drm_legacy_lock_master_cleanup(struct drm_device *dev,
+ struct drm_master *master)
+{
+
+ if (!drm_core_check_feature(dev, DRIVER_LEGACY))
+ return;
+
+ /*
+ * XXX Synchronize with _DRM_SHM case of
+ * drm_legacy_rmmap_locked in drm_bufs.c.
+ */
+ spin_lock(&master->lock.spinlock);
+ if (master->lock.hw_lock) {
+ if (dev->sigdata.lock == master->lock.hw_lock)
+ dev->sigdata.lock = NULL;
+ master->lock.hw_lock = NULL;
+ master->lock.file_priv = NULL;
+ DRM_SPIN_WAKEUP_ALL(&master->lock.lock_queue,
+ &master->lock.spinlock);
+ }
+ spin_unlock(&master->lock.spinlock);
+}
+#endif /* CONFIG_DRM_LEGACY */
/*
* Try to acquire the lock. Whether or not we acquire it, guarantee
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/drm/drm_scatter.c
--- a/sys/external/bsd/drm2/drm/drm_scatter.c Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/drm/drm_scatter.c Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_scatter.c,v 1.8 2021/12/19 10:32:59 riastradh Exp $ */
+/* $NetBSD: drm_scatter.c,v 1.9 2021/12/19 12:30:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,13 +30,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.8 2021/12/19 10:32:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_scatter.c,v 1.9 2021/12/19 12:30:05 riastradh Exp $");
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/errno.h>
#include <sys/systm.h>
+#include <linux/mm.h>
#include <linux/slab.h>
#include <drm/drm_device.h>
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/drm/files.drmkms
--- a/sys/external/bsd/drm2/drm/files.drmkms Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/drm/files.drmkms Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.drmkms,v 1.69 2021/12/19 12:23:16 riastradh Exp $
+# $NetBSD: files.drmkms,v 1.70 2021/12/19 12:30:05 riastradh Exp $
version 20180827
@@ -88,7 +88,7 @@
file external/bsd/drm2/dist/drm/drm_context.c drmums
file external/bsd/drm2/dist/drm/drm_dma.c drmums
file external/bsd/drm2/dist/drm/drm_legacy_misc.c drmums
-file external/bsd/drm2/dist/drm/drm_lock.c drmums
+file external/bsd/drm2/drm/drm_lock.c drmums
file external/bsd/drm2/drm/drm_scatter.c drmums
# GPU scheduler
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/include/linux/io.h
--- a/sys/external/bsd/drm2/include/linux/io.h Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/io.h Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io.h,v 1.7 2021/12/19 01:49:21 riastradh Exp $ */
+/* $NetBSD: io.h,v 1.8 2021/12/19 12:30:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
#define _LINUX_IO_H_
#include <linux/types.h>
+#include <linux/err.h>
#include <asm/io.h>
diff -r 223d81386198 -r e06e3abdbb6e sys/external/bsd/drm2/include/linux/seq_file.h
--- a/sys/external/bsd/drm2/include/linux/seq_file.h Sun Dec 19 12:29:55 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/seq_file.h Sun Dec 19 12:30:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: seq_file.h,v 1.4 2021/12/19 09:43:34 riastradh Exp $ */
+/* $NetBSD: seq_file.h,v 1.5 2021/12/19 12:30:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
#ifndef _LINUX_SEQ_FILE_H_
#define _LINUX_SEQ_FILE_H_
+#include <linux/capability.h>
#include <linux/string.h>
struct seq_file;
Home |
Main Index |
Thread Index |
Old Index