First light: the kernel paints a framebuffer - #92
Merged
Conversation
A Loon program draws rectangles on a 640x480 display, as the kernel, through an `Fb` effect that falls through the handler stack to a ramfb driver — the same shape as `Console.write` falling through to the UART. - src/fwcfg.rs: QEMU fw_cfg via its DMA interface, to find `etc/ramfb`. - src/ramfb.rs: a linear XRGB framebuffer in RAM that QEMU scans out. Tell it where the buffer is once; drawing is writing memory. No queues, no interrupts. - `Fb` effects: width, height, clear, fill-rect, present. Integer-only ABI (coords, sizes, 0xRRGGBB). Raster is Rust behind rect-sized primitives on purpose — per-pixel Loon would be ~150 ms/frame at current speed. - boot/gui.oo runs only when the machine has a display; headless boots skip it and `make check` is unaffected. Without a ramfb, Fb ops raise a loud error naming the missing device. - `make gui` boots with a cocoa window and stays up. `make screenshot` boots headless, waits for the GUI, and pulls the frame over QMP as a PNG (tools/screenshot.py, no dependencies) — the CI-shaped way to prove the display works. Not yet: text, input, host-side Fb parity, time in the event loop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ecto
added a commit
that referenced
this pull request
Aug 18, 2026
Land #92 on main (first light framebuffer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #91 (targets that branch; retarget to
mainonce it merges).A Loon program draws rectangles on a 640×480 display, as the kernel, through
an
Fbeffect that falls through the handler stack to a ramfb driver — thesame shape as
Console.writefalling through to the UART.What's here
src/fwcfg.rsetc/ramfbsrc/ramfb.rsFbeffectswidth,height,clear,fill-rect,present— integer-only ABI (coords, sizes,0xRRGGBB)boot/gui.ootools/screenshot.pygui upon serial, QMPscreendump, PPM→PNG with no dependenciesReviewer notes
Ramfb::initreturnsNonewithout-device ramfb, the GUI image is skipped, and the machine powers off as before.make checkand theunikernel_boottest still pass. If a program does performFbon a display-less machine, it gets a loud error naming the missing device, not().controlfor zero.Host::fb(op, &[i64])is name-dispatched rather than an enum so the VM doesn't need to know what a display can do; the machine decides and says loudly when it can't.cargo test --workspacegreen.Not yet
Text (needs an embedded bitmap font), input (virtio-input — the next real piece), a host-side
Fbhandler somake checkcan diff the GUI the way it diffs the console, and any notion of time in an event loop.🤖 Generated with Claude Code