At the moment (2018-09-11) vt(4) has very limited support for splash screens.
The goal of this project is to extend it a little bit. It should be possible to:
A stretched goal is to support bitmaps with the color depth of more than 1.
| Add sysctl tunables for splash colors in vt(4). | {o} |
Commit adding some splash screen support to vt(4): 2ecca071d5eccf38f9a5fd7a03052b261b7bd7d2
sc(4) supports 8-bit colors.
Interesting functions:
vd_bitblt_bmpvt_fb_bitblt_bitmap (vt_fb.c)vt_fb_setpixel: it seems to be the function which is capable of setting pixel colors in a console controlled by vt(4).
There's a function called vtterm_splash in vt_core.c, which displays a boot splash when the kernel is compiled with DEV_SPLASH option, textmode is not activated and a muted booting was requested by the user (for example via specifying -m to boot(8)).
Also the following part of the vtterm_splash function:
switch (vt_logo_depth) { case 1: /* XXX: Unhardcode colors! */ vd->vd_driver->vd_bitblt_bmp(vd, vd->vd_curwindow, vt_logo_image, NULL, vt_logo_width, vt_logo_height, left, top, TC_WHITE, TC_BLACK);
Source: vt_core.c
suggests that:
bmp_SetPix in sys/dev/fb/splash_bmp.c but it does not help much as it directly sets video bits. Its signature looks like this: static void bmp_SetPix(BMP_INFO *info, int x, int y, u_char val).
Other questions regarding the vtterm_splash function:
VDF_SPLASH flag inside vd->vd_flags for?vd->vd_driver->vd_bitblt_bmp function work?struct vt_driver seems to be an interface for different hardware have to implement in order to use the vt(4) driver. vd_bitblt_bmp happens to be one of the drawing functions. It has various implementations like ofwfb_bitblt_bitmap, vga_bitblt_bitmap or vt_fb_bitblt_bitmap.
At the moment the vt(4) driver stores logos in unsigned char structures (see sys/dev/vt/logo/logo_beastie.c), which roughly correspond to the u_char *data member of the BMP_INFO structure (see sys/dev/fb/splash_bmp.c).
typedef struct { int width,height; /* image dimensions */ int swidth,sheight; /* screen dimensions for the current mode */ u_char depth; /* image depth (1, 4, 8, 24 bits) */ u_char sdepth; /* screen depth (1, 4, 8 bpp) */ int ncols; /* number of colours */ u_char palette[256][3]; /* raw palette data */ u_char format; /* one of the BI_* constants above */ u_char *data; /* pointer to the raw data */ u_char *index; /* running pointer to the data while drawing */ u_char *vidmem; /* video memory allocated for drawing */ video_adapter_t *adp; int bank; } BMP_INFO;
Source: sys/dev/fb/splash_bmp.c
const unsigned char vt_beastie_vga16[] = { 0x16, 0x00, 0x62, 0x16, 0x88, 0x03, 0x80, 0x16, 0x00, 0x23, 0x88, 0x80, 0x00, 0x00, 0x08, 0x88, 0x16, 0x00, 0x21, 0x08, 0x16, 0x00, 0x06, 0x88, 0x16, 0x00, 0x20, 0x80, 0x16, 0x00, 0x06, 0x08, 0x80, 0x16, 0x00, 0x1e,
Source: sys/dev/vt/logo/logo_beastie.c