Lines Matching full:master
21 * DRM leases provide information about whether a DRM master may control a DRM
25 * The original DRM master of a device 'owns' the available drm resources. It
27 * to the new DRM master. This gives the new DRM master control over the
28 * leased resources until the owner revokes the lease, or the new DRM master
62 * through the SETMASTER or DROPMASTER IOCTL, so &drm_device.master points to
74 struct drm_master *drm_lease_owner(struct drm_master *master) in drm_lease_owner() argument
76 while (master->lessor != NULL) in drm_lease_owner()
77 master = master->lessor; in drm_lease_owner()
78 return master; in drm_lease_owner()
82 _drm_find_lessee(struct drm_master *master, int lessee_id) in _drm_find_lessee() argument
84 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_find_lessee()
85 return idr_find(&drm_lease_owner(master)->lessee_idr, lessee_id); in _drm_find_lessee()
88 static int _drm_lease_held_master(struct drm_master *master, int id) in _drm_lease_held_master() argument
90 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_lease_held_master()
91 if (master->lessor) in _drm_lease_held_master()
92 return idr_find(&master->leases, id) != NULL; in _drm_lease_held_master()
97 static bool _drm_has_leased(struct drm_master *master, int id) in _drm_has_leased() argument
101 lockdep_assert_held(&master->dev->mode_config.idr_mutex); in _drm_has_leased()
102 drm_for_each_lessee(lessee, master) in _drm_has_leased()
112 struct drm_master *master; in _drm_lease_held() local
117 master = drm_file_get_master(file_priv); in _drm_lease_held()
118 if (!master) in _drm_lease_held()
120 ret = _drm_lease_held_master(master, id); in _drm_lease_held()
121 drm_master_put(&master); in _drm_lease_held()
128 struct drm_master *master; in drm_lease_held() local
134 master = drm_file_get_master(file_priv); in drm_lease_held()
135 if (!master) in drm_lease_held()
137 if (!master->lessor) { in drm_lease_held()
141 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
142 ret = _drm_lease_held_master(master, id); in drm_lease_held()
143 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_held()
146 drm_master_put(&master); in drm_lease_held()
156 struct drm_master *master; in drm_lease_filter_crtcs() local
165 master = drm_file_get_master(file_priv); in drm_lease_filter_crtcs()
166 if (!master) in drm_lease_filter_crtcs()
168 if (!master->lessor) { in drm_lease_filter_crtcs()
172 dev = master->dev; in drm_lease_filter_crtcs()
175 mutex_lock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
177 if (_drm_lease_held_master(master, crtc->base.id)) { in drm_lease_filter_crtcs()
189 mutex_unlock(&master->dev->mode_config.idr_mutex); in drm_lease_filter_crtcs()
192 drm_master_put(&master); in drm_lease_filter_crtcs()
201 * ERR_PTR(-EACCES) some other master holds the title to any object
266 void drm_lease_destroy(struct drm_master *master) in drm_lease_destroy() argument
268 struct drm_device *dev = master->dev; in drm_lease_destroy()
272 drm_dbg_lease(dev, "drm_lease_destroy %d\n", master->lessee_id); in drm_lease_destroy()
274 /* This master is referenced by all lessees, hence it cannot be destroyed in drm_lease_destroy()
277 WARN_ON(!list_empty(&master->lessees)); in drm_lease_destroy()
279 /* Remove this master from the lessee idr in the owner */ in drm_lease_destroy()
280 if (master->lessee_id != 0) { in drm_lease_destroy()
281 drm_dbg_lease(dev, "remove master %d from device list of lessees\n", in drm_lease_destroy()
282 master->lessee_id); in drm_lease_destroy()
283 idr_remove(&(drm_lease_owner(master)->lessee_idr), master->lessee_id); in drm_lease_destroy()
286 /* Remove this master from any lessee list it may be on */ in drm_lease_destroy()
287 list_del(&master->lessee_list); in drm_lease_destroy()
291 if (master->lessor) { in drm_lease_destroy()
292 /* Tell the master to check the lessee list */ in drm_lease_destroy()
294 drm_master_put(&master->lessor); in drm_lease_destroy()
297 drm_dbg_lease(dev, "drm_lease_destroy done %d\n", master->lessee_id); in drm_lease_destroy()
304 struct drm_master *master = top; in _drm_lease_revoke() local
313 drm_dbg_lease(master->dev, "revoke leases for %p %d\n", in _drm_lease_revoke()
314 master, master->lessee_id); in _drm_lease_revoke()
317 idr_for_each_entry(&master->leases, entry, object) in _drm_lease_revoke()
318 idr_remove(&master->leases, object); in _drm_lease_revoke()
323 if (!list_empty(&master->lessees)) { in _drm_lease_revoke()
324 master = list_first_entry(&master->lessees, struct drm_master, lessee_list); in _drm_lease_revoke()
327 …while (master != top && master == list_last_entry(&master->lessor->lessees, struct drm_master, les… in _drm_lease_revoke()
328 master = master->lessor; in _drm_lease_revoke()
330 if (master == top) in _drm_lease_revoke()
334 master = list_next_entry(master, lessee_list); in _drm_lease_revoke()
471 * The master associated with the specified file will have a lease
559 /* Change the file to a master one */ in drm_mode_create_lease_ioctl()
560 drm_master_put(&lessee_priv->master); in drm_mode_create_lease_ioctl()
561 lessee_priv->master = lessee; in drm_mode_create_lease_ioctl()