Improve vt(4) splash screen support
Contents
Repository |
|
Bugzilla |
Overview
At the moment (2018-09-11) vt(4) has very limited support for splash screens. Update 2024-07-15: See https://cgit.freebsd.org/src/commit/?id=7504e0e3e517fe9f0c775b802f0eb30481b4c01d for vt(4) splash support
The goal of this project is to extend it a little bit. It should be possible to:
- load a specified BMP file to be displayed as splash screen
- control display colors via kernel tunables
A stretched goal is to support bitmaps with the color depth of more than 1.
Roadmap
Add sysctl tunables for splash colors in vt(4). |
|
References
Mailing list threads
Research
Commit adding some splash screen support to vt(4): 2ecca071d5eccf38f9a5fd7a03052b261b7bd7d2
sc(4) supports 8-bit colors.
Interesting functions:
vd_bitblt_bmp
vt_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).
The `vtterm_splash` function
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:
Source: vt_core.c
suggests that:
- Monochrome colors are the only one supported at the moment.
- It should not be complicated to add support for 4-bit and 8-bit colors.
- Actually, there is an sc(4) file, which has a very similar switch construct handling various color depth configurations.
- What's the name of the sc(4) function with that switch case?
There's no such function in sc(4). There is 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).
- What's the name of the sc(4) function with that switch case?
- Actually, there is an sc(4) file, which has a very similar switch construct handling various color depth configurations.
Other questions regarding the vtterm_splash function:
What is the VDF_SPLASH flag inside vd->vd_flags for?
How to load a BMP file into a structure accepted by functions displaying pixels? Could it be that the splash(4) driver provides all the required functions to do so? Ideal scenario:
- The splash(4) driver reads the bitmap file that was specified in loader.conf(5) and converts it to a structure accepted by internal vt(4) functions.
- vt(4) gets the structure from splash(4).
- vt(4) displays the bitmap.
How does the 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).
1 typedef struct 2 { 3 int width,height; /* image dimensions */ 4 int swidth,sheight; /* screen dimensions for the current mode */ 5 u_char depth; /* image depth (1, 4, 8, 24 bits) */ 6 u_char sdepth; /* screen depth (1, 4, 8 bpp) */ 7 int ncols; /* number of colours */ 8 u_char palette[256][3]; /* raw palette data */ 9 u_char format; /* one of the BI_* constants above */ 10 u_char *data; /* pointer to the raw data */ 11 u_char *index; /* running pointer to the data while drawing */ 12 u_char *vidmem; /* video memory allocated for drawing */ 13 video_adapter_t *adp; 14 int bank; 15 } BMP_INFO;
Source: sys/dev/fb/splash_bmp.c
Source: sys/dev/vt/logo/logo_beastie.c
Glossary
DIB: device independent bitmap