GPU Stack, V8086 Monitor & BGA Driver #50

Merged
Aaron merged 6 commits from feature/gpu-stack-v8086-bga into develop 2026-03-07 20:56:21 +00:00
Owner

GPU Stack, V8086 Monitor & BGA Driver

Branch: feature/gpu-stack-v8086-bgadevelop
Files changed: 17 | +2,049 / -67

Summary

Adds a full GPU driver framework, Virtual 8086 monitor for real-mode BIOS calls, BGA (Bochs Graphics Adapter) support, runtime resolution switching, and a boot splash screen.

Key Changes

GPU Framework & Drivers

  • gpu.pas — Priority-ordered GPU driver registry with mode-change callback system. After setMode, fires callbacks (video → LVGL → desktop) for decoupled resolution updates.
  • bga.pas — Bochs/VMware SVGA driver via PCI auto-detection. Programs display via I/O ports, supports arbitrary resolutions.
  • vesa.pas — Registered as GPU fallback (priority 50), uses V86 INT 10h for VBE mode switching.
  • setres.pasSETRES console command for runtime resolution switching.

V86 Monitor

  • v86.pas (775 lines) — Full Virtual 8086 mode monitor for executing real-mode BIOS interrupts from protected mode. Naked GPF handler with instruction emulation (INT, IRET, CLI, STI, PUSHF/POPF, IN/OUT, HLT, 0x66 prefix).
  • vmemorymanager.pasmap_page_user() for identity-mapping first 4MB with User bit (V86 IVT/BDA/video ROM access).

Boot Splash Screen

  • splash.pas — LVGL-based splash with embedded TGA logo (50% scaled), progress bar, and status text. Manually drives LVGL+video.Flush since gfxd isn't running yet.
  • splash_tga.asm — NASM incbin stub embedding asuro.tga into .rodata.
  • targa.pas — Fixed parser: correct pixel data offset, per-pixel pointer advance, vertical flip support.

Desktop & Video

  • desktop.pasrelayout procedure + GPU callback for automatic dock/watermark repositioning on resolution change. Live GPU/resolution info in System Information.
  • video.pas / lvgl.pas — Mode-change callback support, LVGL buffer reallocation on resize.

Housekeeping

  • Move program registration (diskcmd, diskutil, notepad, partcmd, volcmd) from kernel.pas into progmanager.init().
  • LVGL init moved earlier in boot sequence (before VFS/drivers).
  • Suppress FPC warnings in build script.
## GPU Stack, V8086 Monitor & BGA Driver **Branch:** `feature/gpu-stack-v8086-bga` → `develop` **Files changed:** 17 | **+2,049 / -67** ### Summary Adds a full GPU driver framework, Virtual 8086 monitor for real-mode BIOS calls, BGA (Bochs Graphics Adapter) support, runtime resolution switching, and a boot splash screen. ### Key Changes **GPU Framework & Drivers** - **gpu.pas** — Priority-ordered GPU driver registry with mode-change callback system. After `setMode`, fires callbacks (video → LVGL → desktop) for decoupled resolution updates. - **bga.pas** — Bochs/VMware SVGA driver via PCI auto-detection. Programs display via I/O ports, supports arbitrary resolutions. - **vesa.pas** — Registered as GPU fallback (priority 50), uses V86 `INT 10h` for VBE mode switching. - **setres.pas** — `SETRES` console command for runtime resolution switching. **V86 Monitor** - **v86.pas** (775 lines) — Full Virtual 8086 mode monitor for executing real-mode BIOS interrupts from protected mode. Naked GPF handler with instruction emulation (INT, IRET, CLI, STI, PUSHF/POPF, IN/OUT, HLT, 0x66 prefix). - **vmemorymanager.pas** — `map_page_user()` for identity-mapping first 4MB with User bit (V86 IVT/BDA/video ROM access). **Boot Splash Screen** - **splash.pas** — LVGL-based splash with embedded TGA logo (50% scaled), progress bar, and status text. Manually drives LVGL+video.Flush since gfxd isn't running yet. - **splash_tga.asm** — NASM `incbin` stub embedding asuro.tga into `.rodata`. - **targa.pas** — Fixed parser: correct pixel data offset, per-pixel pointer advance, vertical flip support. **Desktop & Video** - **desktop.pas** — `relayout` procedure + GPU callback for automatic dock/watermark repositioning on resolution change. Live GPU/resolution info in System Information. - **video.pas** / **lvgl.pas** — Mode-change callback support, LVGL buffer reallocation on resize. **Housekeeping** - Move program registration (diskcmd, diskutil, notepad, partcmd, volcmd) from kernel.pas into progmanager.init(). - LVGL init moved earlier in boot sequence (before VFS/drivers). - Suppress FPC warnings in build script.
admin added 6 commits 2026-03-07 20:43:49 +00:00
- GPU Framework (gpu.pas): Priority-ordered GPU driver registry with
  mode-change callback system. Drivers register with a priority (lower =
  tried first). After successful setMode, fires registered callbacks in
  order (video → LVGL → desktop) for fully decoupled resolution updates.

