DRM_MODESET_LOCK_ALL_BEGIN(9)
π DRM_MODESET_LOCK_ALL_BEGIN π
okay bestie, welcome to drm_modeset_lock.h β this is the DRM_MODESET_LOCK_ALL_BEGIN(9) situation and honestly? it's giving "glow-up for your boilerplate". it lives over in the Kernel API Manual, and yes we're gonna read it together. π
β¨ NAME β¨
DRM_MODESET_LOCK_ALL_BEGIN β the helper that grabs all your modeset locks for you, no cap π«Ά
πΈ SYNOPSIS πΈ
DRM_MODESET_LOCK_ALL_BEGIN (dev , ctx , flags , ret );
π¦ ARGUMENTS π¦
devβ the drm device πctxβ a local modeset acquire context. lowkey important: it will be dereferenced πflagsβ theDRM_MODESET_ACQUIRE_*flags, and they get passed straight todrm_modeset_acquire_initβ¨retβ a local ret/err/etc variable that keeps track of your error status. your little emotional support int, if you will π
π DESCRIPTION π
so the whole point: use these macros to make grabbing all the modeset locks with a local context so much simpler. it's giving less boilerplate, and it also properly checks return values where appropriate β main character energy, honestly π
any code you run between BEGIN and END will be holding the modeset locks. periodt. π₯
β οΈ this must be paired with DRM_MODESET_LOCK_ALL_END. we will literally jump back and forth between the labels on deadlock and error conditions β that's just the vibe. π
drivers can acquire additional modeset locks, which is fine and valid π. but if any lock acquisition fails, the control flow needs to jump to DRM_MODESET_LOCK_ALL_END with the ret parameter containing the return value of drm_modeset_lock. don't forget the handoff, bestie. π«Ά
π RETURN π
the only possible value of ret immediately after DRM_MODESET_LOCK_ALL_BEGIN is 0 β so no error checking is necessary. slay! β
β¨
π SEE ALSO π
- Kernel file
./include/drm/drm_modeset_lock.hstruct drm_modeset_acquire_ctx(9)struct drm_modeset_lock(9)drm_modeset_lock_fini(9)drm_modeset_is_locked(9)drm_modeset_lock_assert_held(9)DRM_MODESET_LOCK_ALL_END(9)
β π and that's the whole page, bestie β brought to you from ./include/drm, dated October 2026, in the Kernel API Manual, DRM_MODESET_LOCK_ALL_BEGIN(9). go forth and lock responsibly π
πΈ
π¦ 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