Êíèãà: Fedora™ Unleashed, 2008 edition

Elements of the xorg.conf File

Elements of the xorg.conf File

The most important file for Xorg is the xorg.conf configuration file, which can be located in the /etc/X11 directory. This file contains configuration information that is vital for X to function correctly, and is usually created during the installation of Fedora. Should you need to change anything post-install, you should use the system-config-display application, which is covered later in this chapter. Information relating to hardware, monitors, graphics cards, and input devices is stored in the xorg.conf file, so be careful if you decide to tinker with it in a text editor!

Of course, we would not send you in blindly to edit such an important file. Let's take a look at the contents of the file so that you can get an idea of what X is looking for. The components, or sections, of the xorg.conf file specify the X session or server layout, along with pathnames for files that are used by the server, any options relating directly to the server, any optional support modules needed, information relating to the mouse and keyboard attached to the system, the graphics card installed, the monitor in use, and of course the resolution and color depth that Fedora uses. Of the 12 sections of the file, these are the essential components:

ServerLayout — Defines the display, defines one or more screen layouts, and names input devices.

Files — Defines the location of colors, fonts, or port number of the font server.

Module — Tells the X server what graphics display support code modules to load.

InputDevice — Defines the input devices, such as the keyboard and mouse; multiple devices can be used.

Monitor — Defines the capabilities of any attached display; multiple monitors can be used.

Device — Defines one or more graphics cards and specifies what optional features (if any) to enable or disable.

Screen — Defines one or more resolutions, color depths, perhaps a default color depth, and other settings.

The following sections provide short descriptions of these elements; the xorg.conf man page contains full documentation of all the options and other keywords you can use to customize your desktop settings.

The ServerLayout Section

As noted previously, the ServerLayout section of the xorg.conf file defines the display and screen layouts, and it names the input devices. A typical ServerLayout section from an automatically configured xorg.conf file might look like this:

Section "ServerLayout"
 Identifier "single head configuration"
 Screen 0 "Screen0" 0 0
 InputDevice "Mouse0" "CorePointer"
 InputDevice "Keyboard0" "CoreKeyboard"
 InputDevice "DevInputMice" "AlwaysCore"
EndSection

In this example, a single display is used (the numbers designate the position of a screen), and two default input devices, Mouse0 and Keyboard0, are used for the session.

The Files Section

The Files section of the xorg.conf file might look like this:

Section "Files"
 RgbPath "/usr/lib/X11/rgb"
 FontPath "unix/:7100"
EndSection

This section lists available session colors (by name, in the text file rgb.txt) and the port number to the X font server. The font server, xfs, is started at boot time and does not require an active X session. If a font server is not used, the FontPath entry could instead list each font directory under the /usr/lib/X11/fonts directory, as in this example:

FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/75dpi"
FontPath "/usr/lib/X11/fonts/type1"
FontPath "/usr/lib/X11/fonts/Speedo"
...

These directories contain the default compressed fonts that are available for use during the X session. You configure the font server by using the file named config under the /etc/X11/fs directory. This file contains a listing, or catalog, of fonts for use by the font server. By adding an alternate-server entry in this file and restarting the font server, you can specify remote font servers for use during X sessions. This can help centralize font support and reduce local storage requirements (even though only 25MB is required for the almost 5,000 fonts installed with Fedora and X).

The Module Section

The Module section of the xorg.conf file specifies loadable modules or drivers to load for the X session. This section might look like this:

Section "Module"
 Load "dbe"
 Load "extmod"
 Load "fbdevhw"
 Load "glx"
 Load "record"
 Load "freetype"
 Load "type1"
 Load "dri"
EndSection

These modules can range from special video card support to font rasterizers. The modules are located in subdirectories under the /usr/lib/modules directory.

The InputDevice Section

The InputDevice section configures a specific device, such as a keyboard or mouse, as in this example:

Section "InputDevice"
 Identifier "Keyboard0"
 Driver "kbd"
 Option "XkbModel" "pc105"
 Option "XkbLayout" "us"
EndSection
Section "InputDevice"
 Identifier "Mouse0" Driver   "mouse"
 Option "Protocol" "IMPS/2"
 Option "Device" "/dev/input/mice"
 Option "ZAxisMapping" "4 5"
 Option "Emulate3Buttons" "yes"
EndSection

You can configure multiple devices, and there might be multiple InputDevice sections. The preceding example specifies a basic keyboard and a two-button PS/2 mouse (actually, a Dell touchpad pointer). An InputDevice section that specifies use of a USB device could be used at the same time (to enable mousing with PS/2 and USB pointers) and might look like this:

