Commit 259907fef771 ("drm/atomic: Create function to insert colorop
state into a commit") asserts if the lock of the plane colorop is held.
Now that a colorop can be also parented by a CRTC, colorop->plane is
NULL for a CRTC colorop and drm_atomic_commit_set_colorop_state() has to
check the CRTC mutex instead of plane mutex. Update the helper to assert
the lock of the object that owns the colorop.Signed-off-by: Melissa Wen <[email protected]> --- v3: - new patch: adapt the lock assert added by commit 259907fef771 to colorops parented to a CRTC --- drivers/gpu/drm/drm_atomic.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index e72e5e7ee76b..6d608795f28b 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -710,7 +710,10 @@ static void drm_atomic_commit_set_colorop_state(struct drm_atomic_commit *commit { int index = drm_colorop_index(colorop); - drm_modeset_lock_assert_held(&colorop->plane->mutex); + if (colorop->plane) + drm_modeset_lock_assert_held(&colorop->plane->mutex); + else if (colorop->crtc) + drm_modeset_lock_assert_held(&colorop->crtc->mutex); commit->colorops[index].state_to_destroy = colorop_state; commit->colorops[index].old_state = colorop->state; @@ -725,8 +728,8 @@ static void drm_atomic_commit_set_colorop_state(struct drm_atomic_commit *commit * @colorop: colorop to get state object for * * This function returns the colorop state for the given colorop, allocating it - * if needed. It will also grab the relevant plane lock to make sure that the - * state is consistent. + * if needed. It will also grab the relevant plane or CRTC lock to make sure + * that the state is consistent. * * Returns: * -- 2.53.0
