Add splash DRM client
Subsystems (4)
v3 cover Add splash DRM client
Hello,
this is the third (and hopefully last) RFC version for the DRM-based splash screen.
Motivation behind the work can be found in v1 [0]; in a nutshell, the splash DRM client can draw a splashscreen using:
- the BMP image supplied by the EFI BGRT;
- a BMP image loaded as firmware (either built-in or loaded from the
filesystem);
- a colored background.
This revision greatly simplifies the image seletion logic; now the EFI BGRT is always used as first source if enabled, with a fallback to BMP image loaded as firmware and then to a plain color.
Sanity checks on the EFI BGRT image have been borrowed from the efifb driver. More complete splash providers (e.g.: Plymouth) have an extensive management of platform-specific quirks, but I don't think it would be reasonable to introduce such complexity here.
Additional notes:
- Rotation is still not managed (and probably won't?).
- Support for tiled screens is untested.
- Plain color and BMP sources were tested on QEMU, Beagleplay and
i.MX93 FRDM.
- EFI BGRT support was tested using QEMU+OVMF.
Thank you in advance for any feedback.
Best regards,
Francesco
[0] https://lore.kernel.org/all/[email protected]
---
Changes in v3:
- Simplified the image selection and management logic, with direct
fallback from EFI BGRT to MP as firmware
- Used new drm_draw_can_convert_from_xrgb8888() API
- Added proper get_unaligned_ calls for EFI BGRT access
- Fixed Kconfig dependencies
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Moved from raw dump to BMP format for static image source
- Removed support for configurable message
- Removed support for progress bar
- Added EFI BGRT as image source
Link to v1: https://lore.kernel.org/r/[email protected]
To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
To: Francesco Valla <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Francesco Valla (3):
drm: client: add splash client
MAINTAINERS: add entry for DRM splash client
drm: docs: remove bootsplash from TODO
Documentation/gpu/todo.rst | 17 - MAINTAINERS | 7 + drivers/gpu/drm/clients/Kconfig | 63 +- drivers/gpu/drm/clients/Makefile | 1 + drivers/gpu/drm/clients/drm_client_internal.h | 9 + drivers/gpu/drm/clients/drm_client_setup.c | 8 + drivers/gpu/drm/clients/drm_splash.c | 932 ++++++++++++++++++++++++++ 7 files changed, 1019 insertions(+), 18 deletions(-)
---
base-commit: afaa0a477099cb7256e26fe11289c753a225ac97
change-id: 20251026-drm_client_splash-e10d7d663e7f
Best regards,
Signature · 1 line
Francesco Valla <[email protected]>
RFC PATCH v3 1/3 drm: client: add splash client
Add a DRM client that draws a simple splash, with possibility to show:
- the logo provided by EFI BGRT;
- a static BMP image (loaded as firmware);
- a colored background.
The client is not meant to replace a full-featured bootsplash, but rather to remove some complexity (and hopefully boot time) on small embedded platforms or on systems with a limited scope (e.g: recovery or manufacturing images).
The background color can be set either at build time from a dedicated config option or at runtime through the drm_client_lib.splash_color command line parameter. Any color in RGB888 format can be used.
If enabled, the static BMP image is loaded using the kernel firmware infrastructure; a valid BMP image with 24bpp color and no compression is expected. The name of the image can be set through the drm_client_lib.splash_bmp kernel command line parameter, with the default being 'drm_splash.bmp'.
Just like the existing DRM clients, the splash can be enabled from the kernel command line using drm_client_lib.active=splash.
--- drivers/gpu/drm/clients/Kconfig | 63 +- drivers/gpu/drm/clients/Makefile | 1 + drivers/gpu/drm/clients/drm_client_internal.h | 9 + drivers/gpu/drm/clients/drm_client_setup.c | 8 + drivers/gpu/drm/clients/drm_splash.c | 932 ++++++++++++++++++++++++++ 5 files changed, 1012 insertions(+), 1 deletion(-)
drivers/gpu/drm/clients/Kconfig +62 -1
@@ -12,6 +12,7 @@ config DRM_CLIENT_LIB config DRM_CLIENT_SELECTION tristate depends on DRM + select DRM_CLIENT_LIB if DRM_CLIENT_SPLASH select DRM_CLIENT_LIB if DRM_CLIENT_LOG select DRM_CLIENT_LIB if DRM_FBDEV_EMULATION help
@@ -85,10 +86,63 @@ config DRM_CLIENT_LOG If you only need logs, but no terminal, or if you prefer userspace terminal, say "Y". +config DRM_CLIENT_SPLASH + bool "Display graphic splash" + depends on DRM_CLIENT_SELECTION + select DRM_CLIENT + select DRM_CLIENT_SETUP + select DRM_DRAW + help + This enables a splash drm client, able to display either a plain + color or a static image until the userspace is ready to take over. + The splash will be displayed on all screens available at boot, if + any, or on the ones part of the first hotplug event. + +config DRM_CLIENT_SPLASH_BACKGROUND_COLOR + hex "Splash background color" + depends on DRM_CLIENT_SPLASH + default 0x000000 + 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. + +config DRM_CLIENT_SPLASH_SRC_BGRT + bool "EFI BGRT as splash source" + depends on DRM_CLIENT_SPLASH + depends on ACPI_BGRT + select DRM_CLIENT_SPLASH_BMP_SUPPORT + help + Use the BGRT image provided by the EFI bootloader. If the image is + smaller than the display(s), it will be centered and the color + specified through the DRM_CLIENT_SPLASH_BACKGROUND_COLOR config + option will be used as background. + +config DRM_CLIENT_SPLASH_SRC_BMP + bool "BMP image as splash source" + depends on DRM_CLIENT_SPLASH + select DRM_CLIENT_SPLASH_BMP_SUPPORT + select FW_LOADER + help + Use a BMP (bitmap) image as splash. If the image is smaller than the + display(s), it will be centered and the color specified through the + DRM_CLIENT_SPLASH_BACKGROUND_COLOR config option will be used as + background. + + The image will be loaded using the firmware loading facility the + kernel provides; it shall use 24 bits per pixel and shall not be + compressed. The name of the file can be set through the + drm_client_lib.splash_bmp command line parameter, with the default + being 'drm_splash.bmp'. + +config DRM_CLIENT_SPLASH_BMP_SUPPORT + bool + choice prompt "Default DRM Client" depends on DRM_CLIENT_SELECTION - depends on DRM_FBDEV_EMULATION || DRM_CLIENT_LOG + depends on DRM_FBDEV_EMULATION || DRM_CLIENT_LOG || DRM_CLIENT_SPLASH default DRM_CLIENT_DEFAULT_FBDEV help Selects the default drm client.
@@ -111,6 +165,12 @@ config DRM_CLIENT_DEFAULT_LOG screen, but doesn't implement a full terminal. For that you will need a userspace terminal using drm/kms. +config DRM_CLIENT_DEFAULT_SPLASH + bool "splash" + depends on DRM_CLIENT_SPLASH + help + Use splash as default drm client. + endchoice config DRM_CLIENT_DEFAULT
@@ -118,6 +178,7 @@ config DRM_CLIENT_DEFAULT depends on DRM_CLIENT default "fbdev" if DRM_CLIENT_DEFAULT_FBDEV default "log" if DRM_CLIENT_DEFAULT_LOG + default "splash" if DRM_CLIENT_DEFAULT_SPLASH default "" endmenu
drivers/gpu/drm/clients/Makefile +1 -0
@@ -5,4 +5,5 @@ subdir-ccflags-y += -I$(src)/.. drm_client_lib-y := drm_client_setup.o drm_client_lib-$(CONFIG_DRM_CLIENT_LOG) += drm_log.o drm_client_lib-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_client.o +drm_client_lib-$(CONFIG_DRM_CLIENT_SPLASH) += drm_splash.o obj-$(CONFIG_DRM_CLIENT_LIB) += drm_client_lib.o
drivers/gpu/drm/clients/drm_client_internal.h +9 -0
@@ -22,4 +22,13 @@ void drm_log_register(struct drm_device *dev);static inline void drm_log_register (struct drm_device *dev) {}#endif +#ifdef CONFIG_DRM_CLIENT_SPLASH +void drm_splash_register (struct drm_device *dev, +const struct drm_format_info *format); +#else +static inline void drm_splash_register (struct drm_device *dev, +const struct drm_format_info *format) +{} +#endif +#endif
drivers/gpu/drm/clients/drm_client_setup.c +8 -0
@@ -56,6 +56,14 @@ void drm_client_setup(struct drm_device *dev, const struct drm_format_info *form return; }#endif + +#ifdef CONFIG_DRM_CLIENT_SPLASH +if (!strcmp (drm_client_default,"splash" )) { +drm_splash_register (dev, format); +return ; + } +#endif +if (strcmp (drm_client_default,"" ))drm_warn (dev,"Unknown DRM client %s\n" , drm_client_default); }
drivers/gpu/drm/clients/drm_splash.c new file +932 -0
932 lines not on this page · raw message
Signature · 1 line
2.54.0
RFC PATCH v3 2/3 MAINTAINERS: add entry for DRM splash client
In reply to Francesco VallaAdd myself as maintainer for the DRM splash client.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -8933,6 +8933,13 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git F: drivers/gpu/drm/drm_privacy_screen* F: include/drm/drm_privacy_screen* +DRM SPLASH +M: Francesco Valla <[email protected]> +L: [email protected] +S: Maintained +T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: drivers/gpu/drm/clients/drm_splash.c + DRM TTM SUBSYSTEM M: Christian Koenig <[email protected]> M: Huang Rui <[email protected]>
Signature · 1 line
2.54.0
RFC PATCH v3 3/3 drm: docs: remove bootsplash from TODO
In reply to Francesco VallaNow that a splash client exists, remove the bootsplash task from the TODO list for the DRM subsystem.
--- Documentation/gpu/todo.rst | 17 ----------------- 1 file changed, 17 deletions(-)
Documentation/gpu/todo.rst +0 -17
@@ -802,23 +802,6 @@ See drivers/gpu/drm/amd/display/TODO for tasks. Contact: Harry Wentland, Alex Deucher -Bootsplash -========== - -There is support in place now for writing internal DRM clients making it -possible to pick up the bootsplash work that was rejected because it was written -for fbdev. - -- [v6,8/8] drm/client: Hack: Add bootsplash example - https://patchwork.freedesktop.org/patch/306579/ - -- [RFC PATCH v2 00/13] Kernel based bootsplash - https://lore.kernel.org/r/[email protected] - -Contact: Sam Ravnborg - -Level: Advanced - Brightness handling on devices with multiple internal panels ============================================================
Signature · 1 line
2.54.0
Quoted 22 lines · Francesco Valla
Hello,
this is the third (and hopefully last) RFC version for the DRM-based splash screen.
Motivation behind the work can be found in v1 [0]; in a nutshell, the splash DRM client can draw a splashscreen using:
- the BMP image supplied by the EFI BGRT;
- a BMP image loaded as firmware (either built-in or loaded from thefilesystem);- a colored background.
This revision greatly simplifies the image seletion logic; now the EFI BGRT is always used as first source if enabled, with a fallback to BMP image loaded as firmware and then to a plain color.
Sanity checks on the EFI BGRT image have been borrowed from the efifb driver. More complete splash providers (e.g.: Plymouth) have an extensive management of platform-specific quirks, but I don't think it would be reasonable to introduce such complexity here.
Quoted 8 lines
Additional notes:
- Rotation is still not managed (and probably won't?).
- Support for tiled screens is untested.
- Plain color and BMP sources were tested on QEMU, Beagleplay andi.MX93 FRDM.- EFI BGRT support was tested using QEMU+OVMF.
Thank you in advance for any feedback.
Unfortunately I found that I couldn't compile with my normal Kconfig.
ERROR: modpost: "bgrt_tab" [drivers/gpu/drm/clients/drm_client_lib.ko] undefined!
ERROR: modpost: "bgrt_image_size" [drivers/gpu/drm/clients/drm_client_lib.ko] undefined! make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1 make[1]: *** [/home/supermario/src/linux/Makefile:2091: modpost] Error 2
make: *** [Makefile:248: __sub-make] Error 2
❮ grep ^CONFIG_DRM .configCONFIG_DRM=yCONFIG_DRM_KMS_HELPER=mCONFIG_DRM_DRAW=yCONFIG_DRM_CLIENT=y CONFIG_DRM_CLIENT_LIB=m CONFIG_DRM_CLIENT_SELECTION=m CONFIG_DRM_CLIENT_SETUP=y CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 CONFIG_DRM_CLIENT_SPLASH=y CONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR=0x000000 CONFIG_DRM_CLIENT_SPLASH_SRC_BGRT=y CONFIG_DRM_CLIENT_SPLASH_BMP_SUPPORT=y CONFIG_DRM_CLIENT_DEFAULT_SPLASH=y CONFIG_DRM_CLIENT_DEFAULT="splash" CONFIG_DRM_LOAD_EDID_FIRMWARE=y CONFIG_DRM_DISPLAY_HELPER=m CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV=y CONFIG_DRM_DISPLAY_DP_HELPER=y CONFIG_DRM_DISPLAY_DSC_HELPER=y CONFIG_DRM_DISPLAY_HDCP_HELPER=y CONFIG_DRM_DISPLAY_HDMI_CEC_NOTIFIER_HELPER=y CONFIG_DRM_DISPLAY_HDMI_HELPER=y CONFIG_DRM_TTM=mCONFIG_DRM_EXEC=mCONFIG_DRM_BUDDY=mCONFIG_DRM_TTM_HELPER=m CONFIG_DRM_GEM_SHMEM_HELPER=m CONFIG_DRM_SUBALLOC_HELPER=m CONFIG_DRM_SCHED=m CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS=m CONFIG_DRM_PRIVACY_SCREEN=y CONFIG_DRM_AMDGPU=m CONFIG_DRM_AMDGPU_CIK=y CONFIG_DRM_AMDGPU_USERPTR=y CONFIG_DRM_AMD_ISP=yCONFIG_DRM_AMD_ACP=yCONFIG_DRM_AMD_DC=yCONFIG_DRM_AMD_DC_FP=y CONFIG_DRM_AMD_SECURE_DISPLAY=y CONFIG_DRM_BRIDGE=y CONFIG_DRM_PANEL_BRIDGE=y CONFIG_DRM_PANEL=y CONFIG_DRM_SYSFB_HELPER=m CONFIG_DRM_SIMPLEDRM=m CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y CONFIG_DRM_ACCEL=y CONFIG_DRM_ACCEL_AMDXDNA=m CONFIG_DRM_ACCEL_HABANALABS=m CONFIG_DRM_ACCEL_IVPU=m CONFIG_DRM_ACCEL_QAIC=m
❮ grep BGRT .configCONFIG_ACPI_BGRT=y CONFIG_DRM_CLIENT_SPLASH_SRC_BGRT=y
Quoted 57 lines
Best regards,
Francesco[0] https://lore.kernel.org/all/[email protected]
Signed-off-by Francesco Valla <[email protected]>---
Changes in v3:
- Simplified the image selection and management logic, with direct
fallback from EFI BGRT to MP as firmware
- Used newdrm_draw_can_convert_from_xrgb8888()API
- Added properget_unaligned_calls for EFI BGRT access
- FixedKconfigdependencies
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Moved from raw dump to BMP format for static image source
- Removed support for configurable message
- Removed support for progress bar
- Added EFI BGRT as image source
Link to v1: https://lore.kernel.org/r/[email protected]To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
To: Francesco Valla <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]---
Francesco Valla (3):
drm: client: add splash client
MAINTAINERS: add entry for DRM splash client
drm: docs: remove bootsplash from TODODocumentation/gpu/todo.rst | 17 - MAINTAINERS | 7 + drivers/gpu/drm/clients/Kconfig | 63 +- drivers/gpu/drm/clients/Makefile | 1 + drivers/gpu/drm/clients/drm_client_internal.h | 9 + drivers/gpu/drm/clients/drm_client_setup.c | 8 + drivers/gpu/drm/clients/drm_splash.c | 932 ++++++++++++++++++++++++++ 7 files changed, 1019 insertions(+), 18 deletions(-)---
base-commit:afaa0a477099cb7256e26fe11289c753a225ac97
change-id: 20251026-drm_client_splash-e10d7d663e7fBest regards,
--
Francesco Valla <[email protected]>
Hello Mario,
Thank you for taking a stab at this.
Quoted 44 lines · Mario Limonciello
Quoted 22 lines · Francesco Valla
Hello,
this is the third (and hopefully last) RFC version for the DRM-based splash screen.
Motivation behind the work can be found in v1 [0]; in a nutshell, the splash DRM client can draw a splashscreen using:
- the BMP image supplied by the EFI BGRT;
- a BMP image loaded as firmware (either built-in or loaded from thefilesystem);- a colored background.
This revision greatly simplifies the image seletion logic; now the EFI BGRT is always used as first source if enabled, with a fallback to BMP image loaded as firmware and then to a plain color.
Sanity checks on the EFI BGRT image have been borrowed from the efifb driver. More complete splash providers (e.g.: Plymouth) have an extensive management of platform-specific quirks, but I don't think it would be reasonable to introduce such complexity here.
Quoted 8 lines
Additional notes:
- Rotation is still not managed (and probably won't?).
- Support for tiled screens is untested.
- Plain color and BMP sources were tested on QEMU, Beagleplay andi.MX93 FRDM.- EFI BGRT support was tested using QEMU+OVMF.
Thank you in advance for any feedback.
Unfortunately I found that I couldn't compile with my normal
Kconfig.ERROR: modpost: "
bgrt_tab" [drivers/gpu/drm/clients/drm_client_lib.ko] undefined!
ERROR: modpost: "bgrt_image_size" [drivers/gpu/drm/clients/drm_client_lib.ko] undefined! make[2]: *** [scripts/Makefile.modpost:147: Module.symvers] Error 1 make[1]: *** [/home/supermario/src/linux/Makefile:2091: modpost] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Quoted 6 lines
❮ grep ^CONFIG_DRM .config
CONFIG_DRM=yCONFIG_DRM_KMS_HELPER=mCONFIG_DRM_DRAW=yCONFIG_DRM_CLIENT=yCONFIG_DRM_CLIENT_LIB=m
Here lies the source of the issue, since I forgot to export the BGRT table symbols. In my test setup I had the clients built-in and didn't catch this. A simple patch (which will be included in v4) is attached.
Quoted 41 lines
CONFIG_DRM_CLIENT_SELECTION=mCONFIG_DRM_CLIENT_SETUP=yCONFIG_DRM_FBDEV_EMULATION=yCONFIG_DRM_FBDEV_OVERALLOC=100CONFIG_DRM_CLIENT_SPLASH=yCONFIG_DRM_CLIENT_SPLASH_BACKGROUND_COLOR=0x000000CONFIG_DRM_CLIENT_SPLASH_SRC_BGRT=yCONFIG_DRM_CLIENT_SPLASH_BMP_SUPPORT=yCONFIG_DRM_CLIENT_DEFAULT_SPLASH=yCONFIG_DRM_CLIENT_DEFAULT="splash"CONFIG_DRM_LOAD_EDID_FIRMWARE=yCONFIG_DRM_DISPLAY_HELPER=mCONFIG_DRM_DISPLAY_DP_AUX_CHARDEV=yCONFIG_DRM_DISPLAY_DP_HELPER=yCONFIG_DRM_DISPLAY_DSC_HELPER=yCONFIG_DRM_DISPLAY_HDCP_HELPER=yCONFIG_DRM_DISPLAY_HDMI_CEC_NOTIFIER_HELPER=yCONFIG_DRM_DISPLAY_HDMI_HELPER=yCONFIG_DRM_TTM=mCONFIG_DRM_EXEC=mCONFIG_DRM_BUDDY=mCONFIG_DRM_TTM_HELPER=mCONFIG_DRM_GEM_SHMEM_HELPER=mCONFIG_DRM_SUBALLOC_HELPER=mCONFIG_DRM_SCHED=mCONFIG_DRM_PANEL_BACKLIGHT_QUIRKS=mCONFIG_DRM_PRIVACY_SCREEN=yCONFIG_DRM_AMDGPU=mCONFIG_DRM_AMDGPU_CIK=yCONFIG_DRM_AMDGPU_USERPTR=yCONFIG_DRM_AMD_ISP=yCONFIG_DRM_AMD_ACP=yCONFIG_DRM_AMD_DC=yCONFIG_DRM_AMD_DC_FP=yCONFIG_DRM_AMD_SECURE_DISPLAY=yCONFIG_DRM_BRIDGE=yCONFIG_DRM_PANEL_BRIDGE=yCONFIG_DRM_PANEL=yCONFIG_DRM_SYSFB_HELPER=mCONFIG_DRM_SIMPLEDRM=mCONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
Quoted 9 lines
CONFIG_DRM_ACCEL=yCONFIG_DRM_ACCEL_AMDXDNA=mCONFIG_DRM_ACCEL_HABANALABS=mCONFIG_DRM_ACCEL_IVPU=mCONFIG_DRM_ACCEL_QAIC=m
❮ grep BGRT .configCONFIG_ACPI_BGRT=yCONFIG_DRM_CLIENT_SPLASH_SRC_BGRT=y
Regards,
Francesco
--- drivers/firmware/efi/efi-bgrt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/firmware/efi/efi-bgrt.c +3 -0
@@ -17,7 +17,10 @@#include <linux/efi-bgrt.h> struct acpi_table_bgrt bgrt_tab; +EXPORT_SYMBOL (bgrt_tab); +size_t bgrt_image_size; +EXPORT_SYMBOL (bgrt_image_size);struct bmp_header {u16 id;
--