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)
69 return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master;
73 * drm_is_current_master - checks whether @priv is the current master
76 * Checks whether @fpriv is current master on its device. This decides whether a
80 * - the current master is assumed to own the non-shareable display hardware.
101 ret = idr_alloc(&file_priv->master->magic_map, file_priv,
123 file = idr_find(&file_priv->master->magic_map, auth->magic);
126 idr_replace(&file_priv->master->magic_map, NULL, auth->magic);
135 struct drm_master *master;
137 master = kzalloc(sizeof(*master), GFP_KERNEL);
138 if (!master)
141 kref_init(&master->refcount);
142 drm_master_legacy_init(master);
143 idr_init_base(&master->magic_map, 1);
144 master->dev = dev;
147 INIT_LIST_HEAD(&master->lessees);
148 INIT_LIST_HEAD(&master->lessee_list);
149 idr_init(&master->leases);
150 idr_init_base(&master->lessee_idr, 1);
152 return master;
158 dev->master = drm_master_get(fpriv->master);
173 old_master = fpriv->master;
178 fpriv->master = new_master;
195 * from becoming master and/or failing to release it.
197 * At the same time, the first client (for a given VT) is _always_ master.
201 * If the CAP_SYS_ADMIN was missing, no other client could become master...
207 * master as applicable. It does so by opening the fd and passing it to users
208 * while in itself logind a) does the set/drop master per users' request and
209 * b) * implicitly drops master on VT switch.
215 * - any client which fails to drop master* can DoS the application using
223 * - allow a client to drop/set master, iff it is/was master at a given point
228 * - open the node, become master implicitly and cause issues
262 if (dev->master) {
267 if (!file_priv->master) {
277 if (file_priv->master->lessor != NULL) {
279 "Attempt to set lessee %d as master\n",
280 file_priv->master->lessee_id);
296 drm_master_put(&dev->master);
315 if (!dev->master) {
320 if (file_priv->master->lessor != NULL) {
322 "Attempt to drop lessee %d as master\n",
323 file_priv->master->lessee_id);
339 /* if there is no current master make this fd it, but do not create
340 * any master object for render clients
343 if (!dev->master) {
347 file_priv->master = drm_master_get(dev->master);
358 struct drm_master *master;
361 master = file_priv->master;
363 idr_remove(&file_priv->master->magic_map, file_priv->magic);
368 drm_legacy_lock_master_cleanup(dev, master);
370 if (dev->master == file_priv->master)
375 * this is the "real" master
377 drm_lease_revoke(master);
380 /* drop the master reference held by the file priv */
381 if (file_priv->master)
382 drm_master_put(&file_priv->master);
387 * drm_master_get - reference a master pointer
388 * @master: &struct drm_master
390 * Increments the reference count of @master and returns a pointer to @master.
392 struct drm_master *drm_master_get(struct drm_master *master)
394 kref_get(&master->refcount);
395 return master;
400 * drm_file_get_master - reference &drm_file.master of @file_priv
403 * Increments the reference count of @file_priv's &drm_file.master and returns
404 * the &drm_file.master. If @file_priv has no &drm_file.master, returns NULL.
411 struct drm_master *master = NULL;
414 if (!file_priv->master)
416 master = drm_master_get(file_priv->master);
420 return master;
426 struct drm_master *master = container_of(kref, struct drm_master, refcount);
427 struct drm_device *dev = master->dev;
430 drm_lease_destroy(master);
432 drm_legacy_master_rmmaps(dev, master);
434 idr_destroy(&master->magic_map);
435 idr_destroy(&master->leases);
436 idr_destroy(&master->lessee_idr);
438 kfree(master->unique);
439 kfree(master);
443 * drm_master_put - unreference and clear a master pointer
444 * @master: pointer to a pointer of &struct drm_master
446 * This decrements the &drm_master behind @master and sets it to NULL.
448 void drm_master_put(struct drm_master **master)
450 kref_put(&(*master)->refcount, drm_master_destroy);
451 *master = NULL;
459 if (dev->master) {