include/drm/drm_modeset_lock.h
Source file repositories/reference/linux-study-clean/include/drm/drm_modeset_lock.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_modeset_lock.h- Extension
.h- Size
- 7244 bytes
- Lines
- 216
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/stackdepot.hlinux/ww_mutex.h
Detected Declarations
struct drm_modeset_lockstruct drm_modeset_acquire_ctxstruct drm_modeset_lockstruct drm_devicestruct drm_crtcstruct drm_planefunction drm_modeset_lock_finifunction drm_modeset_is_lockedfunction drm_modeset_lock_assert_heldfunction DRM_MODESET_LOCK_ALL_BEGIN
Annotated Snippet
struct drm_modeset_acquire_ctx {
struct ww_acquire_ctx ww_ctx;
/*
* Contended lock: if a lock is contended you should only call
* drm_modeset_backoff() which drops locks and slow-locks the
* contended lock.
*/
struct drm_modeset_lock *contended;
/*
* Stack depot for debugging when a contended lock was not backed off
* from.
*/
depot_stack_handle_t stack_depot;
/*
* list of held locks (drm_modeset_lock)
*/
struct list_head locked;
/*
* Trylock mode, use only for panic handlers!
*/
bool trylock_only;
/* Perform interruptible waits on this context. */
bool interruptible;
};
/**
* struct drm_modeset_lock - used for locking modeset resources.
* @mutex: resource locking
* @head: used to hold its place on &drm_atomi_state.locked list when
* part of an atomic update
*
* Used for locking CRTCs and other modeset resources.
*/
struct drm_modeset_lock {
/*
* modeset lock
*/
struct ww_mutex mutex;
/*
* Resources that are locked as part of an atomic update are added
* to a list (so we know what to unlock at the end).
*/
struct list_head head;
};
#define DRM_MODESET_ACQUIRE_INTERRUPTIBLE BIT(0)
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
uint32_t flags);
void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
int drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
void drm_modeset_lock_init(struct drm_modeset_lock *lock);
/**
* drm_modeset_lock_fini - cleanup lock
* @lock: lock to cleanup
*/
static inline void drm_modeset_lock_fini(struct drm_modeset_lock *lock)
{
WARN_ON(!list_empty(&lock->head));
}
/**
* drm_modeset_is_locked - equivalent to mutex_is_locked()
* @lock: lock to check
*/
static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock)
{
return ww_mutex_is_locked(&lock->mutex);
}
/**
* drm_modeset_lock_assert_held - equivalent to lockdep_assert_held()
* @lock: lock to check
*/
static inline void drm_modeset_lock_assert_held(struct drm_modeset_lock *lock)
{
lockdep_assert_held(&lock->mutex.base);
}
int drm_modeset_lock(struct drm_modeset_lock *lock,
Annotation
- Immediate include surface: `linux/types.h`, `linux/stackdepot.h`, `linux/ww_mutex.h`.
- Detected declarations: `struct drm_modeset_lock`, `struct drm_modeset_acquire_ctx`, `struct drm_modeset_lock`, `struct drm_device`, `struct drm_crtc`, `struct drm_plane`, `function drm_modeset_lock_fini`, `function drm_modeset_is_locked`, `function drm_modeset_lock_assert_held`, `function DRM_MODESET_LOCK_ALL_BEGIN`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.