Re: [PATCH 1/3] drm/mediatek: mtk_crtc: Look up connector routes in the CRTC's own mmsys
From: CK Hu (胡俊光)
Date: Mon Nov 09 2026 - 00:47:43 EST
On Sat, 2026-10-10 at 20:42 -0400, zoan37 wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> mtk_crtc_update_output() finds the private data of the display
> controller (mmsys) that a CRTC belongs to with
>
> priv->all_drm_private[drm_crtc_index(crtc)]
>
> but all_drm_private[] has one entry per mmsys (mmsys_dev_num entries),
> not one per CRTC. mtk_crtc_create() gets the right entry from its
> priv_data_index argument, and the two only agree when every mmsys
> drives exactly one CRTC and the CRTCs are created in mmsys order.
>
> When a CRTC with connector routes sits on an mmsys that drives more
> than one CRTC, the lookup reads past the end of all_drm_private[] (or
> picks another mmsys' data), and the route component taken from that
> data's ddp_comp[] array is bogus. On an MT8189 board with connector
> routes on the external display path (CRTC 1 on the only mmsys), the
> first HDMI hotplug oopsed in the compositor's atomic commit.
>
> With the route tables currently in the tree (only MT8188 VDOSYS0, whose
> main path is always CRTC 0 and all_drm_private[0]) the two indices
> happen to match, so nothing in-tree hits this yet. It triggers as soon
> as routes are used on a path that is not the first CRTC of the first
> mmsys.
>
> Remember the mmsys private data mtk_crtc_create() used for the CRTC and
> use it in mtk_crtc_update_output().
Reviewed-by: CK Hu <ck.hu@xxxxxxxxxxxx>
>
> Fixes: 01389b324c97 ("drm/mediatek: Add connector dynamic selection capability")
> Assisted-by: LLM
> Signed-off-by: zoan37 <agentzoan@xxxxxxxxx>
> ---
>