Get To Know Linux: Understanding xorg.conf

Jack Wallen
Feb 4, 2009
Updated • Nov 28, 2012
Linux
|
10

For most Linux users the xorg.conf file is one of those files that makes many Linux users cringe with fear upon the threat of having to configure. There is a reason for that, it's complex. But when you have an understanding of the pieces that make up the whole puzzle, configuring X Windows becomes much, much easier.

But now the Linux community has distributions, such as Fedora 10, that do not default to using  an xorg.conf file. This is great news for many users. However, it's bad news when, for some reason, X isn't working or you have specific needs that the default isn't meeting. With that in mind we're going to break down the xorg.conf file so that you will be able to troubleshoot your X Windows configuration when something is wrong.

The Basics

The first thing you need to know is that xorg.conf (located typically in /etc/X11) is broken up into sections. Each section starts with the tag Section and ends with the tag EndSection. Each section can be broken into subsections as well. A subsections starts with the tag SubSection and ends with the tag EndSubSection. So a typical section with subsections contains the tags:
Section Name
Section Information
SubSection Name
SubSection information
EndSubSection
EndSection

Of course you can't just use random sections. There are specific sections to use. Those sections are:

  • Files - pathnames for files such as fontpath
  • ServerFlags - global Xorg server options
  • Module - which modules to load
  • InputDevice - keyboard and pointer (mouse)
  • Device - video card description/information
  • Monitor - display device description
  • Modes - define video modes outside of Monitor section
  • Screen - binds a video adapter to a monitor
  • ServerLayout - binds one or more screens with one or more input devices
  • DRI - optional direct rendering infrastructure information
  • Vendor - vendor specific information

Each section will have different information/options and is set up:

Option Variable

Let's take a look at a sample section. We'll examine a Device section from a laptop. The section looks like:

Section "Device"
Identifier "device1"
VendorName "VIA Technologies, Inc."
BoardName "VIA Chrome9-based cards"
Driver "openchrome"
Option "DPMS"
Option "SWcursor"
Option "VBERestore" "true"
EndSection

The above section configures a Via Chrome video card (often a tricky one to get running) using the openchrome driver. Here's how this section breaks down:

  • The identifier (labled "device1") connects this section to Screen section with the Device "device1" option.
  • The VendorName and BoardName both come from the make and model of the video adapter.
  • The Driver is the driver the video card will use.
  • Option "DPMS" - this enables the Display Power Management System.
  • Option "SWcursor" - this enables the cursor to be drawn by software (as opposed to the HWcursor drawing by hard ware).
  • Option "VBERestore" "true" - allows a laptop screen to restore from suspend or hibernate.

The lengthiest section of your xorg.conf file will most likely be your Screen section. This section will contain all of the subsections that contain the modes (resolutions) for your monitor. This section will start off like this:

Section "Screen"
Identifier "screen1"
Device "device1"
Monitor "monitor1"
DefaultColorDepth 24

Notice how the above section references both a device and a monitor. These will refer to other sections in the xorg.conf file. This section also contains the DefaultColorDepth which will define the default color depth for your machine. In the case above the default is 24. Now, take a look below at the SubSections of this section:

Subsection "Display"
Depth 8
Modes "1440x900" "1280x800"
EndSubsection
Subsection "Display"
Depth 15
Modes "1440x900" "1280x800"
EndSubsection
Subsection "Display"
Depth 16
Modes "1440x900" "1280x800"
EndSubsection
Subsection "Display"
Depth 24
Modes "1440x900" "1280x800"
EndSubsection
EndSection

As you can see there is a SubSection for four different color depths. Included in those subsections is the default 24. So when X reads the DefaultColorDepth option it will automatically attempt to set the modes configured in the Depth 24 subsection. Also notice that each subsection contains two resolutions. X will attempt to set the first resolution (in the case above our first default is 1440x900) and move on to the next if it can not set the first. Most likely X will be able to set the first.

Final Thoughts

This is only meant to be an introduction to the xorg.conf configuration file. As you might guess, xorg.conf, can get fairly complex. Add to the complexity numerous options available for each section and you have a valid case to make sure you RTFM (read the fine man page.) And the man page is an outstanding resource to find information on all of the available options. To read the man page issue the command man xorg.conf from the command line.

By having a solid understanding of the xorg.conf file you won't have any problems fixing a fubar'd X installation or tweaking your xorg.conf file to get the most from your new video card.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. O8h7w said on February 15, 2015 at 10:06 pm
    Reply

    Ehm, this is probably the least informative article I’ve read all day. The structure of the file is apparent by just looking at it. The problem is what does it all mean and what does it all do?

  2. Saurabh said on February 5, 2009 at 8:32 pm
    Reply

    How do I revert to the vesa driver on linux mint?
    I have a sis video card and haven’t been able to get a public driver up and running.

  3. Dotan Cohen said on February 5, 2009 at 6:38 pm
    Reply

    Thanks for the info. Although it has been a long time since I’ve had to play with an xorg .conf file, it is still nice to know what the parts are. I’ve never seen it explained in such a clear manner before. Along with the fstab page, I hope that you keep these posts up!

  4. Mark Sanborn said on February 5, 2009 at 8:37 am
    Reply

    Dude awesome article X is always a pain to setup manually, this helps.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.