Skip to main content

strat9_kernel/arch/x86_64/vga/
mod.rs

1//! Framebuffer text console (Limine framebuffer + PSF font).
2//! https://en.wikipedia.org/wiki/PC_Screen_Font
3//!
4//! Keeps the existing `vga_print!` / `vga_println!` API but renders text into
5//! the graphical framebuffer when available. Falls back to serial otherwise.
6//!
7//! # Module structure
8//!
9//! - `types`    : Color, RgbColor, UiTheme, layout types, terminal widget
10//! - `font`     : PSF font parsing (PSF1/PSF2 + unicode map)
11//! - `writer`   : `VgaWriter` struct: glyph rendering, scrollback, cursors,
12//!                double-buffering, dirty-rect tracking, present
13//! - `canvas`   : `Canvas` convenience drawing API
14//! - `api`      : Public free functions, `VGA_WRITER` static, `init()`
15//! - `panic_screen` : Lock-free panic framebuffer drawing
16//! - `debug_overlay` : Live debug overlay (bypasses VGA_WRITER)
17//! - `status_line` : Status bar kthread and rendering
18
19mod api;
20mod canvas;
21mod cursor;
22mod debug_overlay;
23mod font;
24mod panic_screen;
25mod scrollback;
26pub(crate) mod status_line;
27mod types;
28mod writer;
29
30// Re-export everything that was previously public from the old monolithic vga.rs.
31pub use api::*;
32pub use canvas::Canvas;
33pub use types::*;
34pub use writer::VgaWriter;
35
36pub use status_line::{
37    draw_system_status_line, maybe_refresh_system_status_line, set_status_hostname, set_status_ip,
38    status_line_task_main, ui_draw_status_bar,
39};
40
41pub use debug_overlay::{vga_debug_init, vga_debug_write, vga_debug_writeln};
42pub use panic_screen::{init_panic_fb_globals, panic_draw_direct};
43
44/// Print to framebuffer console (falls back to serial when unavailable).
45#[macro_export]
46macro_rules! vga_print {
47    ($($arg:tt)*) => {
48        $crate::arch::x86_64::vga::_print(format_args!($($arg)*));
49    };
50}
51
52/// Print line to framebuffer console (falls back to serial when unavailable).
53#[macro_export]
54macro_rules! vga_println {
55    () => ($crate::vga_print!("\n"));
56    ($($arg:tt)*) => ($crate::vga_print!("{}\n", format_args!($($arg)*)));
57}