]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/mediatek: Add wait_event_timeout when disabling plane
authorJason-JH Lin <jason-jh.lin@mediatek.com>
Tue, 24 Jun 2025 11:31:41 +0000 (19:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:58:40 +0000 (08:58 +0200)
commita9c482689051ca96f4a4630fe49fd6919694caaa
tree6b7e67a4589428fec0e9cf03d373d653c910ab56
parentff51ef387fcfe7bc4903cec0b43c9b1f04960a15
drm/mediatek: Add wait_event_timeout when disabling plane

[ Upstream commit d208261e9f7c66960587b10473081dc1cecbe50b ]

Our hardware registers are set through GCE, not by the CPU.
DRM might assume the hardware is disabled immediately after calling
atomic_disable() of drm_plane, but it is only truly disabled after the
GCE IRQ is triggered.

Additionally, the cursor plane in DRM uses async_commit, so DRM will
not wait for vblank and will free the buffer immediately after calling
atomic_disable().

To prevent the framebuffer from being freed before the layer disable
settings are configured into the hardware, which can cause an IOMMU
fault error, a wait_event_timeout has been added to wait for the
ddp_cmdq_cb() callback,indicating that the GCE IRQ has been triggered.

Fixes: 2f965be7f900 ("drm/mediatek: apply CMDQ control flow")
Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20250624113223.443274-1-jason-jh.lin@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/mediatek/mtk_crtc.c
drivers/gpu/drm/mediatek/mtk_crtc.h
drivers/gpu/drm/mediatek/mtk_plane.c