Next Previous Contents

2. The GGI design principle

As stated above, security-critical functions like mode-negotiation (you don't want a game to fry your monitor with a too high refresh rate, do you?) need to be in kernel space. All requests ought to be filtered, checked, scheduled and generally taken care of by a graphics device driver in kernel.

All things that can be safely done from user space, typically like setting a pixel on the display, should be done in user space instead of the kernel. This has the twofold effect: reducing the size and complexity of the graphics code in the kernel, and increasing the speed at which such operations can be performed, since kernel calls can be relatively expensive.

The big problem is that what operations are 'safe' depends heavily on the hardware you are using.

As a result, if one wants to create a uniform kernel API to support all of these features, it must then contain emulation code for all of those features particular piece of hardware does not support. Under those conditions, the kernel driver would become massive and slow, even though many things like line drawing on the framebuffer could have easily been done in userspace instead.

GGI has proposed a solution to this dilemma -- allow the kernel API to be hardware-specific. A library, LibGGI, presents a uniform API to applications.

LibGGI contains functions for all the various graphics operations, and depending on the capabilities underlying hardware and kernel interface, it will either emulate them in software, in userspace, or make use of an accellerator function exported by the kernel in some manner. The user program need not concern itself with how a particular graphics function is implemented, or even with what operations the graphics hardware supports.

Side note: in a later stage, more complex functions like textured triangles will be supported, and these will go into a separate library which will use the same design.

Side note 2: Text mode is included as a 'special' graphics mode in this scheme.

Bottom line: GGI is a graphic API that is implemented partly in a shared library, partly in Kernel. The line between these parts is drawn to get maximum stability (first) and maximum performance (second) with minimum kernel bloat, and that line is drawn on a card-by-card basis.


Next Previous Contents