Lines Matching +full:secondary +full:- +full:device

55  * Default to use monotonic timestamps for wait-for-vblank and page-flip
64 MODULE_PARM_DESC(vblankoffdelay, "Delay until vblank irq auto-disable [msecs]");
88 new_id = device_get_unit(dev->dev); in drm_minor_get_id()
91 return -EINVAL; in drm_minor_get_id()
110 refcount_init(&master->refcount, 1); in drm_master_create()
111 mtx_init(&master->lock.spinlock, "drm_master__lock__spinlock", in drm_master_create()
113 DRM_INIT_WAITQUEUE(&master->lock.lock_queue); in drm_master_create()
114 drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER); in drm_master_create()
115 INIT_LIST_HEAD(&master->magicfree); in drm_master_create()
116 master->minor = minor; in drm_master_create()
118 list_add_tail(&master->head, &minor->master_list); in drm_master_create()
125 refcount_acquire(&master->refcount); in drm_master_get()
133 struct drm_device *dev = master->minor->dev; in drm_master_destroy()
136 list_del(&master->head); in drm_master_destroy()
138 if (dev->driver->master_destroy) in drm_master_destroy()
139 dev->driver->master_destroy(dev, master); in drm_master_destroy()
141 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) { in drm_master_destroy()
142 if (r_list->master == master) { in drm_master_destroy()
143 drm_rmmap_locked(dev, r_list->map); in drm_master_destroy()
148 if (master->unique) { in drm_master_destroy()
149 free(master->unique, DRM_MEM_DRIVER); in drm_master_destroy()
150 master->unique = NULL; in drm_master_destroy()
151 master->unique_len = 0; in drm_master_destroy()
154 list_for_each_entry_safe(pt, next, &master->magicfree, head) { in drm_master_destroy()
155 list_del(&pt->head); in drm_master_destroy()
156 drm_ht_remove_item(&master->magiclist, &pt->hash_item); in drm_master_destroy()
160 drm_ht_remove(&master->magiclist); in drm_master_destroy()
167 if (refcount_release(&(*master)->refcount)) in drm_master_put()
178 if (file_priv->is_master) in drm_setmaster_ioctl()
181 if (file_priv->minor->master && file_priv->minor->master != file_priv->master) in drm_setmaster_ioctl()
182 return -EINVAL; in drm_setmaster_ioctl()
184 if (!file_priv->master) in drm_setmaster_ioctl()
185 return -EINVAL; in drm_setmaster_ioctl()
187 if (file_priv->minor->master) in drm_setmaster_ioctl()
188 return -EINVAL; in drm_setmaster_ioctl()
191 file_priv->minor->master = drm_master_get(file_priv->master); in drm_setmaster_ioctl()
192 file_priv->is_master = 1; in drm_setmaster_ioctl()
193 if (dev->driver->master_set) { in drm_setmaster_ioctl()
194 ret = dev->driver->master_set(dev, file_priv, false); in drm_setmaster_ioctl()
196 file_priv->is_master = 0; in drm_setmaster_ioctl()
197 drm_master_put(&file_priv->minor->master); in drm_setmaster_ioctl()
208 if (!file_priv->is_master) in drm_dropmaster_ioctl()
209 return -EINVAL; in drm_dropmaster_ioctl()
211 if (!file_priv->minor->master) in drm_dropmaster_ioctl()
212 return -EINVAL; in drm_dropmaster_ioctl()
215 if (dev->driver->master_drop) in drm_dropmaster_ioctl()
216 dev->driver->master_drop(dev, file_priv, false); in drm_dropmaster_ioctl()
217 drm_master_put(&file_priv->minor->master); in drm_dropmaster_ioctl()
218 file_priv->is_master = 0; in drm_dropmaster_ioctl()
228 INIT_LIST_HEAD(&dev->filelist); in drm_fill_in_dev()
229 INIT_LIST_HEAD(&dev->ctxlist); in drm_fill_in_dev()
230 INIT_LIST_HEAD(&dev->maplist); in drm_fill_in_dev()
231 INIT_LIST_HEAD(&dev->vblank_event_list); in drm_fill_in_dev()
233 mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF); in drm_fill_in_dev()
234 mtx_init(&dev->count_lock, "drmcount", NULL, MTX_DEF); in drm_fill_in_dev()
235 mtx_init(&dev->event_lock, "drmev", NULL, MTX_DEF); in drm_fill_in_dev()
236 sx_init(&dev->dev_struct_lock, "drmslk"); in drm_fill_in_dev()
237 mtx_init(&dev->ctxlist_mutex, "drmctxlist", NULL, MTX_DEF); in drm_fill_in_dev()
238 mtx_init(&dev->pcir_lock, "drmpcir", NULL, MTX_DEF); in drm_fill_in_dev()
240 if (drm_ht_create(&dev->map_hash, 12)) { in drm_fill_in_dev()
241 return -ENOMEM; in drm_fill_in_dev()
245 dev->counters = 6; in drm_fill_in_dev()
246 dev->types[0] = _DRM_STAT_LOCK; in drm_fill_in_dev()
247 dev->types[1] = _DRM_STAT_OPENS; in drm_fill_in_dev()
248 dev->types[2] = _DRM_STAT_CLOSES; in drm_fill_in_dev()
249 dev->types[3] = _DRM_STAT_IOCTLS; in drm_fill_in_dev()
250 dev->types[4] = _DRM_STAT_LOCKS; in drm_fill_in_dev()
251 dev->types[5] = _DRM_STAT_UNLOCKS; in drm_fill_in_dev()
254 * FIXME Linux<->FreeBSD: this is done in drm_setup() on Linux. in drm_fill_in_dev()
256 for (i = 0; i < ARRAY_SIZE(dev->counts); i++) in drm_fill_in_dev()
257 atomic_set(&dev->counts[i], 0); in drm_fill_in_dev()
259 dev->driver = driver; in drm_fill_in_dev()
273 if (driver->driver_features & DRIVER_GEM) { in drm_fill_in_dev()
300 driver = dev->driver; in drm_cancel_fill_in_dev()
303 if (driver->driver_features & DRIVER_GEM) in drm_cancel_fill_in_dev()
308 dev->agp && dev->agp->agp_mtrr >= 0) { in drm_cancel_fill_in_dev()
310 retval = drm_mtrr_del(dev->agp->agp_mtrr, in drm_cancel_fill_in_dev()
311 dev->agp->agp_info.ai_aperture_base, in drm_cancel_fill_in_dev()
312 dev->agp->agp_info.ai_aperture_size, in drm_cancel_fill_in_dev()
316 free(dev->agp, DRM_MEM_AGPLISTS); in drm_cancel_fill_in_dev()
317 dev->agp = NULL; in drm_cancel_fill_in_dev()
319 drm_ht_remove(&dev->map_hash); in drm_cancel_fill_in_dev()
321 mtx_destroy(&dev->irq_lock); in drm_cancel_fill_in_dev()
322 mtx_destroy(&dev->count_lock); in drm_cancel_fill_in_dev()
323 mtx_destroy(&dev->event_lock); in drm_cancel_fill_in_dev()
324 sx_destroy(&dev->dev_struct_lock); in drm_cancel_fill_in_dev()
325 mtx_destroy(&dev->ctxlist_mutex); in drm_cancel_fill_in_dev()
326 mtx_destroy(&dev->pcir_lock); in drm_cancel_fill_in_dev()
330 * Get a secondary minor number.
332 * \param dev device data structure
333 * \param sec-minor structure to hold the assigned minor
338 * minor numbers to secondary heads of multi-headed cards
356 ret = -ENOMEM; in drm_get_minor()
360 new_minor->type = type; in drm_get_minor()
361 new_minor->dev = dev; in drm_get_minor()
362 new_minor->index = minor_id; in drm_get_minor()
363 INIT_LIST_HEAD(&new_minor->master_list); in drm_get_minor()
365 new_minor->buf_sigio = NULL; in drm_get_minor()
379 ret = make_dev_p(MAKEDEV_WAITOK | MAKEDEV_CHECKNAME, &new_minor->device, in drm_get_minor()
386 new_minor->device->si_drv1 = new_minor; in drm_get_minor()
402 * Put a secondary minor number.
404 * \param sec_minor - structure to be released
415 DRM_DEBUG("release secondary minor %d\n", minor->index); in drm_put_minor()
417 funsetown(&minor->buf_sigio); in drm_put_minor()
419 destroy_dev(minor->device); in drm_put_minor()
428 * Called via drm_exit() at module unload time or when pci device is
431 * Cleans up all DRM device, calling drm_lastclose().
445 driver = dev->driver; in drm_put_dev()
450 dev->agp && dev->agp->agp_mtrr >= 0) { in drm_put_dev()
452 retval = drm_mtrr_del(dev->agp->agp_mtrr, in drm_put_dev()
453 dev->agp->agp_info.ai_aperture_base, in drm_put_dev()
454 dev->agp->agp_info.ai_aperture_size, in drm_put_dev()
460 drm_mode_group_free(&dev->primary->mode_group); in drm_put_dev()
462 if (dev->driver->unload) in drm_put_dev()
463 dev->driver->unload(dev); in drm_put_dev()
467 if (drm_core_has_AGP(dev) && dev->agp) { in drm_put_dev()
468 free(dev->agp, DRM_MEM_AGPLISTS); in drm_put_dev()
469 dev->agp = NULL; in drm_put_dev()
474 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) in drm_put_dev()
475 drm_rmmap(dev, r_list->map); in drm_put_dev()
476 drm_ht_remove(&dev->map_hash); in drm_put_dev()
481 drm_put_minor(&dev->control); in drm_put_dev()
483 if (driver->driver_features & DRIVER_GEM) in drm_put_dev()
486 drm_put_minor(&dev->primary); in drm_put_dev()
488 mtx_destroy(&dev->irq_lock); in drm_put_dev()
489 mtx_destroy(&dev->count_lock); in drm_put_dev()
490 mtx_destroy(&dev->event_lock); in drm_put_dev()
491 sx_destroy(&dev->dev_struct_lock); in drm_put_dev()
492 mtx_destroy(&dev->ctxlist_mutex); in drm_put_dev()
493 mtx_destroy(&dev->pcir_lock); in drm_put_dev()
496 list_del(&dev->driver_item); in drm_put_dev()