Lines Matching refs:dev
55 bool drm_dev_needs_global_mutex(struct drm_device *dev) in drm_dev_needs_global_mutex() argument
62 if (drm_core_check_feature(dev, DRIVER_LEGACY)) in drm_dev_needs_global_mutex()
71 if (dev->driver->load || dev->driver->unload) in drm_dev_needs_global_mutex()
80 if (dev->driver->lastclose) in drm_dev_needs_global_mutex()
153 struct drm_device *dev = minor->dev; in drm_file_alloc() local
181 if (drm_core_check_feature(dev, DRIVER_GEM)) in drm_file_alloc()
182 drm_gem_open(dev, file); in drm_file_alloc()
184 if (drm_core_check_feature(dev, DRIVER_SYNCOBJ)) in drm_file_alloc()
189 if (dev->driver->open) { in drm_file_alloc()
190 ret = dev->driver->open(dev, file); in drm_file_alloc()
199 if (drm_core_check_feature(dev, DRIVER_SYNCOBJ)) in drm_file_alloc()
201 if (drm_core_check_feature(dev, DRIVER_GEM)) in drm_file_alloc()
202 drm_gem_release(dev, file); in drm_file_alloc()
211 struct drm_device *dev = file_priv->minor->dev; in drm_events_release() local
215 spin_lock_irqsave(&dev->event_lock, flags); in drm_events_release()
230 spin_unlock_irqrestore(&dev->event_lock, flags); in drm_events_release()
245 struct drm_device *dev; in drm_file_free() local
250 dev = file->minor->dev; in drm_file_free()
252 drm_dbg_core(dev, "comm=\"%s\", pid=%d, dev=0x%lx, open_count=%d\n", in drm_file_free()
255 atomic_read(&dev->open_count)); in drm_file_free()
258 if (drm_core_check_feature(dev, DRIVER_LEGACY) && in drm_file_free()
259 dev->driver->preclose) in drm_file_free()
260 dev->driver->preclose(dev, file); in drm_file_free()
263 if (drm_core_check_feature(dev, DRIVER_LEGACY)) in drm_file_free()
264 drm_legacy_lock_release(dev, file->filp); in drm_file_free()
266 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) in drm_file_free()
267 drm_legacy_reclaim_buffers(dev, file); in drm_file_free()
271 if (drm_core_check_feature(dev, DRIVER_MODESET)) { in drm_file_free()
273 drm_property_destroy_user_blobs(dev, file); in drm_file_free()
276 if (drm_core_check_feature(dev, DRIVER_SYNCOBJ)) in drm_file_free()
279 if (drm_core_check_feature(dev, DRIVER_GEM)) in drm_file_free()
280 drm_gem_release(dev, file); in drm_file_free()
282 drm_legacy_ctxbitmap_flush(dev, file); in drm_file_free()
287 if (dev->driver->postclose) in drm_file_free()
288 dev->driver->postclose(dev, file); in drm_file_free()
301 struct drm_device *dev = file_priv->minor->dev; in drm_close_helper() local
303 mutex_lock(&dev->filelist_mutex); in drm_close_helper()
305 mutex_unlock(&dev->filelist_mutex); in drm_close_helper()
335 struct drm_device *dev = minor->dev; in drm_open_helper() local
343 if (dev->switch_power_state != DRM_SWITCH_POWER_ON && in drm_open_helper()
344 dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF) in drm_open_helper()
347 drm_dbg_core(dev, "comm=\"%s\", pid=%d, minor=%d\n", in drm_open_helper()
366 mutex_lock(&dev->filelist_mutex); in drm_open_helper()
367 list_add(&priv->lhead, &dev->filelist); in drm_open_helper()
368 mutex_unlock(&dev->filelist_mutex); in drm_open_helper()
375 if (!dev->hose) { in drm_open_helper()
380 dev->hose = pci_dev->sysdata; in drm_open_helper()
383 if (!dev->hose) { in drm_open_helper()
387 dev->hose = b->sysdata; in drm_open_helper()
411 struct drm_device *dev; in drm_open() local
420 dev = minor->dev; in drm_open()
421 if (drm_dev_needs_global_mutex(dev)) in drm_open()
424 if (!atomic_fetch_inc(&dev->open_count)) in drm_open()
428 filp->f_mapping = dev->anon_inode->i_mapping; in drm_open()
434 retcode = drm_legacy_setup(dev); in drm_open()
441 if (drm_dev_needs_global_mutex(dev)) in drm_open()
447 atomic_dec(&dev->open_count); in drm_open()
448 if (drm_dev_needs_global_mutex(dev)) in drm_open()
455 void drm_lastclose(struct drm_device * dev) in drm_lastclose() argument
457 drm_dbg_core(dev, "\n"); in drm_lastclose()
459 if (dev->driver->lastclose) in drm_lastclose()
460 dev->driver->lastclose(dev); in drm_lastclose()
461 drm_dbg_core(dev, "driver lastclose completed\n"); in drm_lastclose()
463 if (drm_core_check_feature(dev, DRIVER_LEGACY)) in drm_lastclose()
464 drm_legacy_dev_reinit(dev); in drm_lastclose()
466 drm_client_dev_restore(dev); in drm_lastclose()
487 struct drm_device *dev = minor->dev; in drm_release() local
489 if (drm_dev_needs_global_mutex(dev)) in drm_release()
492 drm_dbg_core(dev, "open_count = %d\n", atomic_read(&dev->open_count)); in drm_release()
496 if (atomic_dec_and_test(&dev->open_count)) in drm_release()
497 drm_lastclose(dev); in drm_release()
499 if (drm_dev_needs_global_mutex(dev)) in drm_release()
510 struct drm_device *dev; in drm_file_update_pid() local
530 dev = filp->minor->dev; in drm_file_update_pid()
531 mutex_lock(&dev->filelist_mutex); in drm_file_update_pid()
534 mutex_unlock(&dev->filelist_mutex); in drm_file_update_pid()
559 struct drm_device *dev = minor->dev; in drm_release_noglobal() local
563 if (atomic_dec_and_mutex_lock(&dev->open_count, &drm_global_mutex)) { in drm_release_noglobal()
564 drm_lastclose(dev); in drm_release_noglobal()
603 struct drm_device *dev = file_priv->minor->dev; in drm_read() local
613 spin_lock_irq(&dev->event_lock); in drm_read()
620 spin_unlock_irq(&dev->event_lock); in drm_read()
643 spin_lock_irq(&dev->event_lock); in drm_read()
646 spin_unlock_irq(&dev->event_lock); in drm_read()
722 int drm_event_reserve_init_locked(struct drm_device *dev, in drm_event_reserve_init_locked() argument
764 int drm_event_reserve_init(struct drm_device *dev, in drm_event_reserve_init() argument
772 spin_lock_irqsave(&dev->event_lock, flags); in drm_event_reserve_init()
773 ret = drm_event_reserve_init_locked(dev, file_priv, p, e); in drm_event_reserve_init()
774 spin_unlock_irqrestore(&dev->event_lock, flags); in drm_event_reserve_init()
789 void drm_event_cancel_free(struct drm_device *dev, in drm_event_cancel_free() argument
794 spin_lock_irqsave(&dev->event_lock, flags); in drm_event_cancel_free()
799 spin_unlock_irqrestore(&dev->event_lock, flags); in drm_event_cancel_free()
808 static void drm_send_event_helper(struct drm_device *dev, in drm_send_event_helper() argument
811 assert_spin_locked(&dev->event_lock); in drm_send_event_helper()
855 void drm_send_event_timestamp_locked(struct drm_device *dev, in drm_send_event_timestamp_locked() argument
858 drm_send_event_helper(dev, e, timestamp); in drm_send_event_timestamp_locked()
876 void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e) in drm_send_event_locked() argument
878 drm_send_event_helper(dev, e, 0); in drm_send_event_locked()
897 void drm_send_event(struct drm_device *dev, struct drm_pending_event *e) in drm_send_event() argument
901 spin_lock_irqsave(&dev->event_lock, irqflags); in drm_send_event()
902 drm_send_event_helper(dev, e, 0); in drm_send_event()
903 spin_unlock_irqrestore(&dev->event_lock, irqflags); in drm_send_event()
1016 struct drm_device *dev = file->minor->dev; in drm_show_fdinfo() local
1019 drm_printf(&p, "drm-driver:\t%s\n", dev->driver->name); in drm_show_fdinfo()
1022 if (dev_is_pci(dev->dev)) { in drm_show_fdinfo()
1023 struct pci_dev *pdev = to_pci_dev(dev->dev); in drm_show_fdinfo()
1030 if (dev->driver->show_fdinfo) in drm_show_fdinfo()
1031 dev->driver->show_fdinfo(&p, file); in drm_show_fdinfo()
1051 struct drm_device *dev = minor->dev; in mock_drm_getfile() local
1059 file = anon_inode_getfile("drm", dev->driver->fops, priv, flags); in mock_drm_getfile()
1066 file->f_mapping = dev->anon_inode->i_mapping; in mock_drm_getfile()
1068 drm_dev_get(dev); in mock_drm_getfile()