Expand description
Framebuffer console (fbcon) — text rendering onto a pixel framebuffer.
Renders characters using the 8x16 bitmap font onto the UEFI-provided (or ramfb-provided) pixel framebuffer. Supports cursor tracking, newlines, tab stops, backspace, scrolling, and basic ANSI color escape sequences.
§Performance architecture
Three-layer pipeline with eager rendering, glyph cache, and incremental dirty-row blitting:
- Text cell grid — character/color pairs in a ring buffer. Scrolling is O(cols) (advance ring pointer + clear one row of cells).
- RAM back-buffer — always in sync via eager rendering (each glyph
rendered to pixels immediately on write). Scrolling uses a simple memmove
(~1ms in RAM) and marks all rows dirty (dirty_all). A glyph cache
pre-renders all 256 glyphs as u32 pixel arrays for the current color
pair, making glyph rendering a
copy_nonoverlappingof 32 bytes per row. - Hardware framebuffer — MMIO memory. Touched once per
flush()call, only for dirty rows — typically one row (~80KB) instead of the full screen (~4MB). On x86_64, write-combining (PAT) provides faster MMIO writes.
Thread-safety: The global FBCON is protected by a spinlock. Interrupt
handlers must NOT call _fbcon_print (use raw serial output for
diagnostics in ISRs).
Structs§
- FbHw
Info - Framebuffer hardware information for the compositor.
- Framebuffer
Console - Framebuffer console state.
Enums§
- FbPixel
Format - Pixel format of the framebuffer.
Functions§
- _fbcon_
print - Print formatted text to the framebuffer console.
- cursor_
row - Return the current text cursor row (for targeted row flushing).
- disable_
output - Disable fbcon text output (when switching to GUI compositor).
- enable_
output - Enable fbcon output. Called after boot completes (just before the shell launches) so that the hundreds of boot log lines don’t get rendered pixel-by-pixel to the framebuffer in QEMU.
- flush
- Blit all pending changes to the hardware framebuffer.
- flush_
row - Blit a single text row from back-buffer to MMIO and clear its dirty flag.
- get_
hw_ info - Get the hardware framebuffer information.
- init⚠
- Initialize the framebuffer console with the given parameters.
- is_
initialized - Check if the framebuffer console has been initialized.
- mark_
all_ dirty_ and_ flush - Mark all rows dirty and trigger a full blit on the next flush.
- update_
cursor - Update the cursor overlay on the MMIO framebuffer.