From: Ana Bobillo <anabobillo3@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: "Tom Rini" <trini@konsulko.com>,
"Anatolij Gustschin" <ag.dev.uboot@gmail.com>,
"Simon Glass" <sjg@chromium.org>,
"Kever Yang" <kever.yang@rock-chips.com>,
"Quentin Schulz" <u-boot@0leil.net>,
"Andre Przywara" <andre.przywara@arm.com>,
"Thierry Reding" <treding@nvidia.com>,
"Svyatoslav Ryhel" <clamor95@gmail.com>,
"Tom Warren" <twarren@nvidia.com>,
"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
uboot-stm32@st-md-mailman.stormreply.com,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Jonas Schwöbel" <jonasschwoebel@yahoo.de>
Subject: [PATCH 04/11] video: display: Skip modes which do not fit in the source frame buffer
Date: Mon, 09 Nov 2026 17:29:19 +0000 [thread overview]
Message-ID: <54ffbe6d-668c-494f-874c-b5f34b84c593@gmail.com> (raw)
In-Reply-To: <2399d63c-ddd0-44b0-bb81-d5d9d2a8a8b4@gmail.com>
From: Ana Bobillo <anabobillo3@gmail.com>
display_read_timing() picks the first EDID timing which the display
driver accepts, but the display driver does not know how much memory
the video device feeding it has reserved for its frame buffer, so it
can pick a mode which does not fit.
Add the size and depth of the source's frame buffer to struct
display_plat, which the video device sets, as it does src_dev, before
it reads the timing. display_mode_valid() then skips the modes which do
not fit, so that a smaller one is picked. A video device which does not
set them is not affected.
Signed-off-by: Ana Bobillo <anabobillo3@gmail.com>
---
drivers/video/display-uclass.c | 10 ++++++++++
include/display.h | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c
index 85dac12a197..06888df4112 100644
--- a/drivers/video/display-uclass.c
+++ b/drivers/video/display-uclass.c
@@ -42,6 +42,16 @@ static bool display_mode_valid(void *priv, const struct display_timing *timing)
{
struct udevice *dev = priv;
struct dm_display_ops *ops = display_get_ops(dev);
+ struct display_plat *disp_uc_plat = dev_get_uclass_plat(dev);
+ u64 bits;
+
+ /* Skip modes which do not fit in the source's frame buffer */
+ if (disp_uc_plat->fb_size) {
+ bits = (u64)timing->hactive.typ * timing->vactive.typ *
+ disp_uc_plat->fb_bpp;
+ if (bits > (u64)disp_uc_plat->fb_size * 8)
+ return false;
+ }
if (ops && ops->mode_valid)
return ops->mode_valid(dev, timing);
diff --git a/include/display.h b/include/display.h
index 26b965daba9..f2ff9ffced8 100644
--- a/include/display.h
+++ b/include/display.h
@@ -18,11 +18,17 @@ struct display_timing;
* controller
* @src_dev: Source device providing the video
* @in_use: Display is being used
+ * @fb_size: Size of the source's frame buffer in bytes, or 0 if unknown. Set
+ * by the source before reading the timing, so that modes which
+ * do not fit in the frame buffer are skipped
+ * @fb_bpp: Bits per pixel of the source's frame buffer
*/
struct display_plat {
int source_id;
struct udevice *src_dev;
bool in_use;
+ uint fb_size;
+ int fb_bpp;
};
/**
next prev parent reply other threads:[~2026-11-09 17:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 17:28 [PATCH 00/11] video: Keep EDID modes and DP lane counts within what is reserved Ana Bobillo
2026-11-09 17:28 ` [PATCH 01/11] configs: stm32mp23/stm32mp25: Size the frame buffer for the LVDS panel Ana Bobillo
2026-11-12 8:46 ` Patrice CHOTARD
2026-11-09 17:29 ` [PATCH 02/11] video: Check that the mode fits in the reserved frame buffer Ana Bobillo
2026-11-09 17:29 ` [PATCH 03/11] edid: Leave the timing alone when no mode is valid Ana Bobillo
2026-11-09 18:16 ` Tom Rini
2026-11-09 19:28 ` Ana Bobillo
2026-11-09 17:29 ` Ana Bobillo [this message]
2026-11-10 8:41 ` [PATCH 04/11] video: display: Skip modes which do not fit in the source frame buffer Svyatoslav Ryhel
2026-11-09 17:29 ` [PATCH 05/11] video: rockchip: vop: Tell the display the frame buffer size Ana Bobillo
2026-11-09 18:30 ` Tom Rini
2026-11-09 19:28 ` Ana Bobillo
2026-11-09 17:29 ` [PATCH 06/11] video: sunxi: de2: " Ana Bobillo
2026-11-09 18:21 ` Tom Rini
2026-11-09 19:28 ` Ana Bobillo
2026-11-09 19:44 ` Tom Rini
2026-11-09 17:29 ` [PATCH 07/11] video: tegra124: " Ana Bobillo
2026-11-09 17:29 ` [PATCH 08/11] sunxi: display: Skip EDID modes larger than the frame buffer Ana Bobillo
2026-11-09 17:29 ` [PATCH 09/11] video: tegra: hdmi: Skip modes larger than the DC " Ana Bobillo
2026-11-10 8:46 ` Svyatoslav Ryhel
2026-11-09 17:30 ` [PATCH 10/11] video: rockchip: edp: Limit the lane count to four Ana Bobillo
2026-11-09 17:30 ` [PATCH 11/11] video: tegra124: dp: " Ana Bobillo
2026-11-10 8:51 ` Svyatoslav Ryhel
2026-11-10 18:01 ` [PATCH 00/11] video: Keep EDID modes and DP lane counts within what is reserved Tom Rini
2026-11-10 18:16 ` Ana Bobillo
2026-11-10 18:24 ` Tom Rini
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=54ffbe6d-668c-494f-874c-b5f34b84c593@gmail.com \
--to=anabobillo3@gmail.com \
--cc=ag.dev.uboot@gmail.com \
--cc=andre.przywara@arm.com \
--cc=clamor95@gmail.com \
--cc=jonasschwoebel@yahoo.de \
--cc=kever.yang@rock-chips.com \
--cc=neil.armstrong@linaro.org \
--cc=patrice.chotard@foss.st.com \
--cc=patrick.delaunay@foss.st.com \
--cc=sjg@chromium.org \
--cc=treding@nvidia.com \
--cc=trini@konsulko.com \
--cc=twarren@nvidia.com \
--cc=u-boot@0leil.net \
--cc=u-boot@lists.u-boot-project.org \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
/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 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.