mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Shirong Zhao <shxzhaosr@163.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, stable@vger.kernel.org,
	Shirong Zhao <shxzhaosr@163.com>
Subject: [PATCH] drm/meson: skip invisible planes in atomic_update
Date: Sat,  5 Dec 2026 10:17:54 +0800	[thread overview]
Message-ID: <20261205021754.64-1-shxzhaosr@163.com> (raw)

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


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

             reply	other threads:[~2026-12-05  2:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  2:17 Shirong Zhao [this message]
2026-12-05  2:34 ` sashiko-bot
2026-12-05  2:41 ` [PATCH v2] drm/meson: disable OSD1 for " Shirong Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205021754.64-1-shxzhaosr@163.com \
    --to=shxzhaosr@163.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®