[PATCH] drm/meson: skip invisible planes in atomic_update

Shirong Zhao shxzhaosr at 163.com
Fri Dec 4 18:17:54 PST 2026


meson_plane_atomic_update() computes the scaler phase steps as

	hf_phase_step = ((src_w << 18) / dst_w) << 6;
	vf_phase_step = (src_h << 20) / dst_h;

without checking new_state->visible.  When userspace submits a zero
destination size through the atomic ioctl,
drm_atomic_helper_check_plane_state() marks the plane invisible but
drm_atomic_helper_commit_planes() still calls ->atomic_update() for a
plane that keeps its CRTC, so dst_w/dst_h can be 0 and the divisions
above raise a divide error.

Return early for an invisible plane.

Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
Signed-off-by: Shirong Zhao <shxzhaosr at 163.com>
---
 drivers/gpu/drm/meson/meson_plane.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c
index 76eb8b8..5eeee77 100644
--- a/drivers/gpu/drm/meson/meson_plane.c
+++ b/drivers/gpu/drm/meson/meson_plane.c
@@ -152,6 +152,15 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
 	int vf_bank_len;
 	u8 canvas_id_osd1;
 
+	/*
+	 * A zero destination size makes the plane invisible, but
+	 * drm_atomic_helper_commit_planes() still calls ->atomic_update() for
+	 * planes that keep their CRTC.  The scaler factor computation below
+	 * divides by dst_w/dst_h, so bail out for an invisible plane.
+	 */
+	if (!new_state->visible)
+		return;
+
 	/*
 	 * Update Coordinates
 	 * Update Formats
-- 
2.53.0




More information about the linux-amlogic mailing list