This article is the second part of "How to implement the device under Linux" will then introduce the configuration process of the window system (Xfree86).
This article is the second part of "How to implement the device under Linux" will then introduce the configuration process of the window system (Xfree86).
6 Window System (XFree86) Configuration Procedure 6.1 Description File of Display Card (CARDDB) CARDDB is the display card data file used by the X configuration program. When configuring XFree86, the configuration program typically needs to read the contents of the content on which the display card is completed. Its content is closely related to the version used by Xfree86. In general, its preserved position is in / usr / x11r6 / lib / x11 / directory. Now we will make a brief introduction to the CardDB file of Xfree86 4.1.0:
Name Display Card Description Name Chipset
Describe the chip set used by the display card
Server is compatible with the 3.x version of XFree86, which specifies this display card in X servers under Xfree86 3.x, such as VGA16, SVGA, etc.
Driver describes the driver module that displays the card under the 4.x version of XFree86.
LINE Sets the option information that displays the card, such option information appears in the XF86Config Device section, the Option parameter of the corresponding device.
See means that the configuration information of this display card is exactly the same as the display card set by the SEE field, for example
Name Number Nine GXE64 with S3 TRIO64
See S3 TRIO64 (Generic)
The display card configuration of Number Nine GXE64 is identical to the configuration of S3 TRIO64 (Generic).
Ramdac
RAM direct access control control chip model
DACSPEED direct access control speed
Clockchip's clock chip
NoClockChip This display card is not a clock chip
Unsupported This type of graphics card, this version of XFree86 can not provide support
Comment comment
For example, for the RIVA TNT graphics card, the information in Xfree86 4.1.0 is as follows:
Name Riva TNT
Chipset RivatNT
Server Svga
Driver nv
Noclockprobe
6.2 Display Information Detection The display of the display is very important in the XFree86 system, which corresponds to the Monitor section of the XFree86 configuration file. In this section, the horizontal scan frequency range of the monitor, the vertical scan frequency range, the display mode supported by the display, and other information. Similarly, the automatic detection of the display is to automatically read the above information of the display by the program. Its correct settings make a very important role for XFree86.
For information detection of the display, it is required to support VBE (VESA BIOS-level extensions). When the display supports this extension, the INT 10H can be obtained by the BIOS in the system real mode, and the details of the display can be obtained.
The possible BIOS sub function call is:
AH = 0x4f00 gets BIOS-level extended information about the monitor's VESA
AH = 0x4f01 Get a specific display mode supported by the monitor
AH = 0x4f02 Sets the current video mode
AH = 0x4f03 gets current video mode
AH = 0x4f04 Save / Restore SVGA display mode
AH = 0x4f15 gets the monitors of EDID extension information
The general display uses the above-described interrupt: first check if the display supports VESA's BIOS-level extension, if the display supports the BIOS level extension, view the display mode supported by the display and then get the Edid Extension of the display. In the read eDID extension information, you can detect the vertical back sweep frequency range of the display and horizontal backswouting frequency range, or the size of the display can be calculated, and the monitor can read from the monitor information from this information. . The information read by the display can set the MONITOR segment of the XF86Config. For the displayed display of the correct vertical back sweep frequency range and the horizontal swivel frequency range, X is automatically set to the display mode of the highest scan frequency supported by the current display resolution ( This display mode requires a corresponding modeline.
But if your monitor does not support EDID extension information, you only have the vertical back sweep frequency range and horizontal back sweep frequency range based on experience. If the set range is higher than the actual support range of the monitor, the display will appear in a black screen.
For programming implementation, if you want to call the BIOS interrupt above, you must use the LRMI this real mode interface, and set the correct register information to complete the system call. For example, an example of detecting display information, you can refer to the source program of DDCPROBE under XConfigurator, or you can refer to the source program of the DDCXINFOS command under the Mandrake system.
6.3 Configuration Process of Window System To properly configure window system under Linux, actually generating the correct XFree86 configuration file, this file is usually saved in / etc / x11 / under the X version is 3.x, its file Named XF86Config, when the X version is 4.x, its file name is generally XF86Config-4. In the current release, they are in hardware compatibility, they generally make these two versions of XFree86 packages. Therefore, you can also find these two files at the same time in the / etc / x11 directory, then use that file to see the version of the system's X server.
Whether it is the version of the XF86config files, these sections describe the contents of these sections mainly include: keyboard, mouse, display, display card, font (color), etc.
When the X version is 3.x, the description of the keyboard and the mouse corresponds to the Keyboard and Pointer section, respectively. When the X version is 4.x, the description of the keyboard and the mouse corresponds to the InputDevice section, just a corresponding different drive module, the keyboard drive module is a keyboard, the mouse drive module is MOUSE. Configuring the information required for these two sections can be obtained from / etc / sysconfig / keyboard and / etc / sysconfig / mouse, their details, the previous chapter of this article has been introduced.
Configuring the display is actually the Monitor section of the XF86Config file. The information that needs to be configured generally includes: horizontal scan frequency range, vertical scan frequency range, display mode supported by the monitor, manufacturer information. For a display that supports VBE and EDID extensions, the value of the corresponding field can be set according to the information read from the display. However, if the display does not support the above extension, the setting of the display card must be done manually by the user. If you do not specify this section when configuring XFree86, XFree86 sets the display mode 640x480, and the vertical scan frequency is 60 Hz. Scan frequency of different display modes:
Display resolution Vertical scanning frequency (Hz) horizontal scanning frequency (kHz) 640x4806031.50640x4807236.50640x4807537.50640x4808543.27800x6006037.80800x6007248.00800x6008555.84800x60010064.021024x7686048.401024x7687056.501024x7687662.501024x7688570.241024x76810080.211280x10246164.201280x10247074.591280x10247478.851280x10247681.131280x10248591 . 1512801600x12007075.501600x12007087.501600x12007593.751600x12007593.77 Table 6-1 From the above table, you can see that the display reaches an a resolution, then corresponds to this, its scan frequency range also includes the above table The lowest scan frequency of this resolution. If your monitor does not meet this range, XWindow will not work properly. If the scanning frequency you set is higher than the actual scan frequency range of the display, since Xfree86 will look for the highest scanning frequency at the corresponding resolution, the XWindow will be very likely to black.
When generating a configuration script, the scan frequency is not, the lower the better. Setting a lower scan frequency range is not suitable for some LCD displays. For example, a part of the LCD display at 800x600 resolution, the lowest supported vertical scan frequency is 70 Hz, then you specified the horizontal back sweep range at this time must include 48kHz.
After configuring the monitor, you need to generate a description corresponding to the display card. Such a description information corresponds to the Device section of the XF86Config file. The main description of this section includes: the X server corresponding to the display card (X version in 3.x), the corresponding X device module (X version is 4.x), display card device information (supplier, model) , Support the memory access mode and the memory size, etc.), and the device options supported by this display card, such as whether the display card supports hardware acceleration, whether to support soft cursors. The configuration process of the generated window system is generally the type of the display card first by the PCI device identifier (see the process of detection), whereby the configuration file CardDB in Xfree86 (this file can be found in / usr / x11r6 / lib / x11 / directory The description of this section can be set in this section.
The font and palette information describes the path stored by the font and palette. If you add a font, you need to add the correct font path here. When setting the font path, if it is specified for UNIX: -1, then you must first start the font server XFS before starting the X server, and then complete the font access request by the font server.
After you set the above information correctly, you must store this information in the Screen section. This section describes information such as display corresponding display cards, displays, resolutions, and default depths.
Finally, you must also generate the ServerLayout section, which describes the display card configuration segments used by the entire system, the monitor configuration festival, the mouse configuration section, the keyboard configuration section and other information.
After generating / etc / x11 / xf86config (xf86config-4) file, you can test if this profile is correct. For example, for Xfree86 4.x, the generated profile is /etc/x11/xf86config.test, the test uses the following command:
Xfree86 -xf86config /etc/x11/xf86config.test: 9
-xf86config /etc/x11/xf86config.test means that the X server is started using the specified profile: 9 indicates that the X server is run on the terminal 9
In general, if it is programmed to implement the X-shaped configuration process, run the above command as a child process (system calling fork), after the X server is successfully launched, run a small graphics program, so that the user selects whether to configure success.
Of course, if you don't get a detailed device parameter of the graphics card, you can also use the ProBeonly option to get the details of the display card. For example, use the following command for Xfree86 4.x test: Xfree86 -Probeonly: 9
After normal startup XFree86, the system outputs information, you can get it by reading /var/log/xfree86.x.log. x refers to the terminal that is started with XFree86, which is typically set to 0.
Once the XF86Config file configuration, you can use StartX to boot xfree86. This file runs the .xinitrc file in your login directory to modify the initial display status of the X WINDOW system. This file is a script file. If this file does not exist, the system will use / usr / x11r6 / lib / x11 / xinit / xinitrc by default. At the same time, StartX is also looking for / etc / x11 / x, this file is a link file, which pointing to the real X service, now this program generally points to xwrappers, which is a package for the X service program. Of course, this document can also directly point to the X service XFree86.
6.4 Configuration Process FrameBuffer devices supporting a FrameBuffer mode refers to an X11 support device without a video acceleration. The advantages of this way are mainly three points: one is when the console mode works, you can set a larger console display area, such as a console of 1024x768 resolution size; its second is to start XF86_FBDEV on it. Under xfree86 4.x, starting module fbdev); its third is to display startup logo (a fat penguin) at startup.
When the XFree86 driver corresponding to the display card does not work properly, and when you need more rich colors, starting FrameBuffer is often a must. When FrameBuffer is started, the resolution of XFree86 starts is determined by the startup mode of FrameBuffer.
The device capable of starting FrameBuffer is a frame buffer device compatible with VESA 2.0 standard compatible with the VESA 2.0 standard, but now does not support FrameBuffer on the graphics card supporting VESA 1.2. This is because VESA 1.2 does not support linear frame buffer (linear frame buffering means that the CPU can access each bit of the graphics card). You can download patch to support VESAFB to support VESA 1.2 graphics cards, such as some older S3 series graphics cards.
It is mainly available to support VESA 2.0:
ATI PCI videoExpression 2MB (Max. 1280x1024 @ 8bit)
ATI PCI All-in-Wonder
Matrox Millennium PCI - BIOS V3.0
Matrox Millennium II PCI - BIOS V1.5
Matrox Millennium II AGP - BIOS V1.4
Matrox Millennium G200 AGP - BIOS V1.3
Matrox MyStique & Mystique 220 PCI - BIOS V1.8
Matrox MyStique G200 AGP - BIOS V1.3
Matrox Productiva G100 AGP - BIOS V1.4ALL RIVA 128 BASED CARDS
Diamond Viper V330 PCI 4MB
GenoA Phantom 3D / S3 Virge / DX
Hercules StingRay 128 / 3D with TV Output
Hercules Stingray 128 / 3D WITHOUT TV Output - Needs Bios Upgrade (Free from
Support@hercules.com)
SIS 6326 PCI / AGP 4MB
STB LightSpeed 128 (NVIDA RIVA 128 BASED) PCI
STB Velocity 128 (NVIDA RIVA 128 BASED) PCI
Jaton Video-58P ET6000 PCI 2MB-4MB (Max. 1600x1200 @ 8bit)
VOODOO2 2000
Motherboard integration display card:
Trident cyber9397
SIS 5598
Starting FrameBuffer Must set the kernel's launch display mode, setting this parameter is achieved by kernel parameters VGA =. For example, when setting the 16-bit color after the startup is 640x480, the passing parameter is VGA = 785 (decimal). You can also set this parameter in the /etc/lilo.conf file, passing the kernel parameters by the LILO.
The FrameBuffer display mode supported by kernels is as follows:
Display depth 640x400640x480800x6001024x7681152x8641280x10241600x12004 bits0x3028 bits0x3000x3010x3030x3050x1610x3070x31C15 bits0x3100x3130x3160x1620x3190x31D16 bits0x3110x3140x3170x1630x31A0x31E24 bits0x3120x3150x3180x31B0x31F32 bits0x164 Table 6-2
Passing the VESA option to the kernel further includes: Video = VESA: Option, multiple options can be separated by commas;
Acceptable options: YPAN Use the VESA protection mode interface to display, the visual screen is a window of the video memory.
PRO Quick full screen rolls, allows rollback.
The Kontra part rolls to produce some flash effects.
YWRAP is fast than YPAN, but is poor compatibility.
Redraw defaults to redraw over the affected screen area.
Vgapal is default, the standard VGA tongue version register.
PMIPAL uses the color palette interface of the protection mode.
For example, the following operation sets the display of the FrameBuffer device: export framebuffer = / dev / fb1fbset -fb / dev / fb1 -vyres 600fbset -fb $ framebuffer 1024x768 @ 60StartX -: 0 -bpp 16 VT06 in the virtual control terminal 6 at 16 Color depth starts the X server.
If you want to program a frame buffer device, you can read, write, locate, and mmap (), read, write, position, and mmap (). Different, the device you operate at this time is located in the video device memory. / DEV / FB * The device also supports several IOCTL operations, thereby obtaining or seting device information. The processing of color tables uses ioctl ().
6.5 XF86Config file format (version 4.x series) 6.5.1 Basic composition of files
Each section of the file consists of the following parts:
Section "SectionName"
Sectionentry ...
Endsection
SectionName includes:
Files file path name
Serverflags server logo
Module dynamic module loading
InputDevice Enter Device Description
DEVICE graphics device description
VideoAdaptor XV video card description
Monitor monitor description
MODES video mode description
SCREEN screen configuration
ServerLayout comprehensive laminated
DRI DRI specific configuration
Vendor supplier specific configuration
For the purpose of downward compatibility, the following items have been abolished but the configuration file can still be identified. In a new configuration file, you should use the new InputDevice item. Keyboard keyboard Configuring the PoinPut section The old XINPUT section has been abolished.
ServerLayout is at the highest layer. The input and output devices they bind will be used in this section. The input device is described by InputDevice, and the output device typically has a plurality of independent components. Multiple components constitute a Screen section. The graphics board and monitor are bound together for each Screen section. The display card is described by the DEVICE section, and the monitor is described by the Monitor section.
6.5.2 Files Festival Files Section Specifies the font path, palette path, and module path of the X server.
FontPath "Path" sets the query path of the font. For the representation of the font server, the following form:
If this section does not specify, the default font path is:
/ USR / X11R6 / LIB / X11 / FONTS / MISC /
/ USR / X11R6 / LIB / X11 / FONTS / SPEEDO /
/ USR / X11R6 / LIB / X11 / FONTS / TYPE1 /
/ USR / X11R6 / LIB / X11 / FONTS / CID /
/ USR / X11R6 / LIB / X11 / FONTS / 75DPI /
/ USR / X11R6 / LIB / X11 / FONTS / 100DPI /
In general, the recommended font path is:
/ USR / X11R6 / LIB / X11 / FONTS / LOCAL /
/ USR / X11R6 / LIB / X11 / FONTS / MISC /
/ usr / x11r6 / lib / x11 / fonts / 75dpi /: unscaled
/ USR / X11R6 / LIB / X11 / FONTS / 100DPI /: UNSCALED
/ USR / X11R6 / LIB / X11 / FONTS / TYPE1 /
/ USR / X11R6 / LIB / X11 / FONTS / CID /
/ USR / X11R6 / LIB / X11 / FONTS / SPEEDO /
/ USR / X11R6 / LIB / X11 / FONTS / 75DPI /
/ USR / X11R6 / LIB / X11 / FONTS / 100DPI /
RGBPath "Path" RGB color database path, the default value is: / usr / x11r6 / lib / x11 / RGB. ModulePath "Path" Sets the lookup path of the loaded X server module.
6.5.3 The ServerFlags section ServerFlags section is used to specify a global X server option, in general, this part is empty.
Option "NOTRAPSIGNALS" "Boolean" This option prevents the X server from capturing unwisered deadly signals and is clean. The X server exits and erases the Core file. Option "DONTZAP" "Boolean" Once this option is opened, Ctrl Alt BackSpace can be prohibited. Option "DONTZOOM" "Boolean" Opens this option to disable the key Ctrl Alt KeyPad-Plus and Ctrl Alt KeyPad-minus to switch the video mode. Option "DisablevidModeExtension" "Boolean" can be used to disable VidMode extensions. Option "AllownonLocalxvidTune" "Boolean" opens allows XvidTune customers to connect from other hosts. Option "Disablemodindev" "Boolean" Off can disable XFree86-MISC extension (available to dynamically modify the settings of the input device). Option "AllownonLocalModindev" "Boolean" allows customers to connect another host and change the settings of the keyboard and mouse on the running server. Option "AllowMouseOpenfail" "Boolean" Allows the X server to start even if the mouse device cannot be opened / initialized. Option "vtinit" "Command" runs the command after the VT used by the server is opened. This command is transmitted to "/ bin / sh -c" to run in STDIN and STDOUT set with this VT. Option "VTSYSREQ" "Boolean" makes the non-SYSV system VT support SYSV-style switching sequence. This means that the function key (FN) is followed after ALT-SYSRQ. This prevents the X server from capturing a switching sequence key for default VT (which has enabled customers to access them). Option "BlankTime" "Time" sets the timeout time of the black screen. TIME is in minutes, default for 10 minutes. (XSET Dynamic Settings) Option "StandBytime" "time" option "suspendtime" "office" "time" sets the time to support the DPMS, which is only suitable for support VESA DPMS compatible monitors. The default time is 20 minutes. (The screen is set to have a DPMS option setting) Option "Pixmap" "BPP" Set the format of the pixel format use depth 24. Option "NOPM" "Boolean" Disable Power Management Option "xinerama" "Boolean" enabled or disable xinerama extension 6.5.4 Module section This section is used to specify the loaded X server module. This section is ignored when the X server is established in a static manner. The modules loaded in this section typically be the X server extension module and the grating font module. Most other modules are automatically loaded when needed.
Load "Modulename" For example: Type 1 Raster Font Module is loaded by the undervester:
Load "Type1"
Subsection "Modulename"
Option "ModuleOption" endsubsection
6.5.5 InputDevice Section This section is written from / etc / sysconfig / mouse and / etc / sysconfig / keyboard, and the settings of the two are required to be substantially consistent. In general, there are two input devices: one is the core keyboard, the other is the core pointer, the pointer equipment is mainly to the mouse, but it can also be other devices such as touch screens.
Section "InputDevice"
Identifier "Name"
Driver "InputDriver"
Options
...
Endsection
The most common INPUTDRIVER is "Keyboard" and "Mouse". Option "Corepointer" device is installed as a core pointer. The system must have a core pointer. Option "CoreKeyboard" is set as the core keyboard when this option is set. There is only one core keyboard in the system. Option "Alwayscore" "Boolean" option "sendcoreeeevents" "Boolean" two options are equivalent, which causes the input device to always report the core event. It can be used for additional pointer devices to generate a core event. Option "HistorySize" Number "Sets the size of the mobile history, the default is 0.
6.5.6 Device Section This section describes the information corresponding to the card, which is generally obtained from the description corresponding to the card in the CARDDB file. If this device section is referenced by the Screen section, this section is considered to be available.
Section "Device"
Identifier "Name"
Driver "driver"
entries
...
Endsection
BusID "Bus-ID" Specifies the bus position of the graphics card. For the PCI / AGP card, the bus-id string has the format of PCI: Bus: Device: Function. Xfree86 supports multiple display cards while displaying the Screen Number VideoRam MEM This option specifies the number of RAMs in the graphics card, in KB. The X service program automatically detects the display card, so this field is generally not required. Chipset "Chipset" chipset type on a graphics card. Ramdac "ramdac-type" DacSpeed speed DacSpeed speed-8 speed-16 speed-24 speed-32 ClockChip "clockchip-type" BiosBase baseaddress MemBase baseaddress IOBase baseaddress ChipID id ChipRev rev TextClockFreq freq than 10 fields, which represent some specific X Configuration parameters. It is generally not specified when configuring the X server, and the value is determined by automatic detection.
6.5.7 Monitor Section Monitor Section Describes the information of the display, at least one display section. All of its information can be read from the display when the display supports VBE and EDID extensions.
Section "Monitor"
Identifier "Name"
entries
...
Endsection
Vendorname "Vendor" manufacturer
ModelName "Model" Monitor model
HorizSync HorizSync-Range Monitor supports horizontal refresh frequency range. The unit is KHz, the default range is 28-33kHz. The vertical refresh frequency range supported by the Vertrefresh VertRefresh-Range monitor supports. The unit is Hz, the default range is 43-72 Hz.
Gamma Gamma-Valuegamma Red-Gamma Green-Gamma Blue-Gamma is used for GAMMA correction, ranges from 0.1 to 10.0, the default is 1.0. Not all drivers have the ability to use this information.
UseModes "MODESECTION-ID" includes the MODES section called the mode collection listed by MODESECTION-ID. This makes these modes available for this display.
Mode "Name" Sets the detailed definition of video mode. At the end of the EndMode keyword.
DotClock Clock Click Clock Rate in this mode.
Htimings HDISP HSYNCSTART HSYNCEND HTOTAL specifies the horizontal timing of the mode.
VTIMINGS VDISP vSyncStart vsyncend vtotal specifies the vertical timing of the mode.
Flags "flag" ... flag specified mode settings. "Interlace" setting mode is interleaved. "DoubleScan" specifies that each scan line is twice. " Hsync" and "-hsync" specifies the polarity of the HSYNC signal. " Vsync" and "-vsync" specify the polarity of the VSYNC signal. "Composite" specifies the composite synchronization signal. " Csync" and "-csync" specifies the polarity of the composite synchronous signal.
HSKEW HSKEW specifies the number of pixels
VSCAN vscan draws the number of times each scan line. "DoubleScan" double this value.
Modeline "Name" Mode-DescriptionMode item compact version. In most cases, the VESA display mode contained in the X service program is enough, you do not need to specify.
6.5.8 Screen Festival A configuration file can have multiple Screen section, but at least one. This section represents information from the display card and monitor. When it appears in ServerLayout, the information represented by this section is activated, otherwise the system selects the first SCREEN section as an active. This section describes information display resolution, default depth, and other information. It must contain at least one DISPLAY sub-festival, which provides information related to display depth.
Section "Screen"
Identifier "Name"
Device "devid"
Monitor "MONID"
entries
...
Subsection "Display"
entries
...
Endsubsection
...
Endsection
Device "Device-ID" Specifies the same for the Device section used in this section, the device-id, and the application of the Device section.
Monitor "Monitor-id" specifies the Monitor description used in this section
VideoAdaptor "XV-ID" Specifies an optional XV adapter description
DefaultDepth Depth Specifies the default display depth.
The defaultfbbpp bpp specifies the frame buffer depth used by default.
DISPLAY:
Subsection "Display"
Depth depth
entries
...
Endsubsection
DEPTH Depth Specifies the depth of this section.
FBBPP BPP Specifies the frame buffer format represented by this section.
Weight Red-weight Green-Weight Blue-Weight Specifies the weight of the three colors of RGB when 16-bit display
Virtual XDim YDIM Sets the size of the logic virtual screen, XDIM generally requires an integer multiple of 8 or 16. Note: Some drivers are not allowed to set up virtual screens.
ViewPort X0 Y0 Sets the left upper left corner of the initial display.
MODES "Mode-Name" ... Set the video mode list under this depth. Nothing specified must be enclosed by a double quotation. This must correspond to the information specified by the Monitor section, that is, the scan frequency range specified by the Monitor section must contain the corresponding mode.
Visual "Visual-name" Visual-Name is available in StaticGray Grayscale StaticColor Pseudocolor Truecolor DirectColor
Black Red Green Blue
White Red Green Blue can specify black and white colors
6.5.9 ServerLayout Section Each configuration file can have multiple ServerLayout section, a serverLayout represents a combination of multiple Screen and one or more input devices (InputDevice section).
Section "ServerLayout"
Identifier "Name"
Screen "screen-id"
...
InputDevice "Idev-ID"
...
Options
...
Endsection
Screen Screen-Num "Screen-id" Position-Information
Screen-id is mandatory, specifying the reference Screen section InputDevice "IDEV-ID" "Option" ... IDEV-ID is also mandatory, specifying the referenced InputDevice section, can specify multiple options, between them Open, these options are also supported by the InputDevice section, including: "Corepointer", "Corekeyboard", "SendCoreeeevents".
For example, specify two mouse:
Section "ServerLayout"
Identifier "Layout 1"
Screen "MGA 1"
Screen "MGA 2" Rightof "MGA 1"
InputDevice "Keyboard 1" "CorekeyBoard"
InputDevice "Mouse 1" "Corepointer"
InputDevice "Mouse 2" "Sendcoreeevents"
Option "BlankTime" "5"
Endsection
The author briefly in Chen Chen Tao, Lenovo (Beijing) computer company software engineer. At present, mainly engaged in the development of Linux system installations. The main research interest is the working mechanism of the operating system and the development of the underlying system. You can contact him by email SCU_YCT@263.net.