tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
I wrote a little graphics thing
Hello,
as the subject says, I just wanted to write a few drawing routines for
NetBSD's framebuffer device support and ended up doing a little bit
more.
As of now, this thing will try to switch you console device into dumb
framebuffer mode ( most drivers other than text mode VGA should support
that ), draw a couple things including a mouse pointer and a terminal,
and exit if you hit escape.
- the mouse pointer isn't useful yet, it only exists in order to test
the other graphics routines by providing an obstacle that needs to be
taken care of
- the terminal uses the in-kernel vt100 emulator code with minimal
changes ( mostly to get around the difference between kernel and
userland malloc(). It will spawn a /bin/sh and talk to it through a
pty, should be fully functional.
- the text rendering code uses wscons fonts
- keyboard input opens a bunch of /dev/wskbd*, gets their keymap via
ioctl(WSKBDIO_GETMAP) and sends characters to the terminal. Any
keyboard that works on the NEtBSD console should work, I tried ADB,
Sun and USB, with USB and ADB in the same machine. The reason to do
that instead of using a mux is this - in event mode we get hardware
scancodes, which the mux merges but doesn't provide any way to find
out which keyboard an individual event came from, so if there are
keyboards using different scancode sets on the same mux we get
garbage. There are PowerBooks with built-in ADB keyboards and a
bluetooth chip which poses as a USB keyboard and mouse.
- for now it supports 8bit and 32bit colour
Goals for this little project:
- re-use as many existing NetBSD facilities as possible, that's why it
uses wsfonts, recycles the terminal emulation code, uses kernel
keymaps etc.
- very few dependencies. So far it doesn't use anything not in a basic
NetBSD installation
- be quick and lightweight. The Binary is less than 50KB on macppc,
starts more or less instantly, uses very little CPU time, and speed
is pretty good.
- eventually cover the 'X with a bunch of xterms' use case on hardware
where regular Xorg is getting too fat
Problems:
- opening individual /dev/wskbd* nodes will remove them from their mux,
which may render your console unresponsive on exit. Re-adding your
keyboard(s) to the mux ( using wsmuxctl ) will fix that.
- if you're running this on macppc with an ADB keyboard that has USB
emulation enabled, you need a *very* recent src/sys/dev/wscons/wskbd.c
Missing things that will eventually be addressed:
- support for rendering fonts more than 8 pixels wide
- key repeat
- mouse stuff, like copy/paste, buttons etc.
- hardware sprite for the mouse cursor
- actual window handling
- text attributes like bold and underline
- built-in goodies like mixer controls, clock etc.
Requirements:
- a NetBSD box with a console driver that provides a framebuffer in
8bit or 32bit colour
- the framebuffer should be at least 800x600, otherwise the terminal
'window' isn't going to fit
... and that's it
Source code to play with is here:
http://ftp.netbsd.org/pub/NetBSD/misc/macallan/tinygfx.tar.gz
I tested it on a bunch of macppcs ( including a Performa 6360 to see how
it's doing on a 160MHz 603e ) and a Sun Ultra 2 ( for a 32bit console
framebuffer ).
have fun
Michael
Home |
Main Index |
Thread Index |
Old Index