mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-29 20:58:57 -04:00
The KMS framework uses two slightly different definitions for the state concept. For a given object (plane, CRTC, encoder, etc., so drm_$OBJECT_state), the state is the entire state of that object. However, at the device level, drm_atomic_state refers to a state update for a limited number of objects. Thus, drm_atomic_state isn't the entire device state, but only the full state of some objects in that device. This has been an endless source of confusion and thus bugs. We can rename the drm_atomic_state structure to drm_atomic_commit to make it less confusing. This patch was created using: rg -l drm_atomic_state | \ xargs sed -i 's/drm_atomic_state/drm_atomic_commit/g; s/drm_atomic_commit_helper/drm_atomic_state_helper/g' mv drivers/gpu/drm/tests/drm_atomic_state_test.c drivers/gpu/drm/tests/drm_atomic_commit_test.c Acked-by: Simona Vetter <simona.vetter@ffwll.ch> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patch.msgid.link/20260427-drm-drm-atomic-update-v4-1-c0e713bfdf25@kernel.org
51 lines
923 B
C
51 lines
923 B
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2023 Intel Corporation
|
|
*/
|
|
|
|
#include <drm/drm_modeset_lock.h>
|
|
|
|
#include "intel_display_types.h"
|
|
#include "intel_modeset_lock.h"
|
|
|
|
void _intel_modeset_lock_begin(struct drm_modeset_acquire_ctx *ctx,
|
|
struct intel_atomic_state *state,
|
|
unsigned int flags, int *ret)
|
|
{
|
|
drm_modeset_acquire_init(ctx, flags);
|
|
|
|
if (state)
|
|
state->base.acquire_ctx = ctx;
|
|
|
|
*ret = -EDEADLK;
|
|
}
|
|
|
|
bool _intel_modeset_lock_loop(int *ret)
|
|
{
|
|
if (*ret == -EDEADLK) {
|
|
*ret = 0;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void _intel_modeset_lock_end(struct drm_modeset_acquire_ctx *ctx,
|
|
struct intel_atomic_state *state,
|
|
int *ret)
|
|
{
|
|
if (*ret == -EDEADLK) {
|
|
if (state)
|
|
drm_atomic_commit_clear(&state->base);
|
|
|
|
*ret = drm_modeset_backoff(ctx);
|
|
if (*ret == 0) {
|
|
*ret = -EDEADLK;
|
|
return;
|
|
}
|
|
}
|
|
|
|
drm_modeset_drop_locks(ctx);
|
|
drm_modeset_acquire_fini(ctx);
|
|
}
|