drm_modeset_lock_all(9)
π drm_modeset_lock_all β taking ALL the modeset locks, bestie
So you're in the Kernel API Manual and you found drm_modeset_lock_all. Okay so, real talk, this one is giving "I'm deprecated but I'm still here" energy, and we're gonna go through it together fr fr. β¨
π SYNOPSIS
void drm_modeset_lock_all (struct drm_device *dev );
πΈ ARGUMENTS
devβ the DRM device, aka the main character of this whole operation π
β¨ DESCRIPTION
Okay so here's the tea: this function takes all the modeset locks. Like, all of them. Every single one. π It's the move for when a more fine-grained scheme isn't (yet) implemented β note the messy "yet," we love a work-in-progress. π«Ά
The locks are not yours to keep, bestie β you gotta drop them by calling the drm_modeset_unlock_all function. Don't leave them hanging or it's gonna be a whole thing. π
β οΈ Important vibe check: This function is deprecated. Not like "kinda old," like officially deprecated. π
The way it works: it allocates a lock acquisition context and stores it in drm_device.mode_config. This lowkey facilitates conversion of existing code because it removes the need to manually deal with the acquisition context. Iconic convenience, right? π
But β and this is the part you need to hear β it's also brittle. π The context is global, so you gotta be so careful not to nest calls. Like, the audacity of a global context, honestly. π
New code should not be doing this. New code should use the drm_modeset_lock_all_ctx function and pass in the context explicitly. Periodt. π―
π SEE ALSO
Kernel file ./drivers/gpu/drm/drm_modeset_lock.c, and all these related icons:
kms locking(9)drm_modeset_unlock_all(9)drm_warn_on_modeset_not_all_locked(9)drm_modeset_acquire_init(9)drm_modeset_acquire_fini(9)drm_modeset_drop_locks(9)drm_modeset_backoff(9)drm_modeset_lock_init(9)drm_modeset_lock(9)drm_modeset_lock_single_interruptible(9)drm_modeset_unlock(9)drm_modeset_lock_all_ctx(9)
Okay that's the whole thing, bestie! This page lives in ./drivers/gpu/drm and it's dated October 2026 β like, future energy much? π¦ Anyway, hope this helped you understand the entire lock situation. You're literally gonna slay this. ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms