feat: VESA rendering implementation & LVGL for graphics drawing #10

Merged
admin merged 42 commits from feature/lvgl into develop 2026-03-01 02:25:51 +00:00
Owner

LVGL GUI framework integration & major codebase refactoring.

Video Subsystem:

  • Modular VESA driver architecture (vesa8/16/24/32) with abstract video layer
  • SSE 128-bit double buffering
  • Color, texture, and TARGA image support
  • Compatibility for 16bpp framebuffers

LVGL Integration:

  • Full LVGL 9.2.2 Pascal bindings with display/input drivers
  • Desktop, window manager, and UI debug overlay
  • Hack Regular 14px monospace font for terminal
  • Font Awesome Solid 16 icon font
  • Keyboard ring buffer with proper LVGL press/release cycling
  • Resolution-independent mouse with bounds clamping

Codebase Refactoring:

  • New stdio unit with buffer-based I/O (stdin/stdout/stderr per command)
  • Dynamic command registry with TCommandMethod signature
  • New syslog unit replacing ad-hoc logging
  • New LVGL-based vterminal replacing legacy text-mode console
  • Removed legacy units: console, terminal, shell, edit, memview, themer, udpcat, splash, vmstate, vmlog, netlog

Hardware & Compatibility:

  • FPC 3.2.2 compiler support
  • AVX enable gated on XSAVE support with CR4.OSXSAVE
  • Hyper-V PS/2 mouse compatibility
  • Mouse driver rewrite with dedicated mousestate unit

Build System:

  • LVGL cross-compilation pipeline (compile_lvgl.sh)
  • Updated linker script and source list generation

113 files changed, ~56,856 insertions, ~5,663 deletions

LVGL GUI framework integration & major codebase refactoring. **Video Subsystem**: - Modular VESA driver architecture (vesa8/16/24/32) with abstract video layer - SSE 128-bit double buffering - Color, texture, and TARGA image support - Compatibility for 16bpp framebuffers **LVGL Integration**: - Full LVGL 9.2.2 Pascal bindings with display/input drivers - Desktop, window manager, and UI debug overlay - Hack Regular 14px monospace font for terminal - Font Awesome Solid 16 icon font - Keyboard ring buffer with proper LVGL press/release cycling - Resolution-independent mouse with bounds clamping **Codebase Refactoring**: - New stdio unit with buffer-based I/O (stdin/stdout/stderr per command) - Dynamic command registry with TCommandMethod signature - New syslog unit replacing ad-hoc logging - New LVGL-based vterminal replacing legacy text-mode console - Removed legacy units: console, terminal, shell, edit, memview, themer, udpcat, splash, vmstate, vmlog, netlog **Hardware & Compatibility**: - FPC 3.2.2 compiler support - AVX enable gated on XSAVE support with CR4.OSXSAVE - Hyper-V PS/2 mouse compatibility - Mouse driver rewrite with dedicated mousestate unit **Build System**: - LVGL cross-compilation pipeline (compile_lvgl.sh) - Updated linker script and source list generation 113 files changed, ~56,856 insertions, ~5,663 deletions
admin added 42 commits 2026-03-01 02:19:20 +00:00
Backbuffer will need modification to lmemorymanager to remove the limits to allocation size.
Double buffering is now enabled with the use of the new large alloc (klalloc).
Split out video driver into abstract/standard/implementation.
Started outlining how the modular driver set will look for video drawing routines. Currently supports Drawing pixels to the screen & Flushing backbuffer -> frontbuffer.
Still very much test code, tracer is used everywhere for debugging, NOT DEVELOP READY.
Many more draw routines need implementing - such as, but not limited to; drawRect, drawBitmap, drawLine, drawCurve, drawCircle.

TODO: Implement the aforementioned routines in all VESA modes + WindowManager.
Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
Backbuffer will need modification to lmemorymanager to remove the limits to allocation size.
Double buffering is now enabled with the use of the new large alloc (klalloc).
Split out video driver into abstract/standard/implementation.
Started outlining how the modular driver set will look for video drawing routines. Currently supports Drawing pixels to the screen & Flushing backbuffer -> frontbuffer.
Still very much test code, tracer is used everywhere for debugging, NOT DEVELOP READY.
Many more draw routines need implementing - such as, but not limited to; drawRect, drawBitmap, drawLine, drawCurve, drawCircle.

TODO: Implement the aforementioned routines in all VESA modes + WindowManager.
Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
- Created a PowerShell script `virtualbox-wrapper.ps1` to wrap calls to vboxmanage and only exit once the virtual machine has been terminated.
- Updated launch.json to use the PowerShell launch type to launch `virtualbox-wrapper.ps1` with the machine name supplied as an argument.
- Updated `readme.md` to reflect these changes.
- `VirtualBox-Wrapper.ps1` now takes 'up' or 'down' as opposed to a machine name. This allows start/stop of a virtualmachine.
- `VirtualBox-Wrapper.ps1` now relies on a gitignored `localenv.json` to work.
- `VirtualBox-Wrapper.ps1` can also optionally monitor the log file generated from the serial adapter in VirtualBox.
- `readme.md` updated to provide instructions on how to populate the `localenv.json` file.
- `tasks.json` updated to have a "Clean" task to --remove-orphans, the Build task depends on this.
- `tasks.json` updated to have a "Close VirtualBox" task, this runs the `virtualbox-wrapper.ps1` in 'down' mode. The Build task depends on this.
- `launch.json` updated to run the `VirtualBox-Wrapper.ps1` with the "-Command up" argument, instead of machine name.
- .gitignore updated to ignore any instances of `localenv.json`.
Final commit to merge through develop & master
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
0e2c6b2936
- CI/CD Pipeline now working & tested.
- Commits to all branches will trigger the pipeline in DroneCI.
- Commits to master will trigger the resulting ISO artefact to be uploaded to Gitea as a Package.

