STRUCT DRM_MASTER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to struct drm_master(9), fresh out of the Kernel API Manual β€” this is the whole lore drop on the drm master structure and honestly it ate πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

struct drm_master β€” the drm master structure, that's the whole name, no cap 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

struct drm_master {
    struct kref refcount;
    struct drm_device *dev;
    char *unique;
    int unique_len;
    struct idr magic_map;
    void *driver_priv;
    struct drm_master *lessor;
    int lessee_id;
    struct list_head lessee_list;
    struct list_head lessees;
    struct idr leases;
    struct idr lessee_idr;
 };

πŸ’– MEMBERS πŸ’–

okay so here's the cast of characters, one by one, and every single one of them is important πŸ”₯

  • refcount β€” the refcount for this whole master object. it's the thing keeping it alive, bestie.
  • dev β€” link back to the DRM device. like a little "home" pointer 🌸
  • unique β€” the unique identifier, e.g. busid. protected by drm_device.master_mutex so don't go touching it without the lock, fr fr.
  • unique_len β€” the length of the unique field. also protected by drm_device.master_mutex. lock gang only πŸ”’
  • magic_map β€” the map of used authentication tokens. yep, protected by drm_device.master_mutex too, it's giving very consistent.
  • driver_priv β€” pointer to driver-private information. the driver's own little secrets πŸ™ˆ
  • lessor β€” the lease grantor! this one only gets set if this struct drm_master represents a lessee holding a lease of objects from a lessor. full owners of the device have this set to NULL β€” main character behaviour, honestly πŸ‘‘

the lessor does not change once it's set in drm_lease_create, and each lessee holds a reference to its lessor that it releases upon being destroyed in drm_lease_destroy. so like, the bond is permanent until destruction 😭

See also the :ref: section on display resource leasing <drm_leasing>.

  • lessee_id β€” the ID for lessees. owners (i.e. where lessor is NULL) always have ID 0, periodt. protected by drm_device.mode_config's drm_mode_config.idr_mutex.
  • lessee_list β€” the list entry of lessees of the lessor, where they get linked to lessees. not used for owners, sorry owners. protected by drm_device.mode_config's drm_mode_config.idr_mutex.
  • lessees β€” the list of drm_masters leasing from this one. protected by drm_device.mode_config's drm_mode_config.idr_mutex.

this list is empty if no leases have been granted, or if all lessees have been destroyed. and since lessors are referenced by all their lessees, this master literally cannot be destroyed unless the list is empty. no cap, that's a hard requirement πŸ’€

  • leases β€” the objects leased to this drm_master. protected by drm_device.mode_config's drm_mode_config.idr_mutex.

objects are leased all together in drm_lease_create, and they're removed all together when the lease is revoked. all-or-nothing energy ✨

  • lessee_idr β€” all lessees under this owner (only used where lessor is NULL). protected by drm_device.mode_config's drm_mode_config.idr_mutex.

🌈 DESCRIPTION 🌈

heads up 🫢 note that master structures are only relevant for the legacy/primary device nodes β€” so there can only be one per device, not one per drm_minor. iykyk πŸ’…

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./include/drm/drm_auth.h β€” go read it, bestie πŸ“–

and that's the whole page, you're so welcome πŸ§šβ€β™€οΈ this little gem came from the source tree at ./include/drm and it's dated October 2026 β€” slay, go forth and master your devices πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from