📄 design
字号:
This file contains some talk about what is involved with a goodregister-level graphics driver interface. This is an old file,you might also consider reading 'man 7 svgalib.faq'Section 1: Mode SettingThe following describes what happens during a mode set.A request is made for a mode with given width, height, and colorresolution. Optionally the request can specify a specific pixel size,scanline offset (line width), and pixel size (e.g. 3 vs. 4 pixels for24-bit color modes), otherwise the driver chooses defaults for theseproperties. It is the intention that requests for resolutions that don'tmatch an availabe mode timing can still be honoured by choosing a higherresolution (for example, 700x500 is requested and 800x600 timing isprogrammed). The scanline offset should ensure correct drawing ofgraphics. The user-level driver tries to match the requested mode properties witheither fixed modes defined by the selected kernel module driver, or with aflexible mode timing if the selected kernel module driver supports modetiming. In the case of fixed modes, the user-level driver must ask thekernel driver about the supported fixed modes, and in the case of modetimings, the user-level driver must ask the kernel driver about physicallimits such as the amount of video memory, maximum pixel clocks for eachpixel size, range and mapping of horizontal timing parameters, and theavailable pixel clock frequencies. In both cases, modes/timings that falloutside of the configured monitor specs (probably stored in a file in/etc) will not be selected. In the case of flexible mode timings, thehighest refresh timing that is possible will be selected. Once a mode timing or fixed mode is selected, the kernel module driver isrequested to set the mode on the hardware. A mode state is defined whichis a collection of VGA and driver-specific extended register values (bytevalues) that describes the mode that the video card is set to. During themode set proper, the following actions are performed: 1. The registers values that make up the state are read from the video card and stored in a state in system memory (this is the state of the video card before the mode set).2. An initialization function modifies the values in the state according to the requested mode. Nothing is written to the card; only the state in system memory is changed.3. The actual mode set on the hardware is performed by writing the values in the state to the corresponding registers on the video card.A special case is VGA-compatible textmode state, which would normally beactive at the time of a graphics mode set. This mode cannot be initializedin the way of (2) above. Instead, the mode is saved using (1), and theresulting state is restored using (3) when textmode needs to be restored. Another special case is the setting of a mode for which (1) and (2) havealready been performed, and the resulting state has been saved. In thiscase the mode can be set accomplished by just (3), provided that certainhardware-specific settings on the card have not been changed in the timebetween (1) and (3) (this would normally be the case). When a VT switch away from a graphics modes happens, the current hardwarestate should be saved, instead of the initialized mode state, since anapplication can have changed it (banking, displaystart, accelerator stateetc.). This is subject to all the extended registers being readable, whichmay be a problem with some cards (note that for simple mode settingfollowed by textmode restoration, this is not a problem since the modeinitialization overwrites most of the delicate extended registers, and thesaved textmode state is largely VGA registers, and doesn't deal withdelicate extended registers). A possible solution would be to havefunctions that save and restore or re-initialize the 'drawing' state,which would include banking, displaystart and accelerator registers. UponVT switching back, the mode initialization function would be used followedby the restoring of the saved drawing state. Section 2: What should be in the kernel driver.A decision that has to be made is whether all chipset specific settingsshould be handled within the kernel module driver. There's a fair amountof information required to select a suitable timing, which the user-leveldriver will have to request, and it might have to do additional queriesduring its evaluation. The abstractions used for this communication willinclude a growing number of properties to accomodate new card/chipsetdrivers. It is however desirable that the simple loading of a new moduledriver is enough to make full use it, without the requirement of having anupdated user-level driver. Harm Hanemaayer (hhanemaa@cs.ruu.nl)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -