Dual-monitor configuration using X.Org, RandR, UXA and KMS
(Last updated: 2009-06-11)
Disclaimer
The information below is accurate to my knowledge, however I provide no guarantees to this effect and consequently accept no liability whatsoever for any bad things that may happen as a result of the reader using this information in practice. Use at your own risk.
Be sure to backup any configuration files before you edit them.
Introduction
This is a short article on configuring Xserver to extend the desktop across 2 monitors. In addition, enabling KMS and UXA when using using the Intel graphics chipset is also mentioned.
System Specification
For the purposes of this article it is assumed that the target system has the following:
- A Linux kernel version 2.6.29-2, or later (tested using a Debian kernel) — use
"uname -a"to confirm. - An Intel-based graphics card (tested on Q965 chipset) — use
"lspci"to confirm. - Intel drivers version 2.7, or later — use
"grep -A2 intel_drv /var/log/Xorg.0.log"to confirm.
Enabling Kernel mode-setting (optional)
For more information on Kernel mode-setting (KMS) look here and here. At the time of writing, the notes that come with the Intel driver recommend this is enabled.
The following instruction come from the Debian Wiki.
Important note: please check the above page for any known issues. For example, setting the "vga" kernel option on boot is likely to result in problems.
First, (as root) edit the /etc/initramfs-tools/modules file and add:
# Enable Kernel Modesetting
intel_agp
drm
i915 modeset=1
Then, (as root) re-generate you initramfs image:
update-initramfs -k `uname -r` -u
Finally, reboot the system to enable KMS.
Configuring Xserver to use UXA
For more information on the UXA architecture look here. At the time of writing, the notes that come with the Intel driver recommend this is used. On my system, switching to UXA resulted in a noticeable performance improvement.
UXA notes suggest that if KMS is loaded, UXA is enable by default. The instructions below are provided for completeness.
UXA can be enabled in the "Device" section of your /etc/X11/xorg.conf file:
Section "Device"
...
Option "AccelMethod" "UXA"
EndSection
Restart Xserver to load the new configuration.
Manipulating the workspace using RandR
The following steps are performed while in your Xserver session, with normal user privileges, using "xrandr" (available in the x11-xserver-utils Debian package).
First, find out the names of your monitors:
user@host:~$ xrandr -q
Screen 0: minimum 320 x 200, current 2560 x 1024, maximum 8192 x 8192
VGA1 connected 1280x1024+1280+0 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.0*+ 75.0
1024x768 75.1 60.0
...
DVI1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.0*+ 75.0
1024x768 75.1 60.0
...
Then, define your monitor arrangement to achieve desired effect. For example:
xrandr --output VGA1 --right-of DVI1
Configure Xserver to use your desired XranR arrangement
The following Xserver configuration will reproduce the effect of the Xrandr command above:
Section "Device"
Identifier "Configured Video Device"
Option "Monitor-DVI1" "Monitor 1"
Option "Monitor-VGA1" "Monitor 2"
Option "AccelMethod" "UXA"
EndSection
Section "Monitor"
Identifier "Monitor 1"
EndSection
Section "Monitor"
Identifier "Monitor 2"
Option "RightOf" "Monitor 1"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
# For 2 monitors both using 1280x1024 resolution
Virtual 2560 1024
EndSubSection
EndSection
Restart Xserver to load the new configuration.
Conclusion
Hopefully at the end of this you will have a working dual-monitor configuration. As always, constructive comments, or criticisms are welcome.