Overview
Portix OS implements a VESA framebuffer driver with double buffering, dirty-region tracking, and x86 hardware-accelerated primitives. All rendering occurs in a back buffer (0x0060_0000) and is blitted to the LFB only when changed.
Location: ~/workspace/source/kernel/src/graphics/driver/framebuffer.rs
Architecture
Framebuffer Structure
Initialization
Boot Info Reading
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:229
Color System
Color Structure
Color Definition
Color Palette
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:57
Alpha Blending
blend() method preserved for compatibility.
Source: ~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:112
Dirty Region Tracking
Dirty Region
present() only blits the dirty region, reducing memory bandwidth by up to 10x for small updates.
Source: ~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:124
Hardware Acceleration
rep stosd (Fill)
Fast Fill
- Back buffer clear
- Rectangle fills
- Solid color spans
rep movsd (Copy)
Fast Copy
- Back-to-front buffer blit
- Vertical scrolling
- Sprite blitting
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:263
Blitting to Linear Framebuffer
Present (Dirty-Rect Optimized)
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:319
Drawing Primitives
Basic Shapes
Rounded Rectangles
Rounded Corners
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:423
Bresenham Line
Line Drawing
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:495
Circle Fill (Midpoint)
Filled Circle
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:518
Advanced Effects
Gradient with Dithering
Bayer Dithering
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:456
Vertical Scrolling
Scroll Region
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:539
Font Rendering
TheConsole wrapper provides text rendering:
Text Rendering
crate::graphics::render::font::FONT_8X8
Source: ~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:745
VGA Text Mode
Portix OS defaults to VESA graphical mode but retains VGA text mode (80×25) for emergency fallback. Text mode is not used during normal operation.Mouse Cursor
Cursor Rendering
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:588
Performance Metrics
| Operation | Time (1920×1080) | Speedup |
|---|---|---|
| Full screen clear | ~3 ms | 5× (rep stosd) |
| Full present (32bpp) | ~8 ms | 4× (rep movsd) |
| Dirty present (10% screen) | ~1 ms | 10× (tracking) |
| Rectangle fill 100×100 | ~10 μs | 3× (rep stosd) |
| Alpha blend 100×100 | ~200 μs | 3× (LUT) |
Hardware tested: QEMU, VirtualBox, bare metal Intel Core i5. Results may vary on AMD platforms.
Layout System
Responsive layout calculations:Layout
~/workspace/source/kernel/src/graphics/driver/framebuffer.rs:172
See Also
Console
Terminal interface using framebuffer
Drivers
Mouse driver for cursor rendering