Lines Matching refs:lock

46  *     foreach (lock in random_ordered_set_of_locks) {
47 * ret = drm_modeset_lock(lock, ctx)
65 * If all that is needed is a single modeset lock, then the &struct
106 drm_printf(&p, "attempting to lock a contended lock without backoff:\n%s", buf);
136 * This function is deprecated. It allocates a lock acquisition context and
190 * This function is deprecated. It uses the lock acquisition context stored
280 struct drm_modeset_lock *lock;
282 lock = list_first_entry(&ctx->locked,
285 drm_modeset_unlock(lock);
290 static inline int modeset_lock(struct drm_modeset_lock *lock,
302 if (!ww_mutex_trylock(&lock->mutex, NULL))
307 ret = ww_mutex_lock_slow_interruptible(&lock->mutex, &ctx->ww_ctx);
309 ret = ww_mutex_lock_interruptible(&lock->mutex, &ctx->ww_ctx);
311 ww_mutex_lock_slow(&lock->mutex, &ctx->ww_ctx);
314 ret = ww_mutex_lock(&lock->mutex, &ctx->ww_ctx);
317 WARN_ON(!list_empty(&lock->head));
318 list_add(&lock->head, &ctx->locked);
320 /* we already hold the lock.. this is fine. For atomic
327 ctx->contended = lock;
340 * block until the contended lock becomes available.
363 * drm_modeset_lock_init - initialize lock
364 * @lock: lock to init
366 void drm_modeset_lock_init(struct drm_modeset_lock *lock)
368 ww_mutex_init(&lock->mutex, &crtc_ww_class);
369 INIT_LIST_HEAD(&lock->head);
375 * drm_modeset_lock - take modeset lock
376 * @lock: lock to take
380 * lock will be tracked by the context and can be released by calling
392 int drm_modeset_lock(struct drm_modeset_lock *lock,
396 return modeset_lock(lock, ctx, ctx->interruptible, false);
398 ww_mutex_lock(&lock->mutex, NULL);
404 * drm_modeset_lock_single_interruptible - take a single modeset lock
405 * @lock: lock to take
412 int drm_modeset_lock_single_interruptible(struct drm_modeset_lock *lock)
414 return ww_mutex_lock_interruptible(&lock->mutex, NULL);
419 * drm_modeset_unlock - drop modeset lock
420 * @lock: lock to release
422 void drm_modeset_unlock(struct drm_modeset_lock *lock)
424 list_del_init(&lock->head);
425 ww_mutex_unlock(&lock->mutex);
432 * @ctx: lock acquisition context
438 * since that lock isn't required for modeset state changes. Callers which
439 * need to grab that lock too need to do so outside of the acquire context
474 ret = drm_modeset_lock(&privobj->lock, ctx);