From: "Màxim Pedraza Padilla" <maximpedraza@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Jonathan Corbet <corbet@lwn.net>
Cc: Francesco Valla <francesco@valla.it>,
Mario Limonciello <mario.limonciello@amd.com>,
Javier Martinez Canillas <javierm@redhat.com>,
Jocelyn Falempe <jfalempe@redhat.com>,
Sam Ravnborg <sam@ravnborg.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-efi@vger.kernel.org, linux-doc@vger.kernel.org,
linux-embedded@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RFC v4 10/13] drm/client: splash: take the background colour from the image source
Date: Thu, 1 Oct 2026 21:58:44 +0200 [thread overview]
Message-ID: <20261001195847.141192-11-maximpedraza@gmail.com> (raw)
In-Reply-To: <20261001195847.141192-1-maximpedraza@gmail.com>
A logo designed for a light background looks wrong framed in black, and
products that share a board support package differ in their colours as
much as in their logos. The background colour belongs with the image,
so take it from the same place:
- a device tree image uses the optional "background-color" of its node;
- the BGRT carries no colour, and firmware splashes sit on black, so it
uses the kernel's default;
- the BMP loaded as firmware is named on the command line, and so is its
colour, through drm_client_lib.splash_color, which also covers the
screen when there is no image at all.
CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR remains the default wherever
the source says nothing. The command line no longer overrides a device
tree image: a bootloader that wants another colour for a given boot,
say to flag a failed test on a production line, changes the node.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Màxim Pedraza Padilla <maximpedraza@gmail.com>
---
drivers/gpu/drm/clients/Kconfig | 7 ++++--
drivers/gpu/drm/clients/drm_splash.c | 36 +++++++++++++++++++++-------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/clients/Kconfig b/drivers/gpu/drm/clients/Kconfig
index aef3781cc110..f471019bab87 100644
--- a/drivers/gpu/drm/clients/Kconfig
+++ b/drivers/gpu/drm/clients/Kconfig
@@ -105,8 +105,11 @@ config DRM_CLIENT_SPLASH_BACKGROUND_COLOR
help
The default splash background color, in RGB888 format.
- The color can be overridden through the drm_client_lib.splash_color
- kernel command line parameter.
+ The background color comes from the same place as the image. A
+ device tree image can carry its own, and the drm_client_lib.splash_color
+ kernel command line parameter sets it for a BMP loaded as firmware,
+ or for the whole screen when there is no image. This color is used
+ otherwise, and always with the BGRT image, which carries none.
config DRM_CLIENT_SPLASH_SRC_DT
bool "Device tree as splash source"
diff --git a/drivers/gpu/drm/clients/drm_splash.c b/drivers/gpu/drm/clients/drm_splash.c
index 924bc0032d1d..30ba6573424e 100644
--- a/drivers/gpu/drm/clients/drm_splash.c
+++ b/drivers/gpu/drm/clients/drm_splash.c
@@ -42,7 +42,8 @@
static unsigned int splash_color = CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR;
module_param(splash_color, uint, 0400);
-MODULE_PARM_DESC(splash_color, "Splash background color (RGB888)");
+MODULE_PARM_DESC(splash_color,
+ "Background color (RGB888) around the BMP loaded as firmware, or of the whole screen with no image");
#if IS_ENABLED(CONFIG_DRM_CLIENT_SPLASH_SRC_BMP)
#define DEFAULT_SPLASH_BMP "drm_splash.bmp"
@@ -131,6 +132,8 @@ struct drm_splash {
s32 off_x, off_y;
/* One of DRM_MODE_ROTATE_*: turns the image, not the screen */
unsigned int rotation;
+ /* RGB888, from the same place as the image */
+ u32 bg_color;
};
static struct drm_splash *client_to_drm_splash(struct drm_client_dev *client)
@@ -263,12 +266,18 @@ static struct device_node *drm_splash_dt_node(struct drm_splash *splash)
return NULL;
}
-/* The optional placement properties of the node, read once */
-static void drm_splash_dt_placement(struct drm_splash *splash,
- struct device_node *np)
+/* The optional properties of the node, read once */
+static void drm_splash_dt_props(struct drm_splash *splash,
+ struct device_node *np)
{
u32 val[2];
+ /* The colour travels with the image, or it is the kernel's default */
+ if (!of_property_read_u32(np, "background-color", &val[0]))
+ splash->bg_color = val[0] & 0xffffff;
+ else
+ splash->bg_color = CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR;
+
if (!of_property_read_u32_array(np, "logo-position", val, 2)) {
splash->pos_x = (s32)val[0];
splash->pos_y = (s32)val[1];
@@ -357,8 +366,8 @@ static inline struct device_node *drm_splash_dt_node(struct drm_splash *splash)
return NULL;
}
-static inline void drm_splash_dt_placement(struct drm_splash *splash,
- struct device_node *np)
+static inline void drm_splash_dt_props(struct drm_splash *splash,
+ struct device_node *np)
{
}
@@ -801,13 +810,22 @@ static enum drm_splash_source drm_splash_pick_source(struct drm_splash *splash)
np = drm_splash_dt_node(splash);
if (np) {
- drm_splash_dt_placement(splash, np);
+ drm_splash_dt_props(splash, np);
of_node_put(np);
return DRM_SPLASH_SRC_DT;
}
- if (drm_splash_bgrt_available(splash))
+ /* The BGRT carries no colour: firmware splashes sit on black */
+ if (drm_splash_bgrt_available(splash)) {
+ splash->bg_color = CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR;
return DRM_SPLASH_SRC_BGRT;
+ }
+
+ /*
+ * The BMP loaded as firmware is named on the command line, and so is
+ * its colour, which also covers the screen when there is no image.
+ */
+ splash->bg_color = splash_color & 0xffffff;
if (IS_ENABLED(CONFIG_DRM_CLIENT_SPLASH_SRC_BMP))
return DRM_SPLASH_SRC_BMP;
@@ -865,7 +883,7 @@ static int drm_splash_render_thread(void *data)
if (!scanout->bg_drawn) {
drm_dbg(client->dev, "draw background for scanout %d", i);
- u32 color = drm_draw_color_from_xrgb8888(splash_color,
+ u32 color = drm_draw_color_from_xrgb8888(splash->bg_color,
scanout->format);
drm_splash_fill_solid_color(scanout->buffer, color);
scanout->bg_drawn = true;
--
2.39.5
next prev parent reply other threads:[~2026-10-01 19:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 19:58 [PATCH RFC v4 00/13] Add splash DRM client Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 01/13] drm/clients: Kconfig: indent DRM_CLIENT_DEFAULT with tabs Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 02/13] efi: bgrt: export the BGRT table and image size Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 03/13] drm: client: add splash client Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 04/13] MAINTAINERS: add entry for DRM " Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 05/13] drm: docs: remove bootsplash from TODO Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 06/13] dt-bindings: display: add a boot logo node under /chosen Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 07/13] drm/client: splash: add a device tree image source Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 08/13] drm/client: splash: place the device tree image where it asks Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 09/13] drm/client: splash: turn the device tree image as " Màxim Pedraza Padilla
2026-10-01 19:58 ` Màxim Pedraza Padilla [this message]
2026-10-01 19:58 ` [PATCH RFC v4 11/13] drm/client: splash: turn the BGRT image on panels mounted turned Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 12/13] drm/client: splash: prefer what the command line asks for Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 13/13] drm/client: splash: document the image sources and parameters Màxim Pedraza Padilla
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=20261001195847.141192-11-maximpedraza@gmail.com \
--to=maximpedraza@gmail.com \
--cc=airlied@gmail.com \
--cc=ardb@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=francesco@valla.it \
--cc=ilias.apalodimas@linaro.org \
--cc=javierm@redhat.com \
--cc=jfalempe@redhat.com \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mario.limonciello@amd.com \
--cc=mripard@kernel.org \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=sam@ravnborg.org \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--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
all inboxes | Powered by JetHome®