Repository navigation
v0.10.4: GUI Bug Fixes + VirtIO GPU Acceleration
VeridianOS v0.10.4 -- GUI Bug Fixes + VirtIO GPU Acceleration
Summary
Fixes 5 GUI bugs discovered during interactive QEMU testing and wires the VirtIO GPU driver (fully implemented in Phase 7 Wave 1 but never connected to the renderer) into the desktop compositing pipeline for hardware-accelerated 2D framebuffer output.
Bug Fixes
1. System Monitor Shows All Zeros
Root cause: Performance counter functions (perf::count_syscall(), count_context_switch(), count_page_fault()) existed as atomic increment stubs but were never called from any kernel code path. Additionally, count_interrupt() didn't exist at all despite INTERRUPT_COUNT: AtomicU64 being declared.
Fix: Wired counters into hot paths:
perf::count_syscall()athandle_syscall()entry -- counts every syscall dispatchperf::count_context_switch()in schedulerswitch_to()-- counts actual task switchesperf::count_page_fault()at page fault handler entry (before CR2 read)- Added
perf::count_interrupt()and wired into PIC timer (vector 32), APIC timer (vector 48), and keyboard (IRQ1) handlers
All use AtomicU64::fetch_add(1, Relaxed) -- zero-overhead, safe from any context including interrupt handlers.
2. Settings Window Is Blank
Root cause: render_all_apps() called render_placeholder_app("Settings", 0x2d3436) which draws only a solid background + centered title. The fully-implemented SettingsApp (sidebar navigation, 5 content panels, interactive fields) was never invoked.
Fix: Added render_to_u8_buffer() to SettingsApp that renders the complete UI directly to a BGRA byte buffer. Refactored existing render_to_buffer() to delegate to it. Added SettingsApp instance to DesktopState and replaced placeholder call.
3. Panel Clock Shows Wrong Date/Time
Root cause: Clock derived from read_hw_timestamp() (TSC ticks / 1GHz) -- starts at 00:00 on boot with fake date math (days % 28 for day-of-month). No CMOS RTC driver existed.
Fix: New CMOS MC146818 RTC driver (kernel/src/arch/x86_64/rtc.rs, 133 lines):
- Reads registers via I/O ports 0x70/0x71 with BCD-to-binary conversion
- Handles 12/24-hour format, century register (0x32), update-in-progress wait
init(): Snapshots boot-time RTC toBOOT_EPOCH: AtomicU64+ captures TSC baselinecurrent_epoch_secs():BOOT_EPOCH + (now_tsc - boot_tsc) / 1GHz- Panel clock rewritten with proper Unix epoch decomposition (leap years, month lengths, day-of-week via
(days + 4) % 7)
4. Taskbar Click Doesn't Switch Focus
Root cause: panel.update_buttons() ran only every N frames, so the button hit-test list was stale when click events arrived -- window IDs and positions didn't match actual WM state.
Fix: Force panel.update_buttons() immediately before handle_click() in the panel click event path.
5. GUI Is Sluggish
Root causes: Apps rendered every 4th frame (effective 15 FPS), panel updated every 60th frame, spin-loop frame pacing at 50,000 iterations.
Fix: Removed is_multiple_of(4) app render skip (every frame now), reduced panel interval from 60 to 10 frames, reduced spin loop from 50,000 to 5,000 iterations.
VirtIO GPU Hardware-Accelerated Framebuffer Blit
The VirtIO GPU driver (kernel/src/drivers/virtio_gpu.rs, ~1800 lines) was fully implemented in Phase 7 Wave 1 with 2D resource management, BGRX8888 backing buffer, and virtqueue transport, but was never called from the desktop renderer. The desktop wrote directly to the UEFI GOP MMIO framebuffer via per-row copy_nonoverlapping (uncached memory, ~200-1000 MB/s).
New try_gpu_blit() function:
- Checks
virtio_gpu::is_available()-- returns false if no VirtIO GPU (QEMU-vga std) - Copies compositor back-buffer to GPU DMA backing store via
copy_from_slice()(~2-10 GB/s) - Issues
TRANSFER_TO_HOST_2D+RESOURCE_FLUSHvia virtqueue (lightweight DMA commands) - Falls back to existing UEFI GOP MMIO path when VirtIO GPU not detected
Format compatibility: compositor XRGB8888 and VirtIO GPU BGRX8888 have identical byte layout -- no conversion needed.
Files Changed
| File | Type | Description |
|---|---|---|
kernel/src/perf/mod.rs |
Modified | Add count_interrupt() function |
kernel/src/syscall/mod.rs |
Modified | Wire count_syscall() |
kernel/src/sched/scheduler.rs |
Modified | Wire count_context_switch() |
kernel/src/arch/x86_64/idt.rs |
Modified | Wire count_page_fault() + count_interrupt() |
kernel/src/desktop/settings.rs |
Modified | Add render_to_u8_buffer(), refactor render_to_buffer() |
kernel/src/desktop/renderer.rs |
Modified | Settings rendering, VirtIO GPU blit, render skip removal, panel interval, taskbar fix |
kernel/src/arch/x86_64/rtc.rs |
New | CMOS MC146818 RTC driver (133 lines) |
kernel/src/arch/x86_64/mod.rs |
Modified | Add pub mod rtc |
kernel/src/bootstrap.rs |
Modified | Add rtc::init() call |
kernel/src/desktop/panel.rs |
Modified | RTC-based wall-clock time, epoch-to-date conversion |
Cargo.toml |
Modified | Version 0.10.3 → 0.10.4 |
kernel/src/fs/mod.rs |
Modified | Version in os-release |
kernel/src/services/shell/commands.rs |
Modified | Version in uname |
13 files (1 new), +329/-128 lines
Build Verification
cargo fmt --all -- --check: Cleancargo clippy --target x86_64-unknown-none: Zero warningscargo clippy --target aarch64-unknown-none: Zero warningscargo clippy --target riscv64gc-unknown-none-elf: Zero warnings./build-kernel.sh all dev: All 3 architectures successful
Full Changelog
See CHANGELOG.md for complete release history.