Lines Matching refs:master
43 * DOC: master and authentication
47 * least once successfully became the device master (either through the
49 * no one else is the current master that time) there exists one &drm_master.
53 * In addition only one &drm_master can be the current master for a &drm_device.
58 * Clients can authenticate against the current master (if it matches their own)
71 ret = idr_alloc(&file_priv->master->magic_map, file_priv,
93 file = idr_find(&file_priv->master->magic_map, auth->magic);
96 idr_replace(&file_priv->master->magic_map, NULL, auth->magic);
105 struct drm_master *master;
107 master = kzalloc(sizeof(*master), GFP_KERNEL);
108 if (!master)
111 kref_init(&master->refcount);
112 drm_master_legacy_init(master);
113 idr_init(&master->magic_map);
114 master->dev = dev;
117 INIT_LIST_HEAD(&master->lessees);
118 INIT_LIST_HEAD(&master->lessee_list);
119 idr_init(&master->leases);
120 idr_init(&master->lessee_idr);
122 return master;
128 dev->master = drm_master_get(fpriv->master);
143 old_master = fpriv->master;
148 fpriv->master = new_master;
165 * from becoming master and/or failing to release it.
167 * At the same time, the first client (for a given VT) is _always_ master.
171 * If the CAP_SYS_ADMIN was missing, no other client could become master...
177 * master as applicable. It does so by opening the fd and passing it to users
178 * while in itself logind a) does the set/drop master per users' request and
179 * b) * implicitly drops master on VT switch.
185 * - any client which fails to drop master* can DoS the application using
193 * - allow a client to drop/set master, iff it is/was master at a given point
198 * - open the node, become master implicitly and cause issues
231 if (dev->master) {
236 if (!file_priv->master) {
246 if (file_priv->master->lessor != NULL) {
247 DRM_DEBUG_LEASE("Attempt to set lessee %d as master\n", file_priv->master->lessee_id);
263 drm_master_put(&dev->master);
282 if (!dev->master) {
287 if (file_priv->master->lessor != NULL) {
288 DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
304 /* if there is no current master make this fd it, but do not create
305 * any master object for render clients */
307 if (!dev->master) {
311 file_priv->master = drm_master_get(dev->master);
322 struct drm_master *master;
325 master = file_priv->master;
327 idr_remove(&file_priv->master->magic_map, file_priv->magic);
332 drm_legacy_lock_master_cleanup(dev, master);
334 if (dev->master == file_priv->master)
339 * this is the "real" master
341 drm_lease_revoke(master);
344 /* drop the master reference held by the file priv */
345 if (file_priv->master)
346 drm_master_put(&file_priv->master);
351 * drm_is_current_master - checks whether @priv is the current master
354 * Checks whether @fpriv is current master on its device. This decides whether a
358 * - the current master is assumed to own the non-shareable display hardware.
362 return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
367 * drm_master_get - reference a master pointer
368 * @master: &struct drm_master
370 * Increments the reference count of @master and returns a pointer to @master.
372 struct drm_master *drm_master_get(struct drm_master *master)
374 kref_get(&master->refcount);
375 return master;
380 * drm_file_get_master - reference &drm_file.master of @file_priv
383 * Increments the reference count of @file_priv's &drm_file.master and returns
384 * the &drm_file.master. If @file_priv has no &drm_file.master, returns NULL.
391 struct drm_master *master = NULL;
394 if (!file_priv->master)
396 master = drm_master_get(file_priv->master);
400 return master;
406 struct drm_master *master = container_of(kref, struct drm_master, refcount);
407 struct drm_device *dev = master->dev;
410 drm_lease_destroy(master);
412 drm_legacy_master_rmmaps(dev, master);
414 idr_destroy(&master->magic_map);
415 idr_destroy(&master->leases);
416 idr_destroy(&master->lessee_idr);
418 kfree(master->unique);
419 kfree(master);
423 * drm_master_put - unreference and clear a master pointer
424 * @master: pointer to a pointer of &struct drm_master
426 * This decrements the &drm_master behind @master and sets it to NULL.
428 void drm_master_put(struct drm_master **master)
430 kref_put(&(*master)->refcount, drm_master_destroy);
431 *master = NULL;
439 if (dev->master) {