# Conflicts:
#	.drone.yml
Reviewed-on: #3
# Conflicts:
#	.drone.yml
#	virtualbox-wrapper.ps1
Basic LVGL wrapper with an example desktop & windowing system.
More work towards LVGL implementation
continuous-integration/drone/push Build is failing
98a14bc7dc
Removed old lv_conf
continuous-integration/drone/push Build is failing
ece376660c
- Full(ish) LVGL bindings implemented.
- Cursor replaced with an actual cursor.
fix: LVGL rendering for 16bpp framebuffers (HyperV compatibility)
continuous-integration/drone/push Build is failing
be4b482bde
The LVGL flush callback assumed 32bpp (4-byte stride, direct pixel
copy), causing corrupted output on hypervisors that fall back to
16bpp modes (e.g. HyperV at 1600x1200x16).

- lvgl.pas: Make lvgl_flush_cb BPP-aware; add ARGB8888->RGB565
  conversion path for 16bpp, keep direct copy for 32bpp. Replace
  static lv_buf1 array (hardcoded 1600px wide) with kalloc'd buffer
  sized to actual screen width.
- doublebuffer.pas: Fix allocateBackBuffer size from (W*H*BPP) to
  (W*H*BPP) div 8 to get correct byte count.
- vesa.pas: Account for BPP in allocateVESAFrameBuffer page range
  calculation to avoid under-mapping at higher BPP/resolutions.
- Removed the initialization of console in kernel.pas as this will
  cause issues on some systems that don't expect to need to allocate the
  textmode buffer.
- Add mouse_wait_long() with 100,000 iteration timeout for init-time
  i8042 controller commands (mouse_write/mouse_read/load). The original
  mouse_wait() stays at 100 iterations for ISR-safe use in main().

- In load(): use mouse_wait_long() for all direct port I/O ($64/$60)
  and clear CCB bit 5 (AND NOT $20) to ensure the mouse clock is not
  disabled — required for Hyper-V which enforces this strictly.

- Replace Console.getConsoleProperties^.Width/Height with
  video.frontBufferWidth/Height for mouse bounds clamping. The old
  console properties are zero when console.init() is not called,
  which locked the cursor to (0,0). Add 'video' to uses clause.
fix: gate AVX enable on XSAVE support and set CR4.OSXSAVE first
continuous-integration/drone/push Build is failing
e54b34aa93
XGETBV/XSETBV require CR4 bit 18 (OSXSAVE) to be set before execution,
otherwise the CPU raises #UD (invalid opcode). Hyper-V enforces this
strictly; VirtualBox was silently tolerating it.

- Check both AVX and XSAVE CPUID flags before attempting AVX enable
- Set CR4.OSXSAVE (bit 18) before issuing XGETBV/XSETBV
- If XSAVE is not exposed by the hypervisor, AVX enable is skipped
  gracefully instead of faulting
fix: Pipeline fixes for temporary lvgl directory
continuous-integration/drone/push Build is passing
201cda4c29
- Fixed missing lvgl artefacts for build pipeline causing drone failures.
fix: More changes for Hyper-V PS/2 mouse compatability
continuous-integration/drone/push Build is passing
dbe6e958e2
refactor/feature/fix: Major refactor of codebase
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
f752be48ce
refactor(stdio): replace console/terminal command system with buffer-based stdio
- Introduced stdio.pas as the unified command I/O layer.
- All 31 command procedures across 15 files now receive stdin_buf,
  stdout_buf, and stderr_buf (POutBuf) instead of a single outbuf.
- vterminal.pas creates all three buffers per command invocation and
  displays both stdout and stderr.
- Deleted console.pas, terminal.pas, and 9 obsolete windowing programs
  (shell, splash, edit, memview, themer, netlog, vmlog, vmstate, udpcat).
- Migrated all registerCommand calls to stdio, rewrote vterminal
  processCommand to use stdio.findCommand, and added proper error
  routing to stderr for invalid params, bad paths, and system errors.

refactor(syslog): replace console logging with serial-backed syslog
- Introduced syslog.pas for kernel-level logging over serial/dev.
- Migrated all boot logging in kernel.pas from console.outputln/
  writestringln to syslog.logln/writestringln.
- Converted 19 fault handlers, hashmap, lists, scheduler, tracer, net,
  udp, and all driver init paths to use syslog.
- Rewrote BSOD in util.pas (50+ calls) from console to syslog.
- Removed CONSOLE_SLOW_REDRAW, TRGB565, TRGB565Pair, and HWND
  from system.pas.

fix(keyboard): add ring buffer and proper press/release cycling for LVGL input
- Replaced the single last_key/key_pressed slot in lvgl.pas with a
  16-entry ring buffer (kb_buf, kb_head, kb_tail) to prevent ISR
  overwrites when typing fast.
- Added a kb_pending_release flag so each keystroke gets a
  full PRESSED->RELEASED cycle before the next key is consumed —
  LVGL requires this pairing and was silently dropping intermediate
  keys when receiving consecutive PRESSED events without
  intervening releases.

feat(vterminal): use Hack monospace font for terminal output
- Added Hack Regular 14px (hack_14.c) as a custom LVGL font.
- Removed the .static_bitmap field from the generated font file
  (not present in LVGL 9.2 lv_font_t struct).
- Declared the hack_14 external symbol in lvgl.pas and switched
  vterminal's text label from lv_font_montserrat_14 to hack_14
  for proper monospace terminal rendering.
admin merged commit 084130da80 into develop 2026-03-01 02:25:51 +00:00
Sign in to join this conversation.