Skip to content

Commit 6bf7969

Browse files
committed
drm/drm_atomic: duplicate colorop states if plane color pipeline in use
For suspend/resume to work correctly, do for colorop state the same we do for plane/crtc/connector states: duplicate the state of colorops in a color pipeline if it's in use by a given plane when suspending and restore cached colorop states when resuming. While at it, prevent unused-variable warning when using for_each_new_colorop_in_stage here. Fixes: 2afc318 ("drm/plane: Add COLOR PIPELINE property") Reviewed-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Alex Hung <alex.hung@amd.com> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Signed-off-by: Melissa Wen <mwen@igalia.com> Link: https://patch.msgid.link/20260318163629.300627-1-mwen@igalia.com Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
1 parent 6597ff1 commit 6bf7969

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,6 +3751,13 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
37513751
err = PTR_ERR(plane_state);
37523752
goto free;
37533753
}
3754+
3755+
if (plane_state->color_pipeline) {
3756+
err = drm_atomic_add_affected_colorops(state, plane);
3757+
if (err)
3758+
goto free;
3759+
}
3760+
37543761
}
37553762

37563763
drm_connector_list_iter_begin(dev, &conn_iter);
@@ -3856,13 +3863,18 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
38563863
int i, ret;
38573864
struct drm_plane *plane;
38583865
struct drm_plane_state *new_plane_state;
3866+
struct drm_colorop *colorop;
3867+
struct drm_colorop_state *new_colorop_state;
38593868
struct drm_connector *connector;
38603869
struct drm_connector_state *new_conn_state;
38613870
struct drm_crtc *crtc;
38623871
struct drm_crtc_state *new_crtc_state;
38633872

38643873
state->acquire_ctx = ctx;
38653874

3875+
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i)
3876+
state->colorops[i].old_state = colorop->state;
3877+
38663878
for_each_new_plane_in_state(state, plane, new_plane_state, i)
38673879
state->planes[i].old_state = plane->state;
38683880

include/drm/drm_atomic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,8 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
10891089
for_each_if ((__state)->colorops[__i].ptr && \
10901090
((colorop) = (__state)->colorops[__i].ptr, \
10911091
(void)(colorop) /* Only to avoid unused-but-set-variable warning */, \
1092-
(new_colorop_state) = (__state)->colorops[__i].new_state, 1))
1092+
(new_colorop_state) = (__state)->colorops[__i].new_state,\
1093+
(void)(new_colorop_state) /* Only to avoid unused-but-set-variable warning */, 1))
10931094

10941095
/**
10951096
* for_each_oldnew_plane_in_state - iterate over all planes in an atomic update

0 commit comments

Comments
 (0)