- BGA Driver (bga.pas): Bochs Graphics Adapter via drivermanagement PCI
  auto-detection (class=$03 subclass=$00 wildcard). Programs display via
  I/O ports $01CE/$01CF, reads framebuffer from PCI BARs with VMware SVGA
  fallback. Supports arbitrary resolutions (1920x1080, 2560x1440, etc).

- SETRES Command (setres.pas): Runtime resolution switching — just calls
  gpu.setMode; video reinit, LVGL buffer realloc, and desktop relayout
  all fire automatically via GPU mode-change callbacks.

- VESA/VBE: Registered as GPU fallback driver (priority 50), uses V86
  INT 10h for VBE mode switching.

- TSS: Fix SS0 from $08 (code segment) to $10 (data segment); add
  set_esp0/get_esp0 helpers for V86 ring-0 stack management.

- VMM: Add map_page_user() for identity-mapping first 4MB with User bit
  (required for V86 IVT/BDA/video ROM access).

- Desktop: relayout procedure + GPU callback registration for automatic
  dock/watermark repositioning on resolution change.

- V86 Monitor (v86.pas): Full Virtual 8086 mode monitor for executing
  real-mode BIOS interrupts from protected mode. Naked GPF handler with
  instruction emulation (INT, IRET, CLI, STI, PUSHF/POPF, IN/OUT, HLT,
  0x66 prefix for 32-bit variants). Thunk-based entry via IRET into VM86.

- Kernel init order: gpu.init → video.init → vesa.init → bga.init;
  drivermanagement.init moved earlier (before video) so PCI scan detects
  BGA before first use.
- desktop: Resolution/Graphics fields now read from video frontbuffer
  and gpu.activeDriverName instead of static multiboot/hardcoded values
- gpu: markAvailable sets ActiveName when no driver is active yet, so
  the initial VBE boot driver is reported before any setMode call
- kernel: whitespace cleanup
- 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.
refactor: move program registration from kernel to progmanager
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
36ec7bfdb6
- Remove diskcmd, diskutil, notepad, partcmd, volcmd init calls and
  uses from kernel.pas — these are programs, not kernel subsystems.
- Move their initialization into progmanager.init() alongside the
  other baked-in programs (md5sum, base64_prog, dhclient, etc.).
- Remove diskcmd, diskutil, notepad from kernel's uses clause.
- Add a splash.update() call for the auto-mount volumes step.
- Suppress FPC warnings in compile_sources.sh (-v0e instead of -v0ew).
Aaron approved these changes 2026-03-07 20:51:10 +00:00
Aaron merged commit 6902a406b0 into develop 2026-03-07 20:56:21 +00:00
Sign in to join this conversation.