Section "InputDevice"
 Identifier "Mouse0"
 Driver "mouse"
 Option "Device" "/dev/input/mice"
 Option "Protocol" "IMPS/2"
 Option "Emulate3Buttons" "off"
 Option "ZAxisMapping" "4 5"
EndSection

NOTE

If you change your computer's pointing device, you should then run Fedora's system-config-mouse client, which automatically updates your system's xorg.conf file.

CAUTION

From Fedora Core 3 onward, the location for the mouse device changed from /dev/mouse to /dev/input/mice. Unfortunately, when system-config-display writes the xorg.conf file, it sometimes gets a little confused and still maps the mouse to /dev/mouse rather than /dev/input/mice. This is where a little knowledge of vi comes in handy!

The Monitor Section

The Monitor section configures the designated display device as declared in the ServerLayout section, as shown in this example:

Section "Monitor"
 Identifier "Monitor0"
 VendorName "Monitor Vendor"
 ModelName "Monitor Model"
 DisplaySize 300 220
 HorizSync 31.5-48.5
 VertRefresh 50-70
 Option "dpms"
EndSection

Note that the X server automatically determines the best video timings according to the horizontal and vertical sync and refresh values in this section. If required, old-style mode- line entries (used by distributions and servers prior to XFree86 4.0) might still be used. If the monitor is automatically detected when you configure X (see the "Configuring X" section later in this chapter), its definition and capabilities are inserted in your xorg.conf file from the MonitorsDB database. This database contains more than 600 monitors and is located in the /usr/share/hwdata directory.

The Device Section

The Device section provides details about the video graphics chipset used by the computer, as in this example:

Section "Device"
 Identifier "Videocard0"
 Driver     "radeon"
 VendorName "Videocard vendor"
 BoardName  "ATI Radeon Mobility M6"
EndSection

This example identifies an installed video card as using an ATI Mobility M6 graphics chipset. The Driver entry tells the Xorg server to load the radeon_drv.o module from the /usr/lib/modules/drivers directory. Different chipsets have different options. For example, here's the entry for a NeoMagic video chipset:

Section "Device"
 Identifier "NeoMagic (laptop/notebook)"
 Driver "neomagic"
 VendorName "NeoMagic (laptop/notebook)"
 BoardName "NeoMagic (laptop/notebook)"
 Option "externDisp"
 Option "internDisp"
EndSection

In this example, the Device section specifies the driver for the graphics card (neomagic_drv.o) and enables two chipset options (externDisp and internDisp) to allow display on the laptop's LCD screen and an attached monitor.

The Xorg server supports hundreds of different video chipsets. If you configure X11 but subsequently change the installed video card, you need to edit the existing Device section or generate a new xorg.conf file, using one of the X configuration tools discussed in this chapter, to reflect the new card's capabilities. You can find details about options for some chipsets in a companion man page. You should look at these sources for hints about optimizations and troubleshooting.

The Screen Section

The Screen section ties together the information from the previous sections (using the Screen0, Device, and Monitor Identifier entries). It can also specify one or more color depths and resolutions for the session. Here's an example:

Section "Screen"
 Identifier "Screen0"
 Device "Videocard0"
 Monitor "Monitor0" DefaultDepth 24
 SubSection "Display"
  Viewport 0 0 Depth 16
  Modes "1024x768" "800x600" "640x480"
 EndSubSection
EndSection

In this example, a color depth of thousands of colors and a resolution of 1024?768 is the default, with optional resolutions of 800?600 and 640?480. Multiple Display subsection entries with different color depths and resolutions (with settings such as Depth 24 for millions of colors) can be used if supported by the graphics card and monitor combination. You can also use a DefaultDepth entry (which is 24, or thousands of colors, in the example), along with a specific color depth to standardize display depths in installations

You can also specify a desktop resolution larger than that supported by the hardware in your monitor or notebook display. This setting is known as a virtual resolution in the Display subsection. This allows, for example, an 800?600 display to pan (that is, slide around inside) a virtual window of 1024?768.

NOTE

If your monitor and graphics card support multiple resolutions and the settings are properly configured, you can use the key combination of Ctrl+Alt+Keypad+ or Ctrl+Alt+Keypad to change resolutions on-the-fly during your X session.

Îãëàâëåíèå êíèãè

Îãëàâëåíèå ñòàòüè/êíèãè

Ãåíåðàöèÿ: 1.238. Çàïðîñîâ Ê ÁÄ/Cache: 3 / 1
ïîäåëèòüñÿ
Ââåðõ Âíèç