feature: add boot splash screen with embedded TGA logo

- New splash unit (src/prog/splash.pas) displays a centered logo,
  progress bar and status label during kernel boot.  Manually drives
  LVGL rendering + video.Flush since gfxd isn't running yet.
- Embed img/asuro.tga into the kernel via NASM incbin stub
  (src/stub/splash_tga.asm), assembled in compile_stub.sh.
- Build an lv_image_dsc_t at runtime from the decoded TGA pixel data
  and display it at 50% scale using lv_image_set_scale(128).
- Move LVGL init earlier in kernel.pas (right after video enable) so
  the splash screen is available before VFS/drivers/network init.
- Sprinkle splash.update() calls throughout kmain to show boot
  progress (VFS → drivers → buses → network → tests → desktop).
- Fix targa.pas parser: rename Magic→IDLength, remove erroneous Data
  pointer field, compute pixel offset correctly (buffer+18+IDLength),
  advance source pointer per pixel, handle bottom-to-top origin flip.
- Unit tests moved before desktop.init; splash.teardown called at 100%
  just before handing off to the desktop environment.
This commit is contained in:
2026-03-07 20:20:00 +00:00
parent 97244a2b95
commit df71c59aea
6 changed files with 373 additions and 55 deletions
+2 -1
View File
@@ -4,4 +4,5 @@ echo "======================="
echo " "
echo "Compiling Stub..."
echo " "
nasm -f elf src/stub/stub.asm -o lib/stub.o
nasm -f elf src/stub/stub.asm -o lib/stub.o
nasm -f elf src/stub/splash_tga.asm -o lib/splash_tga.o
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+31 -21
View File
@@ -12,7 +12,7 @@ type
PTARGAColor = ^TTARGAColor;
TTARGAHeader = packed record
Magic: uint8;
IDLength: uint8;
ColorMapType: uint8;
ImageType: uint8;
ColorMapOrigin: uint16;
@@ -24,7 +24,6 @@ type
Height: uint16;
PixelDepth: uint8;
ImageDescriptor: uint8;
Data : PTARGAColor;
end;
PTARGAHeader = ^TTARGAHeader;
@@ -35,29 +34,40 @@ implementation
Function Parse(buffer : puint8; len : uint32) : PTexture;
var
header : PTARGAHeader;
i, j : uint32;
data : PTARGAColor;
tex : PTexture;
src : PTARGAColor;
tex : PTexture;
x, y : uint32;
dstRow : uint32;
topDown: boolean;
begin
if (len < sizeof(TTARGAHeader)) then exit;
Parse := nil;
if len < sizeof(TTARGAHeader) then exit;
header := PTARGAHeader(buffer);
if (header^.Magic <> $0) or (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
//Create a new texture
tex:= texture.newTexture(header^.Width, header^.Height);
tex^.Width:= header^.Width;
tex^.Height:= header^.Height;
//Copy the data
data := PTARGAColor(header^.Data);
for i := 0 to header^.Height - 1 do begin
for j := 0 to header^.Width - 1 do begin
tex^.Pixels[i * header^.Width + j].r := data^.r;
tex^.Pixels[i * header^.Width + j].g := data^.g;
tex^.Pixels[i * header^.Width + j].b := data^.b;
tex^.Pixels[i * header^.Width + j].a := data^.a;
if (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
{ Pixel data starts after the 18-byte header + any ID field. }
src := PTARGAColor(buffer + sizeof(TTARGAHeader) + header^.IDLength);
{ Bit 5 of ImageDescriptor: 1 = top-to-bottom, 0 = bottom-to-top. }
topDown := (header^.ImageDescriptor AND $20) <> 0;
tex := texture.newTexture(header^.Width, header^.Height);
for y := 0 to header^.Height - 1 do begin
{ Flip vertically when origin is bottom-left (the TGA default). }
if topDown then
dstRow := y
else
dstRow := (header^.Height - 1) - y;
for x := 0 to header^.Width - 1 do begin
tex^.Pixels[dstRow * header^.Width + x].b := src^.b;
tex^.Pixels[dstRow * header^.Width + x].g := src^.g;
tex^.Pixels[dstRow * header^.Width + x].r := src^.r;
tex^.Pixels[dstRow * header^.Width + x].a := src^.a;
Inc(src);
end;
end;
+56 -33
View File
File diff suppressed because it is too large Load Diff
+265
View File
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
; Embed the boot splash TGA image into .rodata so it is linked
; directly into the kernel binary.
;
; Exported symbols:
; _splash_tga_start pointer to the first byte of the TGA file
; _splash_tga_end pointer one past the last byte
; _splash_tga_size uint32 containing the file size
section .rodata
global _splash_tga_start
global _splash_tga_end
global _splash_tga_size
_splash_tga_start:
incbin "img/asuro.tga"
_splash_tga_end:
_splash_tga_size: dd (_splash_tga_end - _splash_tga_start)