Lines Matching refs:master
32 struct drm_master *drm_lease_owner(struct drm_master *master) in drm_lease_owner() argument
34 while (master->lessor != NULL) in drm_lease_owner()
35 master = master->lessor; in drm_lease_owner()
36 return master; in drm_lease_owner()
50 _drm_find_lessee(struct drm_master *master, int lessee_id) in _drm_find_lessee() argument
52 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_find_lessee()
53 return idr_find(&drm_lease_owner(master)->lessee_idr, lessee_id); in _drm_find_lessee()
67 static int _drm_lease_held_master(struct drm_master *master, int id) in _drm_lease_held_master() argument
69 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_lease_held_master()
70 if (master->lessor) in _drm_lease_held_master()
71 return idr_find(&master->leases, id) != NULL; in _drm_lease_held_master()
86 static bool _drm_has_leased(struct drm_master *master, int id) in _drm_has_leased() argument
90 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_has_leased()
91 drm_for_each_lessee(lessee, master) in _drm_has_leased()
110 if (!file_priv || !file_priv->master) in _drm_lease_held()
113 return _drm_lease_held_master(file_priv->master, id); in _drm_lease_held()
129 struct drm_master *master; in drm_lease_held() local
132 if (!file_priv || !file_priv->master || !file_priv->master->lessor) in drm_lease_held()
135 master = file_priv->master; in drm_lease_held()
136 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
137 ret = _drm_lease_held_master(master, id); in drm_lease_held()
138 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
152 struct drm_master *master; in drm_lease_filter_crtcs() local
158 if (!file_priv || !file_priv->master || !file_priv->master->lessor) in drm_lease_filter_crtcs()
161 master = file_priv->master; in drm_lease_filter_crtcs()
162 dev = master->dev; in drm_lease_filter_crtcs()
165 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
167 if (_drm_lease_held_master(master, crtc->base.id)) { in drm_lease_filter_crtcs()
179 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
265 void drm_lease_destroy(struct drm_master *master) in drm_lease_destroy() argument
267 struct drm_device *dev = master->dev; in drm_lease_destroy()
271 DRM_DEBUG_LEASE("drm_lease_destroy %d\n", master->lessee_id); in drm_lease_destroy()
276 WARN_ON(!list_empty(&master->lessees)); in drm_lease_destroy()
279 if (master->lessee_id != 0) { in drm_lease_destroy()
280 DRM_DEBUG_LEASE("remove master %d from device list of lessees\n", master->lessee_id); in drm_lease_destroy()
281 idr_remove(&(drm_lease_owner(master)->lessee_idr), master->lessee_id); in drm_lease_destroy()
285 list_del(&master->lessee_list); in drm_lease_destroy()
289 if (master->lessor) { in drm_lease_destroy()
292 drm_master_put(&master->lessor); in drm_lease_destroy()
295 DRM_DEBUG_LEASE("drm_lease_destroy done %d\n", master->lessee_id); in drm_lease_destroy()
306 struct drm_master *master = top; in _drm_lease_revoke() local
315 DRM_DEBUG_LEASE("revoke leases for %p %d\n", master, master->lessee_id); in _drm_lease_revoke()
318 idr_for_each_entry(&master->leases, entry, object) in _drm_lease_revoke()
319 idr_remove(&master->leases, object); in _drm_lease_revoke()
324 if (!list_empty(&master->lessees)) { in _drm_lease_revoke()
325 master = list_first_entry(&master->lessees, struct drm_master, lessee_list); in _drm_lease_revoke()
328 …while (master != top && master == list_last_entry(&master->lessor->lessees, struct drm_master, les… in _drm_lease_revoke()
329 master = master->lessor; in _drm_lease_revoke()
331 if (master == top) in _drm_lease_revoke()
335 master = list_next_entry(master, lessee_list); in _drm_lease_revoke()
493 struct drm_master *lessor = lessor_priv->master; in drm_mode_create_lease_ioctl()
568 drm_master_put(&lessee_priv->master); in drm_mode_create_lease_ioctl()
569 lessee_priv->master = lessee; in drm_mode_create_lease_ioctl()
612 struct drm_master *lessor = lessor_priv->master, *lessee; in drm_mode_list_lessees_ioctl()
665 struct drm_master *lessee = lessee_priv->master; in drm_mode_get_lease_ioctl()
724 struct drm_master *lessor = lessor_priv->master; in drm_mode_revoke_lease_ioctl()