Dual Monitor setup for Linux

Prerequisites

In all likelihood, you are probably using either two PCI graphics cards or one AGP card and one PCI card. Either way, it is quite quick and easy to make a new xorg.conf or XF86Config for your new cards.

First, of course, make sure you are using a recent version of X for best results. I’m using X.org 6.7.0, and I’ve also had this working with XFree86 4.3.x. XFree86 4.2.x should also work, but I wouldn’t recommend anything older than that.

Now backup your existing X configuration – things could go wrong, or you might need it for reference later.

Disable X from starting at boot (rc-update del xdm default), shut down your computer, insert both graphics cards, and boot the computer back up again. The screen that your bios information shows up on is your “primary” monitor. If this is the wrong one, and you are using an AGP and a PCI graphics card, there should be an option in your BIOS that lets you choose which one to use.

  • In AWARD BIOS (v4.51PG), menu: Integrated Peripherals -> Init Display First -> [PCI Slot / AGP]
  • In AMIBIOS (v 08.00.08), menu: PCIPnP -> PCI Bus Scan Order -> [Ascent/Descent]
  • In other BIOSs it’s called: Bios First Boot -> [AGP/PCI]

Configuring X

In most cases, it is simplest to let X do as much auto-configuring as possible.
It can usually detect your graphics cards, at least.

As root run,

Code: X Auto-Configuration
X -configure

This will make your screen blink a few times, before returning with a message saying that it has created a test X configuration file at /root/XF86Config.new or /root/xorg.conf.new and giving the command line to test the X server using this config file.

With a bit of good luck, this should be a working X configuration.
You may have to edit the mouse, monitor, or resolution settings. This is done in the same way as with a single-monitor setup, but there will be two “Monitor” sections, two “Device” sections, and two “Screen” sections.
The “Screen” sections connect a monitor to a graphics card.

It is probably a good idea to change the Identifiers of the device and monitor sections so you can tell them apart, e.g.

File: /etc/X11/xorg.conf or /etc/X11/XF86Config
...
Section "Monitor"
  Identifier   "NECMonitor"
...
Section "Monitor"
  Identifier   "VSMonitor"
...
Section "Device"
  Identifier  "NvidiaCard"
  Driver      "nvidia"
...
Section "Device"
  Identifier  "AtiCard"
  Driver      "ati"
...
Section "Screen"
  Identifier   "LeftScreen"
  Device       "NvidiaCard"
  Monitor      "NecMonitor"
  DefaultDepth 24
...
Section "Screen"
  Identifier   "RightScreen"
  Device       "AtiCard"
  Monitor      "VSMonitor"
  DefaultDepth 24

At the top of the file, there is a section called “ServerLayout”.
This section specifies the layout of your monitors.
In my configuration, I have two monitors beside each-other–”RightScreen” is to the right of “LeftScreen”.

The layout can be specified using keywords or absolute pixel positions (useful for odd layouts, or even overlapping layouts!?)
E.g.

File: /etc/X11/xorg.conf or /etc/X11/XF86Config
Section "ServerLayout"
  Identifier     "XFree86 Configured"
  Screen      0  "LeftScreen" 0 0
  Screen      1  "RightScreen" RightOf "LeftScreen"

“LeftScreen” is located at position 0,0.
I then have “RightScreen” to the right of it.

The useable keywords are “RightOf <identifier>”, “LeftOf <identifier>”, “Above <identifier>”, and “Below <identifier>”.
A special keyword is “Relative” – it is used to specify the position in pixels of a screen in relation to another screen.
E.G.

File: /etc/X11/xorg.conf or /etc/X11/XF86Config
  Screen      0  "LeftScreen" 0 0
  Screen      1  "RightScreen" Relative "LeftScreen" 1024 40

In most cases, the LeftOf and RightOf keywords are what you want.

So, try starting the xserver using your test configuration file again.
Verify that the mouse can move from screen-to-screen in a relatively intuitive manner, and that your resolution and refresh rate is right.
You can then copy your configuration file overtop of your old /etc/X11/XF86Config or /etc/X11/xorg.conf.

Wow. It's Quiet Here...

Be the first to start the conversation!

Leave a Reply

Gravatar Image