This patch simplifying the handling of modeset locks and atomic state for an atomic commit is based on https://lore.kernel.org/all/20210715184954.7794-2-ville.syrjala@linux.intel.com/ adding the helper to i915. I find this approach preferrable than open-coding the corresponding steps (fixed for me an atomic state reset during a DEADLK retry, which I missed in the open-coded version) and also better than the existing DRM_MODESET_LOCK_ALL_BEGIN/END macros for the reasons described in the above original patchset. This change takes the helper into use only for atomic commits during DDI hotplug handling, as a preparation for a follow-up patch adding a similar commit started from the same spot. Other places doing a driver-internal atomic commit is to be converted by a follow-up patchset. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-13-imre.deak@intel.com
33 lines
989 B
C
33 lines
989 B
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2023 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __INTEL_MODESET_LOCK_H__
|
|
#define __INTEL_MODESET_LOCK_H__
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct drm_modeset_acquire_ctx;
|
|
struct intel_atomic_state;
|
|
|
|
void _intel_modeset_lock_begin(struct drm_modeset_acquire_ctx *ctx,
|
|
struct intel_atomic_state *state,
|
|
unsigned int flags,
|
|
int *ret);
|
|
bool _intel_modeset_lock_loop(int *ret);
|
|
void _intel_modeset_lock_end(struct drm_modeset_acquire_ctx *ctx,
|
|
struct intel_atomic_state *state,
|
|
int *ret);
|
|
|
|
/*
|
|
* Note that one must always use "continue" rather than
|
|
* "break" or "return" to handle errors within the
|
|
* intel_modeset_lock_ctx_retry() block.
|
|
*/
|
|
#define intel_modeset_lock_ctx_retry(ctx, state, flags, ret) \
|
|
for (_intel_modeset_lock_begin((ctx), (state), (flags), &(ret)); \
|
|
_intel_modeset_lock_loop(&(ret)); \
|
|
_intel_modeset_lock_end((ctx), (state), &(ret)))
|
|
|
|
#endif /* __INTEL_MODESET_LOCK_H__ */
|