[RFC PATCH v2 10/20] drm/colorop: distinguish whether a colorop belongs to a plane or a CRTC

Melissa Wen <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
To correctly track states and color management changes.

Signed-off-by: Melissa Wen <[email protected]>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 0ee44976031e..5cb860cb7da4 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1374,7 +1374,6 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
 		break;
 	}
 	case DRM_MODE_OBJECT_COLOROP: {
-		struct drm_plane_state *plane_state;
 		struct drm_colorop *colorop = obj_to_colorop(obj);
 		struct drm_colorop_state *colorop_state;
 		bool replaced = false;
@@ -1391,12 +1390,26 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
 		if (ret || !replaced)
 			break;
 
-		plane_state = drm_atomic_get_plane_state(state, colorop->plane);
-		if (IS_ERR(plane_state)) {
-			ret = PTR_ERR(plane_state);
-			break;
+		if (colorop->plane) {
+			struct drm_plane_state *plane_state;
+
+			plane_state = drm_atomic_get_plane_state(state, colorop->plane);
+			if (IS_ERR(plane_state)) {
+				ret = PTR_ERR(plane_state);
+				break;
+			}
+			plane_state->color_mgmt_changed |= replaced;
+		} else if (colorop->crtc) {
+			struct drm_crtc_state *crtc_state;
+
+			crtc_state = drm_atomic_get_crtc_state(state, colorop->crtc);
+			if (IS_ERR(crtc_state)) {
+				ret = PTR_ERR(crtc_state);
+				break;
+			}
+			crtc_state->color_mgmt_changed |= replaced;
+
 		}
-		plane_state->color_mgmt_changed |= replaced;
 
 		break;
 	}
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.