Lines Matching refs:dev
35 __FBSDID("$FreeBSD: releng/11.0/sys/dev/drm2/drm_stub.c 288653 2015-10-04 07:45:36Z adrian $");
37 #include <dev/drm2/drmP.h>
38 #include <dev/drm2/drm_core.h>
86 static int drm_minor_get_id(struct drm_device *dev, int type)
90 new_id = device_get_unit(dev->dev);
135 struct drm_device *dev = master->minor->dev;
140 if (dev->driver->master_destroy)
141 dev->driver->master_destroy(dev, master);
143 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
145 drm_rmmap_locked(dev, r_list->map);
175 int drm_setmaster_ioctl(struct drm_device *dev, void *data,
192 DRM_LOCK(dev);
195 if (dev->driver->master_set) {
196 ret = dev->driver->master_set(dev, file_priv, false);
202 DRM_UNLOCK(dev);
207 int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
216 DRM_LOCK(dev);
217 if (dev->driver->master_drop)
218 dev->driver->master_drop(dev, file_priv, false);
221 DRM_UNLOCK(dev);
225 int drm_fill_in_dev(struct drm_device *dev,
230 INIT_LIST_HEAD(&dev->filelist);
231 INIT_LIST_HEAD(&dev->ctxlist);
232 INIT_LIST_HEAD(&dev->maplist);
233 INIT_LIST_HEAD(&dev->vblank_event_list);
235 mtx_init(&dev->irq_lock, "drmirq", NULL, MTX_DEF);
236 mtx_init(&dev->count_lock, "drmcount", NULL, MTX_DEF);
237 mtx_init(&dev->event_lock, "drmev", NULL, MTX_DEF);
238 sx_init(&dev->dev_struct_lock, "drmslk");
239 mtx_init(&dev->ctxlist_mutex, "drmctxlist", NULL, MTX_DEF);
240 mtx_init(&dev->pcir_lock, "drmpcir", NULL, MTX_DEF);
242 if (drm_ht_create(&dev->map_hash, 12)) {
247 dev->counters = 6;
248 dev->types[0] = _DRM_STAT_LOCK;
249 dev->types[1] = _DRM_STAT_OPENS;
250 dev->types[2] = _DRM_STAT_CLOSES;
251 dev->types[3] = _DRM_STAT_IOCTLS;
252 dev->types[4] = _DRM_STAT_LOCKS;
253 dev->types[5] = _DRM_STAT_UNLOCKS;
258 for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
259 atomic_set(&dev->counts[i], 0);
261 dev->driver = driver;
263 retcode = drm_pci_agp_init(dev);
269 retcode = drm_ctxbitmap_init(dev);
276 retcode = drm_gem_init(dev);
284 retcode = drm_sysctl_init(dev);
293 drm_cancel_fill_in_dev(dev);
298 void drm_cancel_fill_in_dev(struct drm_device *dev)
302 driver = dev->driver;
304 drm_sysctl_cleanup(dev);
306 drm_gem_destroy(dev);
307 drm_ctxbitmap_cleanup(dev);
309 if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
310 dev->agp && dev->agp->agp_mtrr >= 0) {
312 retval = drm_mtrr_del(dev->agp->agp_mtrr,
313 dev->agp->agp_info.ai_aperture_base,
314 dev->agp->agp_info.ai_aperture_size,
318 free(dev->agp, DRM_MEM_AGPLISTS);
319 dev->agp = NULL;
321 drm_ht_remove(&dev->map_hash);
323 mtx_destroy(&dev->irq_lock);
324 mtx_destroy(&dev->count_lock);
325 mtx_destroy(&dev->event_lock);
326 sx_destroy(&dev->dev_struct_lock);
327 mtx_destroy(&dev->ctxlist_mutex);
328 mtx_destroy(&dev->pcir_lock);
334 * \param dev device data structure
342 int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type)
351 minor_id = drm_minor_get_id(dev, type);
363 new_minor->dev = dev;
436 void drm_put_dev(struct drm_device *dev)
443 if (!dev) {
444 DRM_ERROR("cleanup called no dev\n");
447 driver = dev->driver;
449 drm_lastclose(dev);
451 if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
452 dev->agp && dev->agp->agp_mtrr >= 0) {
454 retval = drm_mtrr_del(dev->agp->agp_mtrr,
455 dev->agp->agp_info.ai_aperture_base,
456 dev->agp->agp_info.ai_aperture_size,
461 if (drm_core_check_feature(dev, DRIVER_MODESET))
462 drm_mode_group_free(&dev->primary->mode_group);
464 if (dev->driver->unload)
465 dev->driver->unload(dev);
467 drm_sysctl_cleanup(dev);
469 if (drm_core_has_AGP(dev) && dev->agp) {
470 free(dev->agp, DRM_MEM_AGPLISTS);
471 dev->agp = NULL;
474 drm_vblank_cleanup(dev);
476 list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
477 drm_rmmap(dev, r_list->map);
478 drm_ht_remove(&dev->map_hash);
480 drm_ctxbitmap_cleanup(dev);
482 if (drm_core_check_feature(dev, DRIVER_MODESET))
483 drm_put_minor(&dev->control);
486 drm_gem_destroy(dev);
488 drm_put_minor(&dev->primary);
490 mtx_destroy(&dev->irq_lock);
491 mtx_destroy(&dev->count_lock);
492 mtx_destroy(&dev->event_lock);
493 sx_destroy(&dev->dev_struct_lock);
494 mtx_destroy(&dev->ctxlist_mutex);
495 mtx_destroy(&dev->pcir_lock);
498 list_del(&dev->driver_item);