XFree86® server 4.x Design (DRAFT) : Driver Interface
Previous: The XF86Config File
Next: Resource Access Control Introduction

## 3. Driver Interface

The driver interface consists of a minimal set of entry points that are required based on the external events that the driver must react to. No non-essential structure is imposed on the way they are used beyond that. This is a significant difference compared with the old design.

The entry points for drawing operations are already taken care of by the framebuffer code (including, XAA). Extensions and enhancements to framebuffer code are outside the scope of this document.

This approach to the driver interface provides good flexibility, but does increase the complexity of drivers. To help address this, the XFree86 common layer provides a set of ``helper'' functions to take care of things that most drivers need. These helpers help minimise the amount of code duplication between drivers. The use of helper functions by drivers is however optional, though encouraged. The basic philosophy behind the helper functions is that they should be useful to many drivers, that they should balance this against the complexity of their interface. It is inevitable that some drivers may find some helpers unsuitable and need to provide their own code.

Events that a driver needs to react to are:

ScreenInit

  An initialisation function is called from the DIX layer for each screen at the start of each server generation.

Enter VT

  The server takes control of the console.

Leave VT

  The server releases control of the console.

Mode Switch

  Change video mode.

ViewPort change

  Change the origin of the physical view port.

ScreenSaver state change

  Screen saver activation/deactivation.

CloseScreen

  A close screen function is called from the DIX layer for each screen at the end of each server generation.

In addition to these events, the following functions are required by the XFree86 common layer:

Identify

  Print a driver identifying message.

Probe

  This is how a driver identifies if there is any hardware present that it knows how to drive.

PreInit

  Process information from the XF86Config file, determine the full characteristics of the hardware, and determine if a valid configuration is present.

The VidMode extension also requires:

ValidMode

  Identify if a new mode is usable with the current configuration. The PreInit function (and/or helpers it calls) may also make use of the ValidMode function or something similar.

Other extensions may require other entry points. The drivers will inform the common layer of these in such cases.

XFree86® server 4.x Design (DRAFT) : Driver Interface
Previous: The XF86Config File
Next: Resource Access Control Introduction