The Init() function

How to add an (S)VGA driver to XFree86 : The Driver Itself : The Init() function
Previous: The Save() function
Next: The Adjust() function

## 6.9. The Init() function

The Init() function is the second most important function in the driver (after the Probe() function). It is used to initialize a data structure for each of the defined display modes in the server. This function is required to initialize the entire `vgaSDCRec' data structure with the information needed to put the SVGA chipset into the required state. The generic VGA portion of the structure is initialized with a call to vgaHWInit() (also located in vgaHW.c).

Once the generic portion is initialized, the Init() function can override any of the generic register initialization, if necessary. All of the other fields are filled in with the correct initialization. The information about the particular mode being initialized is passed in the `mode' parameter, a pointer to a `DisplayModeRec' structure. This can be dereferenced to determine the needed parameters.

If you only know how to initialize certain bits of the register, do that here, and make sure that the Restore() function does a read/modify/write to only manipulate those bits. Again, refer to the existing drivers for examples of what happens in this function.

How to add an (S)VGA driver to XFree86 : The Driver Itself : The Init() function
Previous: The Save() function
Next: The Adjust() function