[Why]
When should_reset_plane() forces a plane's dc_plane_state to be
recreated (e.g. on every ALLOW_MODESET commit on DCN < 3.2),
fill_dc_plane_attributes() re-derives the plane's color pipeline from
the DRM colorop states. The per-stage helpers look up each colorop
with for_each_new_colorop_in_state(), which only iterates colorops
attached to the current commit. If userspace didn't touch color in
that commit the colorops are absent, so the fixed matrix (YUV->RGB),
shaper, 3D LUT and regamma all silently fall back to bypass. This
corrupts the plane's colors - e.g. an HDR P010 video losing its
color-space conversion - until the pipeline happens to be re-committed.

[How]
When recreating a plane that has an active color_pipeline, call
drm_atomic_add_affected_colorops() so the plane's colorops are pulled
into the commit and the derivation sees the current pipeline instead
of defaulting every stage to bypass. This mirrors what the core
already does on a modeset via drm_atomic_add_affected_planes().

Assisted-by: Copilot:claude-opus-4.8
Signed-off-by: Harry Wentland <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 49f1a22f2888..4ee677f5b8b7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -6337,6 +6337,19 @@ static int dm_update_plane_state(struct dc *dc,
                if (ret)
                        goto out;
 
+               /*
+                * Recreating the plane re-derives its DC color pipeline from 
the
+                * colorop states in this commit. Pull the plane's colorops in 
so
+                * the derivation sees the current pipeline; otherwise every 
stage
+                * silently defaults to bypass (dropping YUV->RGB, shaper, 3D 
LUT
+                * and regamma) when userspace didn't touch color in this 
commit.
+                */
+               if (new_plane_state->color_pipeline) {
+                       ret = drm_atomic_add_affected_colorops(state, plane);
+                       if (ret)
+                               goto out;
+               }
+
                WARN_ON(dm_new_plane_state->dc_state);
 
                dc_new_plane_state = dc_create_plane_state(dc);
-- 
2.55.0

Reply via email to