home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / SVGALIB1.TAR / svgalib / src / DESIGN < prev    next >
Encoding:
Text File  |  1995-01-15  |  4.6 KB  |  91 lines

  1.  
  2. This file contains some talk about what is involved with a good
  3. register-level graphics driver interface.
  4.  
  5.  
  6. Section 1: Mode Setting
  7.  
  8. The following describes what happens during a mode set.
  9.  
  10. A request is made for a mode with given width, height, and color
  11. resolution. Optionally the request can specify a specific pixel size,
  12. scanline offset (line width), and pixel size (e.g. 3 vs. 4 pixels
  13. for 24-bit color modes), otherwise the driver chooses defaults for these
  14. properties. It is the intention that requests for resolutions that don't
  15. match an availabe mode timing can still be honoured by choosing a
  16. higher resolution (for example, 700x500 is requested and 800x600 timing
  17. is programmed). The scanline offset should ensure correct drawing of
  18. graphics.
  19.  
  20. The user-level driver tries to match the requested mode properties with
  21. either fixed modes defined by the selected kernel module driver, or with
  22. a flexible mode timing if the selected kernel module driver supports
  23. mode timing. In the case of fixed modes, the user-level driver must
  24. ask the kernel driver about the supported fixed modes, and in the
  25. case of mode timings, the user-level driver must ask the kernel driver
  26. about physical limits such as the amount of video memory, maximum pixel
  27. clocks for each pixel size, range and mapping of horizontal timing
  28. parameters, and the available pixel clock frequencies. In both cases,
  29. modes/timings that fall outside of the configured monitor specs (probably
  30. stored in a file in /etc) will not be selected. In the case of flexible
  31. mode timings, the highest refresh timing that is possible will be
  32. selected.
  33.  
  34. Once a mode timing or fixed mode is selected, the kernel module driver
  35. is requested to set the mode on the hardware. A mode state is defined
  36. which is a collection of VGA and driver-specific extended register
  37. values (byte values) that describes the mode that the video card is set
  38. to. During the mode set proper, the following actions are performed:
  39.  
  40. 1. The registers values that make up the state are read from the video
  41.    card and stored in a state in system memory (this is the state of
  42.    the video card before the mode set).
  43.  
  44. 2. An initialization function modifies the values in the state according
  45.    to the requested mode. Nothing is written to the card; only the state
  46.    in system memory is changed.
  47.  
  48. 3. The actual mode set on the hardware is performed by writing the values
  49.    in the state to the corresponding registers on the video card.
  50.  
  51. A special case is VGA-compatible textmode state, which would normally
  52. be active at the time of a graphics mode set. This mode cannot be initialized
  53. in the way of (2) above. Instead, the mode is saved using (1), and the
  54. resulting state is restored using (3) when textmode needs to be restored.
  55.  
  56. Another special case is the setting of a mode for which (1) and (2)
  57. have already been performed, and the resulting state has been saved. In
  58. this case the mode can be set accomplished by just (3), provided that
  59. certain hardware-specific settings on the card have not been changed in
  60. the time between (1) and (3) (this would normally be the case).
  61.  
  62. When a VT switch away from a graphics modes happens, the current hardware
  63. state should be saved, instead of the initialized mode state, since an
  64. application can have changed it (banking, displaystart, accelerator state
  65. etc.). This is subject to all the extended registers being readable,
  66. which may be a problem with some cards (note that for simple mode setting
  67. followed by textmode restoration, this is not a problem since the mode
  68. initialization overwrites most of the delicate extended registers,
  69. and the saved textmode state is largely VGA registers, and doesn't
  70. deal with delicate extended registers). A possible solution would
  71. be to have functions that save and restore or re-initialize the 'drawing'
  72. state, which would include banking, displaystart and accelerator
  73. registers. Upon VT switching back, the mode initialization function would
  74. be used followed by the restoring of the saved drawing state.
  75.  
  76.  
  77. Section 2: What should be in the kernel driver.
  78.  
  79. A decision that has to be made is whether all chipset specific settings
  80. should be handled within the kernel module driver. There's a fair amount
  81. of information required to select a suitable timing, which the user-level
  82. driver will have to request, and it might have to do additional queries
  83. during its evaluation. The abstractions used for this communication will
  84. include a growing number of properties to accomodate new card/chipset
  85. drivers. It is however desirable that the simple loading of a new module
  86. driver is enough to make full use it, without the requirement of having
  87. an updated user-level driver.
  88.  
  89.  
  90. Harm Hanemaayer (hhanemaa@cs.ruu.nl)
  91.