1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2023 Intel Corporation
6 #ifndef __INTEL_MODESET_LOCK_H__
7 #define __INTEL_MODESET_LOCK_H__
9 #include <linux/types.h>
11 struct drm_modeset_acquire_ctx;
12 struct intel_atomic_state;
14 void _intel_modeset_lock_begin(struct drm_modeset_acquire_ctx *ctx,
15 struct intel_atomic_state *state,
18 bool _intel_modeset_lock_loop(int *ret);
19 void _intel_modeset_lock_end(struct drm_modeset_acquire_ctx *ctx,
20 struct intel_atomic_state *state,
24 * Note that one must always use "continue" rather than
25 * "break" or "return" to handle errors within the
26 * intel_modeset_lock_ctx_retry() block.
28 #define intel_modeset_lock_ctx_retry(ctx, state, flags, ret) \
29 for (_intel_modeset_lock_begin((ctx), (state), (flags), &(ret)); \
30 _intel_modeset_lock_loop(&(ret)); \
31 _intel_modeset_lock_end((ctx), (state), &(ret)))
33 #endif /* __INTEL_MODESET_LOCK_H__ */