Re: splash(4) support in vt

From: Emmanuel Vadot <manu_at_bidouilliste.com>
Date: Thu, 16 Mar 2023 08:20:07 UTC
On Thu, 16 Mar 2023 09:26:30 +0300
Gleb Popov <arrowd@freebsd.org> wrote:

> On Wed, Mar 15, 2023 at 10:57?PM Ed Maste <emaste@freebsd.org> wrote:
> >
> >
> > There are many individual tasks to be taken on; we need at least to
> > get the image displayed earlier in the boot process, support more than
> > just a 2-colour image, and support a user-provided (rather than
> > compiled-in) image. We probably also need some animation support (e.g.
> > a spinner). These tasks are all related but are mostly independent, so
> > could be taken on in any order. What is your priority on these?
> 
> I think we'd need to start from getting more colors work. Our final
> goal is a GIF-animated splash.
> 
> >
> > The Wiki page linked from the mailing list posting is
> > https://wiki.freebsd.org/MateuszPiotrowski/ImproveVtSplashScreenSupport,
> > and it has a basic introduction. Looking at the source, the current
> > logo is stored in sys/dev/vt/logo/logo_freebsd.c as a C array holding
> > a 257x219 bitmap. If you look at vt_fb_bitblt_bitmap (and similar
> > functions in other drivers) you can see that it loops over each pixel
> > where the image will be drawn, and sets it to either the foreground or
> > background color.
> 
> Which is the reason it only supports 2-color images, I presume?
> 
> Thanks for the links, I'll take a look!
> 

 Hi Gleb,

 Thanks for being interested in this, a few notes on how I think it
should be done below.

 First step is to handle more colors for the embeded logo, we only
support a depth of 1 currently, see
https://cgit.freebsd.org/src/tree/sys/dev/vt/vt_core.c#n1483

 Second step should be to switch from a compiled-in logo to a file
loaded from loader. The old sc(4) console support this (see
splash_bmp_load/splash_pcx_load in loader.conf(5)). I don't think that
the kernel should be aware of image format, instead loader(8) should be
able to load an image and convert in to a blob of pixel to draw based
on the framebuffer information (with EFI it's simple to know this).
 So I suggest adding a new type of module named 'splash_logo' of
something like that that will hold the data, size and depth of the
image.
 You can have a look at how this worked with sc(4) here :
https://cgit.freebsd.org/src/tree/sys/dev/fb/splashreg.h
 Maybe this should also hold a screen position (probably in percentage).

 For animated logo adding a splash_spinner type is probably the best
way. The problem will be to animate this, not sure that handling this
in the kernel is the best way. I think that in Linux it's handled by
plymouth and since it's start early in initrd it's easier for them to
do it that way. But I think that you have enough work for now :)

 Cheers,

-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>