Commit 138b80cb authored by Yongqiang Niu's avatar Yongqiang Niu Committed by CK Hu
Browse files

drm/mediatek: Fix can't get component for external display plane.



The original logic is ok for primary display, but will not find out
component for external display.

For example, plane->index is 6 for external display, but there are only
2 layer nr in external display, and this condition will never happen:
if (plane->index < (count + mtk_ddp_comp_layer_nr(comp)))

Fix this by using the offset of the plane to mtk_crtc->planes as index,
instead of plane->index.

Fixes: d6b53f68 ("drm/mediatek: Add helper to get component for a plane")
Signed-off-by: default avatarYongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: default avatarPi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: default avatarCK Hu <ck.hu@mediatek.com>
parent 5bbb71cd
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -215,11 +215,12 @@ struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc,
	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
	struct mtk_ddp_comp *comp;
	struct mtk_ddp_comp *comp;
	int i, count = 0;
	int i, count = 0;
	unsigned int local_index = plane - mtk_crtc->planes;


	for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
	for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) {
		comp = mtk_crtc->ddp_comp[i];
		comp = mtk_crtc->ddp_comp[i];
		if (plane->index < (count + mtk_ddp_comp_layer_nr(comp))) {
		if (local_index < (count + mtk_ddp_comp_layer_nr(comp))) {
			*local_layer = plane->index - count;
			*local_layer = local_index - count;
			return comp;
			return comp;
		}
		}
		count += mtk_ddp_comp_layer_nr(comp);
		count += mtk_ddp_comp_layer_nr(comp);