[PATCH 02/11] drm/mediatek: Initialize colorops when creating plane

Nícolas F. R. A. Prado nfraprado at collabora.com
Tue Dec 23 11:44:43 PST 2025


During initialization of a plane, if the DDP component supplying it
defines a plane_colorops_init() hook, call it to initialize the color
pipeline on the plane.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_crtc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
index 22f255c3ddd3..f7db235d986f 100644
--- a/drivers/gpu/drm/mediatek/mtk_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
@@ -985,8 +985,10 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
 	int i, ret;
 
 	for (i = 0; i < num_planes; i++) {
+		struct drm_plane *plane = &mtk_crtc->planes[mtk_crtc->layer_nr];
+
 		ret = mtk_plane_init(drm_dev,
-				&mtk_crtc->planes[mtk_crtc->layer_nr],
+				plane,
 				BIT(pipe),
 				mtk_crtc_plane_type(mtk_crtc->layer_nr, num_planes),
 				mtk_ddp_comp_supported_rotations(comp),
@@ -997,6 +999,12 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
 		if (ret)
 			return ret;
 
+		if (comp->funcs && comp->funcs->plane_colorops_init) {
+			ret = comp->funcs->plane_colorops_init(comp->dev, plane);
+			if (ret)
+				return ret;
+		}
+
 		mtk_crtc->layer_nr++;
 	}
 	return 0;

-- 
2.51.0




More information about the Linux-mediatek mailing list