From: Advait Dhamorikar <advaitd@mechasystems.com>
To: marex@denx.de
Cc: stefan@agner.ch, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch, Frank.Li@nxp.com, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com,
dri-devel@lists.freedesktop.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Advait Dhamorikar <advaitd@mechasystems.com>
Subject: [PATCH] drm: mxsfb: lcdif: enforce 64-byte pitch alignment for scanout
Date: Mon, 13 Apr 2026 17:14:56 +0530 [thread overview]
Message-ID: <20260413114456.173485-1-advaitd@mechasystems.com> (raw)
The LCDIF controller expects framebuffer pitch to be aligned to a
64 byte boundary for reliable scanout. While byte-granular pitches are
supported by the interface, the i.MX8MP reference manual
recommends 64-byte alignment for optimal operation.
Corrupted output was observed with XR24 framebuffers where a pitch of
4320 bytes caused visible corruption and choppy display, while an aligned
pitch of 4352 bytes worked correctly.
Ensure that only framebuffers with properly aligned pitch are accepted
by rejecting invalid configurations in lcdif_plane_atomic_check().
This allows userspace to fall back to a compatible allocation.
Signed-off-by: Advait Dhamorikar <advaitd@mechasystems.com>
---
drivers/gpu/drm/mxsfb/lcdif_kms.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c
index 72eb0de46b54..8e574e9a591a 100644
--- a/drivers/gpu/drm/mxsfb/lcdif_kms.c
+++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c
@@ -674,6 +674,18 @@ static int lcdif_plane_atomic_check(struct drm_plane *plane,
crtc_state = drm_atomic_get_new_crtc_state(state,
&lcdif->crtc);
+ /*
+ * While byte granularity is supported, LCDIF requires
+ * that framebuffer pitch be aligned to 64 bytes.
+ */
+ if (plane_state->fb &&
+ !IS_ALIGNED(plane_state->fb->pitches[0], 64)) {
+ DRM_DEV_DEBUG_DRIVER(plane->dev->dev,
+ "Framebuffer pitch (%u bytes) must be aligned to 64 bytes\n",
+ plane_state->fb->pitches[0]);
+ return -EINVAL;
+ }
+
return drm_atomic_helper_check_plane_state(plane_state, crtc_state,
DRM_PLANE_NO_SCALING,
DRM_PLANE_NO_SCALING,
--
2.43.0
next reply other threads:[~2026-04-13 11:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 11:44 Advait Dhamorikar [this message]
2026-04-13 13:46 ` [PATCH] drm: mxsfb: lcdif: enforce 64-byte pitch alignment for scanout Philipp Zabel
2026-04-14 6:35 ` Advait Dhamorikar
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=20260413114456.173485-1-advaitd@mechasystems.com \
--to=advaitd@mechasystems.com \
--cc=Frank.Li@nxp.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marex@denx.de \
--cc=mripard@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=simona@ffwll.ch \
--cc=stefan@agner.ch \
--cc=tzimmermann@suse.de \
/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