]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/drm_atomic: duplicate colorop states if plane color pipeline in use
authorMelissa Wen <mwen@igalia.com>
Wed, 18 Mar 2026 16:27:11 +0000 (13:27 -0300)
committerMelissa Wen <melissa.srw@gmail.com>
Thu, 16 Apr 2026 14:49:09 +0000 (11:49 -0300)
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: 2afc3184f3b3 ("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>
drivers/gpu/drm/drm_atomic_helper.c
include/drm/drm_atomic.h

index 75e87c0b51f7e45623f8d1792e80d76e38576b93..3e0d99d39e63fa479f3cb2618cb9fd8a3ac20a72 100644 (file)
@@ -3751,6 +3751,13 @@ drm_atomic_helper_duplicate_state(struct drm_device *dev,
                        err = PTR_ERR(plane_state);
                        goto free;
                }
+
+               if (plane_state->color_pipeline) {
+                       err = drm_atomic_add_affected_colorops(state, plane);
+                       if (err)
+                               goto free;
+               }
+
        }
 
        drm_connector_list_iter_begin(dev, &conn_iter);
@@ -3856,6 +3863,8 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
        int i, ret;
        struct drm_plane *plane;
        struct drm_plane_state *new_plane_state;
+       struct drm_colorop *colorop;
+       struct drm_colorop_state *new_colorop_state;
        struct drm_connector *connector;
        struct drm_connector_state *new_conn_state;
        struct drm_crtc *crtc;
@@ -3863,6 +3872,9 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
 
        state->acquire_ctx = ctx;
 
+       for_each_new_colorop_in_state(state, colorop, new_colorop_state, i)
+               state->colorops[i].old_state = colorop->state;
+
        for_each_new_plane_in_state(state, plane, new_plane_state, i)
                state->planes[i].old_state = plane->state;
 
index 178f8f62c80fc58fe42e8564a716da1a99ddb7da..b0926f1531dfcc2dc08ed219002bdd600a6ac7f4 100644 (file)
@@ -1089,7 +1089,8 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
                for_each_if ((__state)->colorops[__i].ptr &&            \
                             ((colorop) = (__state)->colorops[__i].ptr, \
                              (void)(colorop) /* Only to avoid unused-but-set-variable warning */, \
-                             (new_colorop_state) = (__state)->colorops[__i].new_state, 1))
+                             (new_colorop_state) = (__state)->colorops[__i].new_state,\
+                             (void)(new_colorop_state) /* Only to avoid unused-but-set-variable warning */, 1))
 
 /**
  * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update