X.Org

Prerequisites
Before installing X.Org you have to configure a few important variables, namely VIDEO_CARDS and INPUT_DEVICES. These are alias for the -* and -* packages and, in the case of the package, acts as "pull in" USE flags. So setting these variables is a good idea as it will make the emerge include your drivers.

See the Input drivers and Graphics drivers articles before continuing.

USE Flags
Make sure the USE flag is enabled. It's also a good idea to enable the USE flag and leave the  USE flag disabled as you most likely want to have DRI enabled as it provides accelerated graphics. Note that your X11 graphics driver (-*) might also carry this USE flag so enable it there as well and/or globally in.


 * - Build with debug information.
 * - Enable Distributed Multihead X.
 * - Enable HAL support. If you intent to use Xorg <1.8, this enables autoconfiguration of input devices via . For versions above 1.8 it should be disabled.
 * - Enable IPv6 support.
 * - Build the Kdrive server. Required if you want to build Xephyr.
 * - Disable building the xorgcfg, xvfb, xnest, xtrap, record, xfree86-utils, libxf86config, dri and glx modules.
 * - Enable Native POSIX threads.
 * - Build the XSDL test application, this also needs the USE flag enabled.
 * - Enable touchscreen support through . Enable this if you intend to use ..
 * - Enable sys-fs/udev integration (device discovery, power and storage device support, etc)
 * - Build the X.Org X11 Server.

Xorg <1.8
If your Xorg version is less than 1.8, make sure you also enable the USE flag, if available, on your input devices driver(-*) if you enabled  for.

Xorg v1.8 and up
Since v.1.8, X.org can detect input devices using udev, deprecating its HAL support. For that, you must enable the USE flag. You are strongly encouraged to migrate to udev. See Xorg-server 1.8 Upgrade Guide.

Installation
It's often a good idea to run a pretend emerge and check so you have set the VIDEO_CARDS, INPUT_DEVICES and USE flags to your liking,

If all is good, emerge,

If you changed your VIDEO_CARDS or INPUT_DEVICES variable, update your world for the changes to take effect,

Many applications, including setxkbmap, will not function properly if you only emerge the xorg-server. It is often a good idea to use the xorg-x11 metapackage instead:

Configuration
Once X.Org has emerged, you might need to configure it in order to make it work. The configuration is mostly done through the file. There are automated tools available to perform the configuration for you or guide you.

Since Xorg-server v1.8, X doesn't need HAL for hardware access. Udev can detect your hardware itself. You can remove HAL from your system. Moreover, the settings that were located in the file, can be found now in the files located in the  directory.

The recommended method is to run X.Org without a configuration file by utilizing HAL/udev, evdev and dbus. HAL/udev will determine what it thinks to be the best setup for the machine it is operating on. In such case that HAL/udev doesn't get things quite right, you can specify specific options in the configuration file while leaving the rest of the options undefined. (See example.)

If you decide against utilizing evdev, HAL/udev and/or dbus, follow the steps in the next subsection.

Xorg -configure
X.Org comes with its own automated tool. To use it, run,

The tool will create the configuration under the file. You may want to test it using,

prior moving it to. Your video driver package may provide an automated tool helping you configure the video part of X.Org. (ie. for nvidia GPUs.) Refer to the proper article, so start with finding your driver in Graphics drivers.

xorgconfig
If the above tool doesn't work, you can try xorgconfig. This tool will ask you about your hardware configuration and will configure accordingly. It's often a good idea to run it in textmode just to be safe,

This tool can also be used to further tune the generated by Xorg -configure. Once configured, move your new to.

Troubleshooting
The first thing to do is to read Xorg log file:

If a problem occurs, be on the lookout for any lines beginning with (EE) which represent errors, and also (WW) which are warnings that could indicate other issues.

Second is to reinstall your input and video drivers as explained before.

Query no Synaptics: 6003C8
Your /var/log/Xorg.0.log contain this strings: (EE) Query no Synaptics: 6003C8 (EE) SynPS/2 Synaptics TouchPad Unable to query/initialize Synaptics hardware. (EE) PreInit returned 11 for "SynPS/2 Synaptics TouchPad" One of the possible reasons for occurrence of this error is double including same sections with "synaptics". It possible, if your Xorg double load same settings from any files.

If you see on tty: (==) Using config directory: "/etc/X11/xorg.conf.d" (==) Using system config directory "/usr/share/X11/xorg.conf.d" Move files on one place (/etc/X11/xorg.conf.d) and delete repeates files or sections.

Zap (Terminate Server)
For a long time, the X server had a default key binding,++, to terminate, or "zap", the server. This option was gradually removed between version 1.5 and 1.6. Refer to Gentoo's Xorg 1.6 Upgrade Guide or to Xorg-server 1.8 Upgrade Guide for the current way to get this often useful and much-demanded functionality enabled again.

The key combination for "zap" is now ++ which on my system is right alt + print screen + k.

If it still doesn't work, just keep reading Zoom.

Zoom (Video Mode Swithcing)
Another useful functionality is video mode switching or "zoom" the server. Its key binding is ++ to increase the resolution and ++ to decrease it.

With recent version of xorg-server. this key combination is not enabled by default anymore. To get back the old behaviour, we can modify /etc/xorg.conf. At the same time, we can add "zap" if needed:

If it still doesn't wotk (as example, the ati-drivers doesn't support zooming), you can follow video mode switching using xrandr.

Virtual Screen Size
When using more than one screen you will often need to adjust the size of your virtual screen size. This can be done either in /etc/X11/xorg.conf or in a /usr/share/X11/xorg.conf.d file, the latter taking advantage of autoconfiguration;

Using Xorg server without having plugged in monitor on nVidia
This may resolve your problems running Xorg without plugged monitor (servers that uses applications depending on Xorg - vnc for instance) without sacrificing acceleration by telling Xorg not to check wheter there is the monitor plugged or not.

x11 Overlay
For the very latest version of the X.Org suite, you can use the x11 overlay,

And update your system,

See Layman for further instructions.

Links

 * Official Gentoo Guide to X.Org Configuration
 * Official XFree86 keyboard configuration

X.Org X.Org X.Org