From: Jonathan Frazin <frazinjonathan@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
Maxime Ripard <mripard@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>,
Alex Lanzano <lanzano.alex@gmail.com>,
linux-kernel@vger.kernel.org,
Jonathan Frazin <frazinjonathan@gmail.com>,
Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH v1 2/2] drm/tiny: allow a framebuffer larger than the panel on MIPI DBI drivers
Date: Thu, 10 Sep 2026 13:48:57 -0500 [thread overview]
Message-ID: <20260910185030.870-3-frazinjonathan@gmail.com> (raw)
In-Reply-To: <20260910185030.870-1-frazinjonathan@gmail.com>
Every drm/tiny MIPI DBI driver pins mode_config.max_width/max_height to
the panel size, so KMS rejects any framebuffer that is not exactly
panel-sized:
ili9341 spi0.0: bad framebuffer width 480, should be >= 240 && <= 240
Raise the maximums to DRM_SHADOW_PLANE_MAX_WIDTH/HEIGHT (which its
kerneldoc recommends for shadow-plane drivers) on the drivers that flush
through the shared drm_mipi_dbi_plane_helper_atomic_update(), so a client
can allocate a larger framebuffer and pick the displayed region through
the plane source rectangle - a crop / pan with no scaling, now that
drm_mipi_dbi honours the source offset (previous patch):
ili9341, hx8357d, ili9486, mi0283qt, ili9163, panel-mipi-dbi
The fixed mode, the minimums and the connector are unchanged. The plane
check (drm_mipi_dbi_plane_helper_atomic_check) still forbids scaling and
repositioning, and the transfer buffer is sized from the display mode,
so the flushed rectangle stays bounded by the panel regardless of the
framebuffer dimensions.
ili9225 is left out: it has its own atomic_update / ili9225_fb_dirty()
that addresses the panel from the damage rectangle without the source
offset, so raising its limits would let a mispositioned buffer through.
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Jonathan Frazin <frazinjonathan@gmail.com>
---
drivers/gpu/drm/tiny/hx8357d.c | 8 ++++++--
drivers/gpu/drm/tiny/ili9163.c | 8 ++++++--
drivers/gpu/drm/tiny/ili9341.c | 8 ++++++--
drivers/gpu/drm/tiny/ili9486.c | 8 ++++++--
drivers/gpu/drm/tiny/mi0283qt.c | 8 ++++++--
drivers/gpu/drm/tiny/panel-mipi-dbi.c | 8 ++++++--
6 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index f942a8d09..0599b8ccf 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -320,9 +320,13 @@ static int hx8357d_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &hx8357d_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &hx8357d_mode_config_helper_funcs;
diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c
index 884242450..fe6c13056 100644
--- a/drivers/gpu/drm/tiny/ili9163.c
+++ b/drivers/gpu/drm/tiny/ili9163.c
@@ -251,9 +251,13 @@ static int ili9163_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &ili9163_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &ili9163_mode_config_helper_funcs;
diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index 003381aa2..1e4bb56e3 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -282,9 +282,13 @@ static int ili9341_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &ili9341_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &ili9341_mode_config_helper_funcs;
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index fab8bd7ce..de33d702a 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -309,9 +309,13 @@ static int ili9486_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &ili9486_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &ili9486_mode_config_helper_funcs;
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index b0121e89e..df3801914 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -290,9 +290,13 @@ static int mi0283qt_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &mi0283qt_mode_config_funcs;
drm->mode_config.preferred_depth = 16;
drm->mode_config.helper_private = &mi0283qt_mode_config_helper_funcs;
diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index 60cd65cae..a0a098b0d 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -448,9 +448,13 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
return ret;
drm->mode_config.min_width = dbidev->mode.hdisplay;
- drm->mode_config.max_width = dbidev->mode.hdisplay;
+ /*
+ * Allow a framebuffer larger than the panel so a sub-region can be
+ * displayed via the plane source rectangle (crop / pan, no scaling).
+ */
+ drm->mode_config.max_width = DRM_SHADOW_PLANE_MAX_WIDTH;
drm->mode_config.min_height = dbidev->mode.vdisplay;
- drm->mode_config.max_height = dbidev->mode.vdisplay;
+ drm->mode_config.max_height = DRM_SHADOW_PLANE_MAX_HEIGHT;
drm->mode_config.funcs = &panel_mipi_dbi_mode_config_funcs;
drm->mode_config.preferred_depth = bpp;
drm->mode_config.helper_private = &panel_mipi_dbi_mode_config_helper_funcs;
--
2.53.0
next prev parent reply other threads:[~2026-09-11 7:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 18:48 [PATCH v1 0/2] drm/mipi-dbi: display a cropped region of an oversized framebuffer Jonathan Frazin
2026-09-10 18:48 ` [PATCH v1 1/2] drm/mipi-dbi: honour the plane source offset when flushing Jonathan Frazin
2026-09-10 19:07 ` sashiko-bot
2026-09-10 18:48 ` Jonathan Frazin [this message]
2026-09-10 19:05 ` [PATCH v1 2/2] drm/tiny: allow a framebuffer larger than the panel on MIPI DBI drivers sashiko-bot
2026-09-11 0:19 ` Jonathan Frazin
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=20260910185030.870-3-frazinjonathan@gmail.com \
--to=frazinjonathan@gmail.com \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kamlesh.gurudasani@gmail.com \
--cc=lanzano.alex@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.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