starkernel: item 4.3.1 -- framebuffer orientation test, found and fixed a real color-swap bug

Adds fb_draw_orientation_test() (framebuffer.c/.h): fills the four raster
corners RED/GREEN/BLUE/YELLOW via fb_fill_rect. Wired into kernel_main.c
calling fb_init() directly -- console_fb_init()/vt100_init() removed from
the boot path, since vt100.c/console.c are superseded by the Console
drawing-fabric redesign (FABRIC.md ss27) and should not be exercised even
incidentally.

The diagnostic caught a real, pre-existing bug on its first run: framebuffer.c's
pack_pixel() had its FB_PIXEL_RGBX32/FB_PIXEL_BGRX32 branches swapped relative
to UEFI GOP's own byte-order naming convention, producing a clean R<->B channel
swap (G unaffected). Spatial placement was already correct -- no flip/rotation.
Fixed by swapping pack_pixel's two return bodies to match framebuffer.h's
already-correct doc comments; kernel_main.c's GOP-format switch needed no change.

Also item 4.3.2 -- QEMU screenshot capability. scripts/qemu_screenshot.sh
already existed (monitor socket + socat + HMP screendump), just unwired and
unused this session. Redirected its PNG output to a new top-level fb/
directory (tracked in git, not logs/, not a gitignored temp dir) and added a
python3+PIL fallback for PPM->PNG conversion since imagemagick isn't
installed here. Left as a standalone script for now, not wired into a
Makefile target.

FABRIC.md items 4.3.1 and 4.3.2 marked done with acceptance evidence.
This commit is contained in:
Robert Allan James
2026-08-07 11:38:33 -04:00
parent f3acfb9b47
commit ab96ac0970
11 changed files with 54516 additions and 15 deletions
+9 -2
View File
@@ -796,7 +796,13 @@ static void kernel_main_deep(BootInfo *boot_info) {
if (mama->halted) goto idle;
#endif
/* Activate framebuffer VT100 now that POST is done — REPL-only */
/*
* FABRIC.md item 4.3.1 -- raw framebuffer boot diagnostic.
* console.c / vt100.c are superseded by the Console drawing-fabric
* redesign (FABRIC.md §27) and are deliberately not invoked here.
* fb_init() wires the raw GOP framebuffer directly; the orientation
* test pattern is drawn on a blank framebuffer, nothing else touches it.
*/
if (boot_info->framebuffer.base != NULL && boot_info->framebuffer.size > 0) {
FbPixelFormat fb_fmt;
switch (boot_info->framebuffer.pixel_format) {
@@ -804,7 +810,8 @@ static void kernel_main_deep(BootInfo *boot_info) {
case (UINT32)PixelBlueGreenRedReserved8BitPerColor: fb_fmt = FB_PIXEL_BGRX32; break;
default: fb_fmt = FB_PIXEL_BGRX32; break;
}
console_fb_init(&boot_info->framebuffer, fb_fmt);
fb_init(&boot_info->framebuffer, fb_fmt);
fb_draw_orientation_test();
}
/* Clear reboot-tries counter: we reached the REPL cleanly */