DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing NFB graphical adapter drivers

Optimize performance

After completing the work described above, you should have a fully functional X server, but the performance is probably far below the capabilities of the hardware you are supporting.

The listed topics describe the most performance-critical drawing routines, roughly in the order in which they should be implemented. Measuring X server performance in a useful way is difficult; see ``Benchmarks, X''. For the purposes of this implementation we will focus on what makes commonly used X clients run more quickly, instead of what might produce better benchmark numbers.

As you implement each of the new drawing routines, you must update the xxxData.c file. This file contains the function pointers to the routines used by your driver to render graphics. Currently, the only rendering routine you have implemented is DrawImage(D3nfb). This means that the other drawing routines with their pointers in the xxxData.c file need to reduce all drawing operations (such as drawing a solid rectangle) down to the single current operation of drawing a full pixel image. This is why your driver is slow.

For SVR5 and SCO OpenServer 5, this generic code is in the ./Xserver/hw/sco/ports/gen directory. Optimizing your driver involves replacing what is referred to as ``gen'' code with code specific to your own graphics chip. To achieve this, do the following for each routine:

  1. Copy the gen code from the appropriate file, for example, genFillRct.c.

  2. Delete the body of gen code

  3. Change the prefix of the routine name from gen to the name of your driver. For example, if the name of your driver is myx, genCopyRect becomes myxCopyRect

  4. Modify xxxData.c so that, for example, the instance of genCopyRect becomes myxCopyRect

  5. Update the xxxProcs.h header file in your driver with the C function prototype of the new routine and make sure that the header file is included in both the xxxData.c file and the file in which the routine is implemented

  6. Write the optimized routine

  7. Compile and run the X server with the new routine

The following types of optimizations are recommended:



© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005