From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793109255; b=t/xvvALsV5psoRnlZ4c41D4CeyLrQPOCJtKhuLfakCf3gaVXHRTQAAzwfbGwh50mHgWI C1gJUVhP5GVCIF/3N9uyATMMc22rOG7y6eXkT4JcvWLvcqmK1Y2nuBfQw1gz8lcK5g0Jb AYRfXU0FOndKMXSOpUK158WVwm7Sxy+hue9Pm0CNpkImuDtBjo9cx19NKBD01VxvpvZSA SSWLHCR8EOSRc6w14acbXV2J+S8WoMleyiPSRlT3ufq/y46wMytpyNo2zFnyfyhO2LlfE gHTR4R5rTTyJCxJbJEtEMTSBvOzBwSKe9vYqj+trBg9WnsN69G3sF7HPecXG1ic6jJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793109255; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=IMpToc8GUbpePaS/6DB+RjKW/EgdDLHWVJxbsQxIDG0=; b=cDPqLyiwjbJRSZioMvYZDcU9yK/Q2m1JICSlkos0Y0sr6DKh8lMFP+j6AZAM2J8bbdcs WDK9xIBVdF+dZEyVD59n0Ubj2Oxxror+6JR5cJkeD+QfA4Zx1F5TpuQuTUtwYDToz74rb gJnrJwcqxWXhfFxRfk2httc/c2o0F8Jv2xQ1503YAZqg23XfzKWWM9uerOVeXcO+gWVqK Con7xdzOIRBv1vhmygjSfJ/7oc94lgOvnpGiCnIVDfRjFbKPX1TJzWZo1e3Hd1PIlkBMj Lz4Ruit/KVPMyM6OSe5+WJzhf1tVq4FQ8+EQyXhb+FNcfFRRaL5wowpZ99cbNq6zICA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="g/a7IWIa"; arc=none smtp.remote-ip=209.85.128.41 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E70F960A6F6F for ; Tue, 27 Oct 2026 13:54:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E70F960A6F6F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=g/a7IWIa Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a5087a5348so23830315e9.0 for ; Tue, 27 Oct 2026 06:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793109253; x=1793714053; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=IMpToc8GUbpePaS/6DB+RjKW/EgdDLHWVJxbsQxIDG0=; b=g/a7IWIaUlEuSLjlKCX3yHtkNeiiQRYTYC7D+Ng/EVl+KLbalqyl0FWv3PYFslZoTG gxcPx5MgXBZ0dLO3ijTzxRBFJbYKZ5tH6xPFppXm3HxeBSKp2IWn5SCmfsITujGEwRys 7ED1ebhpbyji3P3TwrMKmTM34oZpTtQjaGxz9P0AIoeD84Ey6f8Pjx5EVIw1CxqPmpZU ATheQqGg/LdVvlAeGd6R+gR7jC7ZPsU1P/1xYvgk2s3AGyFeHCoMUCPzJXdIzWu5UisU PnblmJybqTSP3uR2ERfR6e5AGqsA/G0Yv3fFwtdu2dzENDoOW2+sSD7rCsvx7bR8k+Ii GkCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793109253; x=1793714053; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IMpToc8GUbpePaS/6DB+RjKW/EgdDLHWVJxbsQxIDG0=; b=k13jfK+IidkzCdrBlfk14gYhMMnWkmNltDh2alpsLKto+jF7PdaNOwnsnBnqZj1Dgb Jkag8mqXf3vy8q7o4mkqd+Ya1tVc5nNDHoPtVEJNyx8bOwzefvT5KZbIGXV97cSDMoeZ Z24IEbUzB85zaD//NGACgqGKI29zGJUhwd+1re+0XPO0+bJdYNsfyzeoHAd+R18N9VO+ kJut5ZsVi+tIGDm4c5AWGwB3XcnJuW0NuaQsAvAI/i0rhZnqshzKyApY0O1BM0xujOIT zakXtG0ZZ757+EozhzPq27Zq2I7pAAzJmIYfPELwDzzpmhU14vRbZzWSH7JRw5tBET81 pYJg== X-Forwarded-Encrypted: i=1; AKwUvBxhGhb5ZMUfv6vqigmaJXz6WhAcgRZJt2I5WqMpQKeX6/YGM82Tu7u/zOfMotzv4RexbiJokSzB5PB+UbdhCA==@vger.kernel.org X-Gm-Message-State: AFq9FYJm9vfG0oY/10htYDxdoi9wjnTad8jceBE/DF34t+JXV6D4TAD/ oleW713hDr/tJUBYzyUi7isuJpfWjwNG9mkw8/qRTGviqo5/BaW9Hx+8 X-Gm-Gg: AYBFou3Cu75u9Fbk2vZJIzfwYJRH9fRuUdn0GoFUcYV1BUOfAzgL5ltO4GmFRfsyxnv mKUEZ9fPGieeNpVqQYu5m0T0oh+8uhEE4ywxzvwYP5mtcGXgD9w45yv4ew/hv2fZ6dOwk3tYRAk kIXj+zZO68aB1Q+Q1VN3mwtzh3lOdiSl8eoac0goF2KPPjB+vOap86xWcc49w+B6RbaLmkfozGc MzdkALjJVd/x6q4axdICOogv8D/jeUc2/u6k+RPfDAr5o+g8hX1zzhYBFsliFBlk6OzyTrqaatA 66VcLTsNlZdJKv0C4GvoidhU/6PABfi/t8rCF1E9EpPB9rlFA1KK9CTYprks0ymvfAFoi8NDU5C qbyzGUYhgUsypITaoeCF5nzYx/yOM9STRMNt4bB0niYtIAirRwKJIx40NbyAL+4DJqzeOrOVeqR Oc7UPT3FtpHKiuZEOYyMaHgYuUVV27K99CxUiYIsqYy8lE8e2F7EqgFbqEtmZe4JFD45ucI8bRG fVAb8N78M3w0Th6urkSM+ts8vq35uCPMWW550WRqiOZqjPnZVYn60sWUx9JAN3Q7McF5NlKk2qj NKVC+sE= X-Received: by 2002:a05:600c:6219:b0:4a1:de8a:603a with SMTP id 5b1f17b1804b1-4a35ac80a9emr181345205e9.6.1793109253262; Tue, 27 Oct 2026 06:54:13 -0700 (PDT) Received: from ingenieria31.oficinasStQ.local ([79.117.46.175]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebcb846sm23128058f8f.25.2026.10.27.06.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 06:54:12 -0700 (PDT) From: =?UTF-8?q?M=C3=A0xim=20Pedraza=20Padilla?= To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ard Biesheuvel , Jonathan Corbet , Helge Deller , Peter Jones Cc: Francesco Valla , Jani Nikula , Mario Limonciello , Javier Martinez Canillas , Jocelyn Falempe , Sam Ravnborg , Ilias Apalodimas , Shuah Khan , Randy Dunlap , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-embedded@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 12/15] drm/client: splash: take the background colour from the image source Date: Tue, 27 Oct 2026 14:53:39 +0100 Message-Id: <20261027135342.2003632-13-maximpedraza@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261027135342.2003632-1-maximpedraza@gmail.com> References: <20261027135342.2003632-1-maximpedraza@gmail.com> X-Mailing-List: linux-embedded@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 a device tree image takes it from the optional "background-color" of its node. A value that is not one cell of RGB888 is reported and left out. CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR remains the colour wherever the source says nothing, as with the BGRT, which carries no colour, and the BMP loaded as firmware. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Màxim Pedraza Padilla --- drivers/gpu/drm/clients/Kconfig | 3 ++- drivers/gpu/drm/clients/drm_splash.c | 33 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/clients/Kconfig b/drivers/gpu/drm/clients/Kconfig index 172781bbc2d7..bb5fe5019756 100644 --- a/drivers/gpu/drm/clients/Kconfig +++ b/drivers/gpu/drm/clients/Kconfig @@ -104,7 +104,8 @@ config DRM_CLIENT_SPLASH_BACKGROUND_COLOR default 0x000000 range 0x000000 0xffffff help - The splash background color, in RGB888 format. + The splash background color, in RGB888 format, unless the image + source has its own: a device tree image can carry its color. 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 a50036155763..3f54bec87413 100644 --- a/drivers/gpu/drm/clients/drm_splash.c +++ b/drivers/gpu/drm/clients/drm_splash.c @@ -117,6 +117,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 image source or the kernel's default */ + u32 bg_color; }; static struct drm_splash *client_to_drm_splash(struct drm_client_dev *client) @@ -272,12 +274,23 @@ static void drm_splash_dt_pair(struct drm_splash *splash, *y = val[1]; } -/* 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; + /* The colour travels with the image; a bad one is reported */ + if (of_property_present(np, "background-color")) { + if (of_property_count_u32_elems(np, "background-color") != 1 || + of_property_read_u32(np, "background-color", &val) || + val > 0xffffff) + drm_warn(splash->client.dev, "splash: %pOF: invalid %s\n", + np, "background-color"); + else + splash->bg_color = val; + } + drm_splash_dt_pair(splash, np, "logo-position", -1, 65535, &splash->pos_x, &splash->pos_y); drm_splash_dt_pair(splash, np, "logo-offset", -65535, 65535, @@ -375,8 +388,8 @@ static bool drm_splash_dt_open(struct drm_splash *splash) return false; } -static void drm_splash_dt_placement(struct drm_splash *splash, - struct device_node *np) +static void drm_splash_dt_props(struct drm_splash *splash, + struct device_node *np) { } @@ -802,13 +815,17 @@ static int drm_splash_image_load(struct drm_splash *splash, const u8 **img_data, */ static enum drm_splash_source drm_splash_pick_source(struct drm_splash *splash) { + /* Unless the source says otherwise, the kernel's default colour */ + splash->bg_color = CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR; + if (drm_splash_dt_open(splash)) { - drm_splash_dt_placement(splash, splash->dt_np); + drm_splash_dt_props(splash, splash->dt_np); return DRM_SPLASH_SRC_DT; } if (drm_splash_bgrt_available(splash)) return DRM_SPLASH_SRC_BGRT; + if (IS_ENABLED(CONFIG_DRM_CLIENT_SPLASH_SRC_BMP)) return DRM_SPLASH_SRC_BMP; @@ -875,8 +892,8 @@ static void drm_splash_work(struct work_struct *work) continue; if (!scanout->bg_drawn) { - u32 rgb = CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR; - u32 color = drm_draw_color_from_xrgb8888(rgb, scanout->format); + u32 color = drm_draw_color_from_xrgb8888(splash->bg_color, + scanout->format); /* Only success marks it done: a later pass retries */ ret = drm_splash_fill_solid_color(scanout->buffer, color); -- 2.39.5