All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/meson: skip invisible planes in atomic_update
@ 2026-12-05  2:17 ` Shirong Zhao
  0 siblings, 0 replies; 6+ messages in thread
From: Shirong Zhao @ 2026-12-05  2:17 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Kevin Hilman, Jerome Brunet, Martin Blumenstingl, dri-devel,
	linux-amlogic, stable, Shirong Zhao

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@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-05  2:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  2:17 [PATCH] drm/meson: skip invisible planes in atomic_update Shirong Zhao
2026-12-05  2:17 ` Shirong Zhao
2026-12-05  2:34 ` sashiko-bot
2026-12-05  2:34   ` sashiko-bot
2026-12-05  2:41 ` [PATCH v2] drm/meson: disable OSD1 for " Shirong Zhao
2026-12-05  2:41   ` Shirong Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.