drm_atomic_add_affected_planes() walks the plane mask of the old CRTC
state, so a plane that is being enabled is not in that mask and its
colorops are left out of the commit. Its first frame then sees the
pipeline as bypassed, and a YUV plane is composed without the YUV-to-RGB
conversion.

Add them explicitly in vkms_crtc_atomic_check().

Fixes: 589179b18224 ("drm/vkms: Add atomic check and matrix handling for fixed 
matrix colorop")

Signed-off-by: Oarora Etimis <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 019d7bc90cdc..7d18178d5320 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -129,6 +129,22 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
        if (ret < 0)
                return ret;
 
+       /*
+        * drm_atomic_add_affected_planes() only walks the plane mask of the
+        * old CRTC state. A plane that is being enabled is not in that mask,
+        * so its colorops would be missing from this commit.
+        */
+       drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) {
+               plane_state = drm_atomic_get_new_plane_state(crtc_state->state, 
plane);
+
+               if (!plane_state || !plane_state->color_pipeline)
+                       continue;
+
+               ret = drm_atomic_add_affected_colorops(crtc_state->state, 
plane);
+               if (ret < 0)
+                       return ret;
+       }
+
        drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) {
                plane_state = drm_atomic_get_new_plane_state(crtc_state->state, 
plane);
                WARN_ON(!plane_state);

-- 
2.56.1

Reply via email to