Elements of the xorgconf 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 Ubuntu. Should you need to change resolution or refresh frequency post-install, you should use the gnome-display-properties application, which we will cover 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 us 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 Ubuntu 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 (if any) features 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 "Default Layout"

Screen "Default Screen"

InputDevice "Generic Keyboard"

InputDevice "Configured Mouse"

InputDevice "stylus" "SendCoreEvents"

InputDevice "cursor" "SendCoreEvents"

InputDevice "eraser" "SendCoreEvents"


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. We also see that xorg.conf has been configured for use with a stylus (normally for use with a Tablet PC) but this can be ignored.

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/X11R6/lib/X11/fonts directory, as in this example:

Section "Files" FontPath FontPath FontPath FontPath FontPath FontPath FontPath # path to FontPath EndSection

"/usr/share/X11/fonts/misc" "/usr/share/X11/fonts/cyrillic" "/usr/share/X11/fonts/100dpi/:unscaled" "/usr/share/X11/fonts/7 5dpi/:unscaled" "/usr/share/X11/fonts/Type1" "/usr/share/X11/fonts/100dpi" "/usr/share/X11/fonts/7 5dpi" defoma fonts


These directories contain the default compressed fonts that are available for use during the X session. If you have installed it, then the xfs is configured 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 Ubuntu 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"




















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

The InputDevice Section

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

Section "InputDevice" Identifier Driver Option Option Option Option EndSection

Section "InputDevice" Identifier Driver Option Option Option Option Option EndSection

You can configure multiple devices, and there might be multiple InputDevice sections. The preceding

'Generic Keyboard" "kbd"

"CoreKeyboard" 'XkbRules" "xorg"

'XkbModel" "pc105"

"XkbLayout" "gb"

'Configured Mouse"







"/dev/input/mice" "ExplorerPS/2" "4 5" "true"

example specifies a basic keyboard and a two-button PS/2 mouse (actually, a Logitech Laser mouse).

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 "C17-5"

Option "DPMS"


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 modeline 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 director.

The Device Section

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

Section "Device"

Identifier "ATI Technologies, Inc. RV350 AR [Radeon 9600 XT]"

Driver "fglrx"

BusID "PCI:1:0:0"

Option "UseFBDev" "true"


This example identifies an installed video card as using an ATI Radeon 9600 XT (RV350) graphics chipset. The Driver entry tells the Xorg server to load the fglrx_drv.o module from the /usr/lib/xorg/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"


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 or in a README file under the /usr/lib/x11/doc directory. You should look at these sources for hints about optimizations and troubleshooting. However, this should be fairly rare as Ubuntu sports a comprehensive hardware detection system, automatically adjusting settings to take account of newly installed hardware.

The Screen Section

The Screen section ties together the information from the previous sections (using the Screeno, 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 "Default Screen"

Device "ATI Technologies, Inc. RV350 AR [Radeon 9600 XT]"

Monitor "C17-5"

DefaultDepth 24 SubSection "Display"

Depth 24

Modes "1280x1024" "1024x768" "800x600" "640x480"

EndSubSection SubSection "Display"

Depth 16

Modes "1280x1024" "1024x768" "800x600" "640x480"

EndSubSection SubSection "Display"

Depth 8

Modes "1280x1024" "1024x768" "800x600" "640x480"


In this example a color depth of millions of colors and a resolution of 1280x1024 is the default, with optional resolutions of 1024x768, 800x600, and 640x480. Multiple Display subsection entries with different color depths and resolutions (with settings such as Depth 16 for thousands 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 millions 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 800x600 display to pan (that is, slide around inside) a virtual window of 1024x768.

Was this article helpful?

0 0

Post a comment