svn commit: r261626 - stable/9/sys/dev/drm2

Jean-Sebastien Pedron dumbbell at FreeBSD.org
Sat Feb 8 09:50:03 UTC 2014


Author: dumbbell
Date: Sat Feb  8 09:50:02 2014
New Revision: 261626
URL: http://svnweb.freebsd.org/changeset/base/261626

Log:
  MFC r254792:
  
  drm: Call drm_global_init() & drm_global_release() at module load/unload

Added:
  stable/9/sys/dev/drm2/drm_core.h
     - copied unchanged from r254792, head/sys/dev/drm2/drm_core.h
Modified:
  stable/9/sys/dev/drm2/drm_drv.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Copied: stable/9/sys/dev/drm2/drm_core.h (from r254792, head/sys/dev/drm2/drm_core.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/sys/dev/drm2/drm_core.h	Sat Feb  8 09:50:02 2014	(r261626, copy of r254792, head/sys/dev/drm2/drm_core.h)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004 Jon Smirl <jonsmirl at gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define CORE_AUTHOR		"Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl"
+
+#define CORE_NAME		"drm"
+#define CORE_DESC		"DRM shared core routines"
+#define CORE_DATE		"20060810"
+
+#define DRM_IF_MAJOR	1
+#define DRM_IF_MINOR	4
+
+#define CORE_MAJOR	1
+#define CORE_MINOR	1
+#define CORE_PATCHLEVEL 0

Modified: stable/9/sys/dev/drm2/drm_drv.c
==============================================================================
--- stable/9/sys/dev/drm2/drm_drv.c	Sat Feb  8 09:25:56 2014	(r261625)
+++ stable/9/sys/dev/drm2/drm_drv.c	Sat Feb  8 09:50:02 2014	(r261626)
@@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysent.h>
 #include <dev/drm2/drmP.h>
 #include <dev/drm2/drm.h>
+#include <dev/drm2/drm_core.h>
+#include <dev/drm2/drm_global.h>
 #include <dev/drm2/drm_sarea.h>
 #include <dev/drm2/drm_mode.h>
 
@@ -76,7 +78,7 @@ static moduledata_t drm_mod = {
 	"drmn",
 	drm_modevent,
 	0
-}; 
+};
 DECLARE_MODULE(drmn, drm_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
 MODULE_VERSION(drmn, 1);
 MODULE_DEPEND(drmn, agp, 1, 1, 1);
@@ -208,7 +210,7 @@ static struct drm_msi_blacklist_entry dr
 static int drm_msi_is_blacklisted(int vendor, int device)
 {
 	int i = 0;
-	
+
 	for (i = 0; drm_msi_blacklist[i].vendor != 0; i++) {
 		if ((drm_msi_blacklist[i].vendor == vendor) &&
 		    (drm_msi_blacklist[i].device == device)) {
@@ -347,7 +349,7 @@ drm_pci_id_list_t *drm_find_description(
     drm_pci_id_list_t *idlist)
 {
 	int i = 0;
-	
+
 	for (i = 0; idlist[i].vendor != 0; i++) {
 		if ((idlist[i].vendor == vendor) &&
 		    ((idlist[i].device == device) ||
@@ -744,7 +746,7 @@ void drm_close(void *data)
 
 		drm_lock_free(&dev->lock,
 		    _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
-		
+
 				/* FIXME: may require heavy-handed reset of
                                    hardware at this point, possibly
                                    processed via a callback to the X
@@ -807,7 +809,7 @@ extern drm_ioctl_desc_t drm_compat_ioctl
 
 /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm.
  */
-int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags, 
+int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
     DRM_STRUCTPROC *p)
 {
 	struct drm_device *dev = drm_get_device_from_kdev(kdev);
@@ -965,14 +967,9 @@ MODULE_DEPEND(DRIVER_NAME, linux, 1, 1, 
 #define LINUX_IOCTL_DRM_MAX		0x64ff
 
 static linux_ioctl_function_t drm_linux_ioctl;
-static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl, 
+static struct linux_ioctl_handler drm_handler = {drm_linux_ioctl,
     LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX};
 
-SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE, 
-    linux_ioctl_register_handler, &drm_handler);
-SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, 
-    linux_ioctl_unregister_handler, &drm_handler);
-
 /* The bits for in/out are switched on Linux */
 #define LINUX_IOC_IN	IOC_OUT
 #define LINUX_IOC_OUT	IOC_IN
@@ -988,13 +985,45 @@ drm_linux_ioctl(DRM_STRUCTPROC *p, struc
 		args->cmd |= IOC_IN;
 	if (cmd & LINUX_IOC_OUT)
 		args->cmd |= IOC_OUT;
-	
+
 	error = ioctl(p, (struct ioctl_args *)args);
 
 	return error;
 }
 #endif /* DRM_LINUX */
 
+
+static int
+drm_core_init(void *arg)
+{
+
+	drm_global_init();
+
+#if DRM_LINUX
+	linux_ioctl_register_handler(&drm_handler);
+#endif /* DRM_LINUX */
+
+	DRM_INFO("Initialized %s %d.%d.%d %s\n",
+		 CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
+	return 0;
+}
+
+static void
+drm_core_exit(void *arg)
+{
+
+#if DRM_LINUX
+	linux_ioctl_unregister_handler(&drm_handler);
+#endif /* DRM_LINUX */
+
+	drm_global_release();
+}
+
+SYSINIT(drm_register, SI_SUB_KLD, SI_ORDER_MIDDLE,
+    drm_core_init, NULL);
+SYSUNINIT(drm_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,
+    drm_core_exit, NULL);
+
 bool
 dmi_check_system(const struct dmi_system_id *sysid)
 {
@@ -1002,4 +1031,3 @@ dmi_check_system(const struct dmi_system
 	/* XXXKIB */
 	return (false);
 }
-


More information about the svn-src-stable-9 mailing list