aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/gpu/drm/drm_stub.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c56
1 files changed, 36 insertions, 20 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index d1ad57450df1..6d7b083c5b77 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -40,18 +40,48 @@
40unsigned int drm_debug = 0; /* 1 to enable debug output */ 40unsigned int drm_debug = 0; /* 1 to enable debug output */
41EXPORT_SYMBOL(drm_debug); 41EXPORT_SYMBOL(drm_debug);
42 42
43unsigned int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */
44EXPORT_SYMBOL(drm_vblank_offdelay);
45
46unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */
47EXPORT_SYMBOL(drm_timestamp_precision);
48
43MODULE_AUTHOR(CORE_AUTHOR); 49MODULE_AUTHOR(CORE_AUTHOR);
44MODULE_DESCRIPTION(CORE_DESC); 50MODULE_DESCRIPTION(CORE_DESC);
45MODULE_LICENSE("GPL and additional rights"); 51MODULE_LICENSE("GPL and additional rights");
46MODULE_PARM_DESC(debug, "Enable debug output"); 52MODULE_PARM_DESC(debug, "Enable debug output");
53MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]");
54MODULE_PARM_DESC(timestamp_precision_usec, "Max. error on timestamps [usecs]");
47 55
48module_param_named(debug, drm_debug, int, 0600); 56module_param_named(debug, drm_debug, int, 0600);
57module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600);
58module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600);
49 59
50struct idr drm_minors_idr; 60struct idr drm_minors_idr;
51 61
52struct class *drm_class; 62struct class *drm_class;
53struct proc_dir_entry *drm_proc_root; 63struct proc_dir_entry *drm_proc_root;
54struct dentry *drm_debugfs_root; 64struct dentry *drm_debugfs_root;
65
66int drm_err(const char *func, const char *format, ...)
67{
68 struct va_format vaf;
69 va_list args;
70 int r;
71
72 va_start(args, format);
73
74 vaf.fmt = format;
75 vaf.va = &args;
76
77 r = printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV", func, &vaf);
78
79 va_end(args);
80
81 return r;
82}
83EXPORT_SYMBOL(drm_err);
84
55void drm_ut_debug_printk(unsigned int request_level, 85void drm_ut_debug_printk(unsigned int request_level,
56 const char *prefix, 86 const char *prefix,
57 const char *function_name, 87 const char *function_name,
@@ -68,6 +98,7 @@ void drm_ut_debug_printk(unsigned int request_level,
68 } 98 }
69} 99}
70EXPORT_SYMBOL(drm_ut_debug_printk); 100EXPORT_SYMBOL(drm_ut_debug_printk);
101
71static int drm_minor_get_id(struct drm_device *dev, int type) 102static int drm_minor_get_id(struct drm_device *dev, int type)
72{ 103{
73 int new_id; 104 int new_id;
@@ -240,14 +271,10 @@ int drm_fill_in_dev(struct drm_device *dev,
240 INIT_LIST_HEAD(&dev->vblank_event_list); 271 INIT_LIST_HEAD(&dev->vblank_event_list);
241 272
242 spin_lock_init(&dev->count_lock); 273 spin_lock_init(&dev->count_lock);
243 spin_lock_init(&dev->drw_lock);
244 spin_lock_init(&dev->event_lock); 274 spin_lock_init(&dev->event_lock);
245 init_timer(&dev->timer);
246 mutex_init(&dev->struct_mutex); 275 mutex_init(&dev->struct_mutex);
247 mutex_init(&dev->ctxlist_mutex); 276 mutex_init(&dev->ctxlist_mutex);
248 277
249 idr_init(&dev->drw_idr);
250
251 if (drm_ht_create(&dev->map_hash, 12)) { 278 if (drm_ht_create(&dev->map_hash, 12)) {
252 return -ENOMEM; 279 return -ENOMEM;
253 } 280 }
@@ -263,25 +290,14 @@ int drm_fill_in_dev(struct drm_device *dev,
263 290
264 dev->driver = driver; 291 dev->driver = driver;
265 292
266 if (drm_core_has_AGP(dev)) { 293 if (dev->driver->bus->agp_init) {
267 if (drm_device_is_agp(dev)) 294 retcode = dev->driver->bus->agp_init(dev);
268 dev->agp = drm_agp_init(dev); 295 if (retcode)
269 if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP)
270 && (dev->agp == NULL)) {
271 DRM_ERROR("Cannot initialize the agpgart module.\n");
272 retcode = -EINVAL;
273 goto error_out_unreg; 296 goto error_out_unreg;
274 }
275 if (drm_core_has_MTRR(dev)) {
276 if (dev->agp)
277 dev->agp->agp_mtrr =
278 mtrr_add(dev->agp->agp_info.aper_base,
279 dev->agp->agp_info.aper_size *
280 1024 * 1024, MTRR_TYPE_WRCOMB, 1);
281 }
282 } 297 }
283 298
284 299
300
285 retcode = drm_ctxbitmap_init(dev); 301 retcode = drm_ctxbitmap_init(dev);
286 if (retcode) { 302 if (retcode) {
287 DRM_ERROR("Cannot allocate memory for context bitmap.\n"); 303 DRM_ERROR("Cannot allocate memory for context bitmap.\n");
@@ -419,7 +435,6 @@ int drm_put_minor(struct drm_minor **minor_p)
419 * 435 *
420 * Cleans up all DRM device, calling drm_lastclose(). 436 * Cleans up all DRM device, calling drm_lastclose().
421 * 437 *
422 * \sa drm_init
423 */ 438 */
424void drm_put_dev(struct drm_device *dev) 439void drm_put_dev(struct drm_device *dev)
425{ 440{
@@ -469,6 +484,7 @@ void drm_put_dev(struct drm_device *dev)
469 484
470 drm_put_minor(&dev->primary); 485 drm_put_minor(&dev->primary);
471 486
487 list_del(&dev->driver_item);
472 if (dev->devname) { 488 if (dev->devname) {
473 kfree(dev->devname); 489 kfree(dev->devname);
474 dev->devname = NULL; 490 dev->devname = NULL;