twin

Mon, 02 Oct 2006 22:05:43 -0700

Building a new window system

As a part of some research at HP, I've started constructing a new window system using a lot of the ideas originally developed for X, but in a new smaller package. The goal is a complete window system and toolkit in under 50KB.

Instead of using clipping to present overlapping windows, I'm starting with the Composite architecture of off-screen buffers for each window. The final screen image is constructed as needed by blending sections from these off-screen buffers. This serves to both eliminate all of the complex region operations from the system as well as simplify application development by removing window-manipulation induced damage.

For now, I'm using a one level window tree -- no sub windows, and not even a root window. Mac OS X uses a similar model, and both Qt and Gtk+ are moving to having no nested windows, so I think this direction makes a lot of sense for this system. It certainly eliminates a lot of complexity.

The target platform has no MMU, and in fact very little operating system of any form. So, I'm starting out by just having every application draw to their own windows in global memory. Damage to windows is propogated to a global damage list which is used to repaint the screen after drawing. By placing window contents in the applications address space, I can easily extend the rendering operations with no performance difference. As the target platform has no GPU, there's no sense in attempting anything more complicated.

The only rendering operations I'm doing are SOURCE and OVER. The only image formats are RGB16, ARGB32 and A8. I'm reusing the Plan 9 rendering operator, but all of the masks are explicit instead of implicit. That means applications do extra steps for drawing at the lowest level API. I'm expecting to build some more sophisticated API on top of this.