Skip to content

platsch - Splash Screen Application

License

Notifications You must be signed in to change notification settings

pengutronix/platsch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

platsch - Splash Screen Application

platsch is a simple splash screen application meant to be run as PID 1 (init=/usr/sbin/platsch). The main logic is implemented in libplatsch which can be used by others to implement more advanced splash screen applications like an animated splash screen.

The image to be displayed for each DRM connector is expected here:

/usr/share/platsch/splash-<width>x<height>-<format>.bin

By default platsch uses the first mode on each DRM connector. <format> defaults to RGB565. See below how to change that behavior.

Splash screen images must have the specified resolution and format. See below how to generate them.

After displaying the splash screen(s), platsch forks, sending its child to sleep to keep the DRM device open and the splash image(s) on the display(s). Finally platsch gives PID 1 to /sbin/init. Later another application can simply take over.

Seamless transitions are possible (e.g. to Weston having the same image configured as background). Depending on the SoC used, the same format might be required to achieve that.

Splash Image Generation

ImageMagick can be used to prepare the required splash images. Since it outputs "bottom-up" BMPs, flip them to compensate for that. Alpha channel is enabled/disabled depending on whether RGB or XRGB format is desired. Finally only the actual pixel data is extracted. Since a color profile might follow the pixel data, strip that.

RGB565

This generates a 1920x1080 splash image in RGB565 format from a png file:

#!/bin/bash
magick \
  /path/to/source.png \
  -resize 1920x1080\! \
  -flip \
  -alpha off \
  -strip \
  -define bmp:subtype=RGB565 \
  bmp:- | tail -c $((1920*1080*(5+6+5)/8)) > \
  splash-1920x1080-RGB565.bin

XRGB8888

This generates a 1920x1080 splash image in XRGB8888 format from a png file:

#!/bin/bash
magick \
  /path/to/source.png \
  -resize 1920x1080\! \
  -flip \
  -alpha on \
  -strip \
  bmp:- | tail -c $((1920*1080*(8+8+8+8)/8)) > \
  splash-1920x1080-XRGB8888.bin

Configuration

The directory searched for the splash images (default: /usr/share/platsch), as well as the image files' basename (default: splash) can be controlled via the environment variables platsch_directory and platsch_basename (which in the case of PID != 1 would be overridden by the corresponding commandline parameters, see further downwards).

For each connector a corresponding environment variable is looked up:

platsch_<connector-type-name><connector-type-id>_mode

<connector-type-name> is a lowercase string libdrm returns for drmModeGetConnectorTypeName(), "-" replaced with "_". The variable is expected to contain the mode's resolution and image format, optionally:

<width>x<height>[@<format>]

I.e. to set the mode matching a resolution of 800x600 and default format on LVDS-1:

platsch_lvds1_mode=800x600

Or a resolution of 1920x1080 and XRGB8888 format on LVDS-2:

platsch_lvds2_mode=1920x1080@XRGB8888

The kernel passes unrecognized key-value parameters not containing dots into init's environment, see Kernel Parameter Documentation. Therefore the above settings can be supplied via the kernel commandline. This also allows dynamic use cases where the bootloader decides which resolution/mode to use on which connector.

Commandline Arguments

If the program is used in later Linux userspace (PID != 1), platsch recognizes a couple of command line arguments:

--directory or -d sets the directory containing the splash screens.

--basename or -b sets the prefix of the splash screen file names.

Contributing

The Git repository for this software can be found at:

https://github.com/pengutronix/platsch

Contribution can be done via GitHub Pull-Requests.

This project uses the Developer's Certificate of Origin, as stated in the file DCO bundled with this software, using the same process as for the Linux kernel:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

By adding a Signed-off-by line (e.g. using git commit -s) saying:

Signed-off-by: Random J Developer <random@developer.example.org>

(using your real name and e-mail address), you state that your contributions are in line with the DCO.

Compiling Instructions

meson setup build
meson compile -C build

To ensure fast startup, platsch prefers using static libraries:

meson setup -Dprefer_static=true build
meson compile -C build