Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys Rework drm2 configuration and modularization.
details: https://anonhg.NetBSD.org/src/rev/10589f3a0e2c
branches: riastradh-drm2
changeset: 788638:10589f3a0e2c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Mar 04 20:45:16 2014 +0000
description:
Rework drm2 configuration and modularization.
- Split drm2.kmod into drmkms_linux, drmkms, drmkms_pci.
- Split up drmkms-related files.* similarly.
- Make drm_agp_* routines hooks that the drmkms_pci module installs.
- Reuse drm device major 180 for (old) drm and drmkms.
Now old drm and new drmkms can coexist happily in the same tree, with
or without PCI, and require no changes to userland.
diffstat:
sys/conf/files | 6 +-
sys/conf/majors | 5 +-
sys/dev/pci/files.pci | 7 +-
sys/external/bsd/drm2/conf/files.drm2 | 121 ----------------------
sys/external/bsd/drm2/dist/include/drm/drmP.h | 23 ++++
sys/external/bsd/drm2/drm/drm_drv.c | 97 ++++++++++++++++-
sys/external/bsd/drm2/drm/drm_fops.c | 6 +-
sys/external/bsd/drm2/drm/drm_module.c | 63 ++++-------
sys/external/bsd/drm2/drm/drm_vm.c | 8 +-
sys/external/bsd/drm2/drm/files.drmkms | 62 +++++++++++
sys/external/bsd/drm2/i915drm/files.i915drmkms | 60 ++++++++++
sys/external/bsd/drm2/i915drm/i915_module.c | 6 +-
sys/external/bsd/drm2/include/drm/drm_os_netbsd.h | 4 +-
sys/external/bsd/drm2/linux/files.drmkms_linux | 13 ++
sys/external/bsd/drm2/linux/linux_module.c | 88 ++++++++++++++++
sys/external/bsd/drm2/linux/linux_work.c | 15 ++-
sys/external/bsd/drm2/pci/drm_pci_module.c | 30 ++++-
sys/external/bsd/drm2/pci/files.drmkms_pci | 13 ++
sys/modules/drmkms/Makefile | 57 ++++++++++
sys/modules/drmkms/Makefile.inc | 20 +++
sys/modules/drmkms/drmkms.ioconf | 9 +
sys/modules/drmkms_linux/Makefile | 22 ++++
sys/modules/drmkms_pci/Makefile | 16 ++
sys/modules/i915drmkms/Makefile | 63 +++++++++++
sys/modules/i915drmkms/i915drmkms.ioconf | 10 +
25 files changed, 626 insertions(+), 198 deletions(-)
diffs (truncated from 1200 to 300 lines):
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/conf/files
--- a/sys/conf/files Thu Jan 30 17:18:51 2014 +0000
+++ b/sys/conf/files Tue Mar 04 20:45:16 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1077.2.3 2014/01/29 19:47:38 riastradh Exp $
+# $NetBSD: files,v 1.1077.2.4 2014/03/04 20:45:16 riastradh Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@@ -1093,11 +1093,13 @@
file dev/ic/lan9118.c smsh
# DRM - Direct Rendering Infrastructure: dev/drm
-# This is the old DRM; new DRM is in dev/pci/files.pci (XXX for now).
define drm {}
include "external/bsd/drm/conf/files.drm"
include "dev/drm/files.drm"
+# DRM/KMS - Newer direct rendering manager with kernel mode-switching
+include "external/bsd/drm2/drm/files.drmkms"
+
# Definitions for wscons
# device attributes: display, display with emulator, keyboard, and mouse
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/conf/majors
--- a/sys/conf/majors Thu Jan 30 17:18:51 2014 +0000
+++ b/sys/conf/majors Tue Mar 04 20:45:16 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: majors,v 1.66.6.1 2014/01/29 19:47:54 riastradh Exp $
+# $NetBSD: majors,v 1.66.6.2 2014/03/04 20:45:16 riastradh Exp $
#
# Device majors for Machine-Independent drivers.
#
@@ -29,7 +29,7 @@
device-major lockstat char 177 lockstat single
device-major putter char 178 putter
device-major srt char 179 srt
-device-major drm char 180 drmbase
+device-major drm char 180 drmbase | drmkms
device-major bio char 181 bio single
device-major altmem char 182 block 182 altmem
device-major twa char 187 twa
@@ -54,4 +54,3 @@
device-major seeprom char 206 seeprom
device-major dtrace char 207 dtrace
device-major spiflash char 208 block 208 spiflash
-device-major drmkms char 209 drmkms
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Thu Jan 30 17:18:51 2014 +0000
+++ b/sys/dev/pci/files.pci Tue Mar 04 20:45:16 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pci,v 1.364.6.2 2014/01/29 19:47:38 riastradh Exp $
+# $NetBSD: files.pci,v 1.364.6.3 2014/03/04 20:45:16 riastradh Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@@ -1130,6 +1130,5 @@
attach tdvfb at pci
file dev/pci/tdvfb.c tdvfb
-# DRMKMS, DRM2 with kernel mode-switching, PCI-only for now.
-define drmkms
-include "external/bsd/drm2/conf/files.drm2"
+# PCI graphics devices with DRM/KMS
+include "external/bsd/drm2/pci/files.drmkms_pci"
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/external/bsd/drm2/conf/files.drm2
--- a/sys/external/bsd/drm2/conf/files.drm2 Thu Jan 30 17:18:51 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-# $NetBSD: files.drm2,v 1.1.2.7 2014/01/30 16:49:33 riastradh Exp $
-
-define drmkmsbus { }
-
-device drmkms
-attach drmkms at drmkmsbus
-
-defflag opt_drmkms.h DRMKMS_DEBUG
-makeoptions drmkms CPPFLAGS+="-I$S/external/bsd/drm2/include"
-makeoptions drmkms CPPFLAGS+="-I$S/external/bsd/drm2/dist/uapi"
-makeoptions drmkms CPPFLAGS+="-I$S/external/bsd/drm2/dist/include"
-
-makeoptions drmkms "CWARNFLAGS.intel_panel.c"+="-Wno-shadow"
-makeoptions drmkms "CWARNFLAGS.intel_pm.c"+="-Wno-shadow"
-makeoptions drmkms "CWARNFLAGS.drm_crtc.c"+="-Wno-shadow"
-makeoptions drmkms "CWARNFLAGS.drm_edid.c"+="-Wno-shadow"
-
-# XXX Should probably be in a header file. opt_drmkms.h?
-makeoptions drmkms CPPFLAGS+="-D__KERNEL__"
-
-# XXX x86 kludge.
-makeoptions drmkms CPPFLAGS+="-DCONFIG_MTRR"
-makeoptions drmkms CPPFLAGS+="-DCONFIG_X86"
-makeoptions drmkms CPPFLAGS+="-DMTRR"
-
-file external/bsd/drm2/linux/linux_gfp.c drmkms
-file external/bsd/drm2/linux/linux_kmap.c drmkms
-file external/bsd/drm2/linux/linux_i2c.c drmkms
-file external/bsd/drm2/linux/linux_idr.c drmkms
-file external/bsd/drm2/linux/linux_list_sort.c drmkms
-file external/bsd/drm2/linux/linux_work.c drmkms
-
-#file external/bsd/drm2/dist/drm/ati_pcigart.c drmkms
-file external/bsd/drm2/dist/drm/drm_agpsupport.c drmkms
-file external/bsd/drm2/dist/drm/drm_auth.c drmkms
-file external/bsd/drm2/dist/drm/drm_buffer.c drmkms
-file external/bsd/drm2/dist/drm/drm_bufs.c drmkms
-file external/bsd/drm2/drm/drm_cache.c drmkms
-file external/bsd/drm2/dist/drm/drm_context.c drmkms
-file external/bsd/drm2/dist/drm/drm_crtc.c drmkms
-file external/bsd/drm2/dist/drm/drm_crtc_helper.c drmkms
-file external/bsd/drm2/dist/drm/drm_dma.c drmkms
-file external/bsd/drm2/dist/drm/drm_dp_helper.c drmkms
-file external/bsd/drm2/drm/drm_drv.c drmkms
-file external/bsd/drm2/dist/drm/drm_edid.c drmkms
-#file external/bsd/drm2/dist/drm/drm_encoder_slave.c drmkms
-file external/bsd/drm2/dist/drm/drm_fb_helper.c drmkms
-file external/bsd/drm2/drm/drm_fops.c drmkms
-file external/bsd/drm2/dist/drm/drm_gem.c drmkms
-file external/bsd/drm2/dist/drm/drm_global.c drmkms
-file external/bsd/drm2/dist/drm/drm_hashtab.c drmkms
-#file external/bsd/drm2/dist/drm/drm_info.c drmkms
-#file external/bsd/drm2/dist/drm/drm_ioc32.c drmkms
-file external/bsd/drm2/dist/drm/drm_ioctl.c drmkms
-file external/bsd/drm2/dist/drm/drm_irq.c drmkms
-file external/bsd/drm2/drm/drm_lock.c drmkms
-file external/bsd/drm2/drm/drm_memory.c drmkms
-file external/bsd/drm2/dist/drm/drm_mm.c drmkms
-file external/bsd/drm2/dist/drm/drm_modes.c drmkms
-file external/bsd/drm2/pci/drm_pci.c drmkms # XXX pci
-#file external/bsd/drm2/dist/drm/drm_platform.c drmkms
-#file external/bsd/drm2/dist/drm/drm_prime.c drmkms
-#file external/bsd/drm2/dist/drm/drm_proc.c drmkms
-file external/bsd/drm2/drm/drm_scatter.c drmkms
-file external/bsd/drm2/dist/drm/drm_stub.c drmkms
-file external/bsd/drm2/drm/drm_vm.c drmkms
-
-file external/bsd/drm2/drm/drm_gem_vm.c drmkms
-file external/bsd/drm2/drm/drm_module.c drmkms
-file external/bsd/drm2/drm/drm_sysfs.c drmkms
-
-device i915drmkms: drmkms, drmkmsbus, genfb, wsemuldisplaydev
-attach i915drmkms at pci
-
-makeoptions i915drmkms CPPFLAGS+="-I$S/external/bsd/drm2/dist/drm/i915"
-
-file external/bsd/drm2/dist/drm/i915/dvo_ch7017.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/dvo_ch7xxx.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/dvo_ivch.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/dvo_ns2501.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/dvo_sil164.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/dvo_tfp410.c i915drmkms
-#file external/bsd/drm2/dist/drm/i915/i915_debugfs.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_dma.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_drv.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_context.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_debug.c i915drmkms
-#file external/bsd/drm2/dist/drm/i915/i915_gem_dmabuf.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_evict.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c i915drmkms
-file external/bsd/drm2/i915drm/i915_gem_gtt.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_gem_tiling.c i915drmkms
-#file external/bsd/drm2/dist/drm/i915/i915_ioc32.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_irq.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/i915_suspend.c i915drmkms
-file external/bsd/drm2/i915drm/i915_sysfs.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_bios.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_crt.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_ddi.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_display.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_dp.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_dvo.c i915drmkms
-file external/bsd/drm2/i915drm/intel_fb.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_hdmi.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_i2c.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_lvds.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_modes.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_opregion.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_overlay.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_panel.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_pm.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_sdvo.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_sprite.c i915drmkms
-file external/bsd/drm2/dist/drm/i915/intel_tv.c i915drmkms
-
-file external/bsd/drm2/i915drm/i915_module.c i915drmkms
-file external/bsd/drm2/i915drm/i915_pci.c i915drmkms
-file external/bsd/drm2/i915drm/intel_gtt.c i915drmkms
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h Thu Jan 30 17:18:51 2014 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h Tue Mar 04 20:45:16 2014 +0000
@@ -1706,6 +1706,25 @@
extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
+#ifdef __NetBSD__
+struct drm_agp_hooks {
+ drm_ioctl_t *agph_acquire_ioctl;
+ drm_ioctl_t *agph_release_ioctl;
+ drm_ioctl_t *agph_enable_ioctl;
+ drm_ioctl_t *agph_info_ioctl;
+ drm_ioctl_t *agph_alloc_ioctl;
+ drm_ioctl_t *agph_free_ioctl;
+ drm_ioctl_t *agph_bind_ioctl;
+ drm_ioctl_t *agph_unbind_ioctl;
+ int (*agph_release)(struct drm_device *);
+};
+
+extern int drm_agp_release_hook(struct drm_device *);
+
+extern int drm_agp_register(const struct drm_agp_hooks *);
+extern void drm_agp_deregister(const struct drm_agp_hooks *);
+#endif
+
/* Stub support (drm_stub.h) */
extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
@@ -2154,5 +2173,9 @@
#endif /* defined(__NetBSD__) */
+#ifdef __NetBSD__
+extern const struct cdevsw drm_cdevsw;
+#endif
+
#endif /* __KERNEL__ */
#endif
diff -r 77dd8ed71e34 -r 10589f3a0e2c sys/external/bsd/drm2/drm/drm_drv.c
--- a/sys/external/bsd/drm2/drm/drm_drv.c Thu Jan 30 17:18:51 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_drv.c Tue Mar 04 20:45:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_drv.c,v 1.1.2.35 2014/01/29 19:47:38 riastradh Exp $ */
+/* $NetBSD: drm_drv.c,v 1.1.2.36 2014/03/04 20:45:16 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.1.2.35 2014/01/29 19:47:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.1.2.36 2014/03/04 20:45:16 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -125,6 +125,25 @@
.cmd_drv = 0, \
}
+/* XXX Kludge for AGP. */
+static drm_ioctl_t drm_agp_acquire_hook_ioctl;
+static drm_ioctl_t drm_agp_release_hook_ioctl;
+static drm_ioctl_t drm_agp_enable_hook_ioctl;
+static drm_ioctl_t drm_agp_info_hook_ioctl;
+static drm_ioctl_t drm_agp_alloc_hook_ioctl;
+static drm_ioctl_t drm_agp_free_hook_ioctl;
+static drm_ioctl_t drm_agp_bind_hook_ioctl;
+static drm_ioctl_t drm_agp_unbind_hook_ioctl;
+
+#define drm_agp_acquire_ioctl drm_agp_acquire_hook_ioctl
+#define drm_agp_release_ioctl drm_agp_release_hook_ioctl
+#define drm_agp_enable_ioctl drm_agp_enable_hook_ioctl
+#define drm_agp_info_ioctl drm_agp_info_hook_ioctl
+#define drm_agp_alloc_ioctl drm_agp_alloc_hook_ioctl
+#define drm_agp_free_ioctl drm_agp_free_hook_ioctl
+#define drm_agp_bind_ioctl drm_agp_bind_hook_ioctl
+#define drm_agp_unbind_ioctl drm_agp_unbind_hook_ioctl
+
/* Table copied verbatim from dist/drm/drm_drv.c. */
static const struct drm_ioctl_desc drm_ioctls[] = {
DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED),
@@ -240,7 +259,7 @@
#endif
};
-const struct cdevsw drmkms_cdevsw = {
+const struct cdevsw drm_cdevsw = {
.d_open = drm_open,
.d_close = noclose,
.d_read = noread,
@@ -315,7 +334,7 @@
sc->sc_minor[i].index = (i * 64) + device_unit(self);
sc->sc_minor[i].type = drm_minor_types[i];
sc->sc_minor[i].device =
- makedev(cdevsw_lookup_major(&drmkms_cdevsw),
+ makedev(cdevsw_lookup_major(&drm_cdevsw),
sc->sc_minor[i].index);
sc->sc_minor[i].kdev = self;
sc->sc_minor[i].dev = dev;
@@ -407,9 +426,10 @@
static int
drm_init(void)
{
+ extern int linux_suppress_init;
int error;
- linux_mutex_init(&drm_global_mutex);
+ KASSERT(!linux_suppress_init);
Home |
Main Index |
Thread Index |
Old Index