[Techtalk] anyone feel like testing a X multihead howto?

Carla Schroder carla at bratgrrl.com
Wed Jul 7 15:03:08 EST 2004


Hi homies,

I'm working up a little multi-heading under X howto, anyone care to 
torture-test it? 


Problem
You would like to connect two monitors to a single system. You would like to 
have a single desktop span both monitors, or have two separate desktops, and  
maybe run different screen resolutions on each monitor.

Solution
XFree86 does it all. You'll need either two video cards, or a single dual-head 
card, installed and working. Plus two monitors, and XFree86 version 4.x:
$ X -version
XFree86 Version 4.3.0...
You should configure your system to boot to a text console, so you can start X 
in whatever mode you want. You'll have four modes to choose from:

Traditional
Two different desktops, that can have different resolutions and color depths

Xinerama
A single desktop spans across all screens, which must have the same resolution 
and color depth

Clone
Two displays, mirrored

Single
Use only one monitor

First, back up your current XF86Config, then open it for editing. The PCI bus 
ID must be added to the Device entries:
Section "Device"
    Identifier  "3dfx"
    Driver      "tdfx"
    BusID       "PCI:1:0:0"
EndSection
...
Section "Device"
    Identifier  "nVidia"
    Driver      "nv"
    BusID       "PCI:0:12:0"
EndSection
This information comes from lscpi:
$ lspci
...
0000:00:12:0 VGA compatible controller: nVidia Corporation NV5M64 [RIVA TNT 
Model 64/Model 64 Pro](rev 15)
0000:01:00.0 VGA compatible controller: 3Dfx Interactive, Inc. Voodoo 3 (rev 
01)
Next, create a ServerLayout section. This example activates Xinerama at 
startup:
Section "ServerLayout"
  Identifier     "Xinerama"
  InputDevice    "Default Keyboard0"      "CoreKeyboard"
  InputDevice    "Default Mouse0"         "CorePointer"
  Option         "Clone"         "off"
  Option         "Xinerama"      "on"
#Other screen position options are Below, Above, and LeftOf
  Screen         "Screen0" RightOf "Screen1"
  Screen         "Screen1"
EndSection

To start X, boot to a text console, and run

$ startx

And it will start up in full-color Xinerama.

Discussion
To start up in Traditional mode, set both Clone and Xinerama to "off", and 
change the Identifier to "Traditional."
To set Clone mode, turn Xinerama off, and Clone on, and change the Identifier 
to "Clone."

Many video adapters are not capable of handling 3D acceleration in multihead 
mode, check your documentation to find out.

PCI bus numbers that start with 0 are PCI cards. AGP cards start with 1.
Sometimes two video cards conflict, and simply won't work together. First run 
each card individually, to verify that they work. Then try moving the PCI 
card to a different slot. If that does not cure the conflict, you'll have to 
try different cards.

See Also
XF86Config (5x) for a complete description of all the available configuration 
options.

 Choosing Different ServerLayouts At Startup

Problem
You don't want to be locked into the same old thing every time you start X. 
Maybe you want Xinerama. Maybe you want Traditional. Maybe you want to run a 
single monitor on occasion, and you want to be able to select either one.

Solution
Configure different ServerLayouts in XF86Config, then select the one you want 
with startx options:
$ startx -- -layout Single0
$ startx -- -layout Single1
$ startx -- -layout Clone
$ startx -- -layout Traditional

This layout starts a single monitor:
Section "ServerLayout"
  Identifier    "Single0"
  InputDevice   "Default Keyboard0"    "CoreKeyboard"
  InputDevice   "Default Mouse0"       "CorePointer"
  Screen        "Screen0"
EndSection

Start this layout like this:

$ startx -- -layout Single0

Now add a second Single layout, so that you can select either monitor at 
startup:

Section "ServerLayout"
  Identifier     "Single1"
  InputDevice    "Default Keyboard0"    "CoreKeyboard"
  InputDevice    "Default Mouse0"       "CorePointer"
  Screen         "Screen1"
EndSection

Start this layout like this:

$ startx -- -layout Single0

You can also create ServerLayouts for each of your multi-head modes. This 
example starts Clone mode:

Section "ServerLayout"
  Identifier   "Clone"
  InputDevice  "Default Keyboard0" "CoreKeyboard"
  InputDevice  "Default Mouse0" "CorePointer"
  Option       "Clone" "on"
  Option       "Xinerama"off"
#Other screen position options are Below, Above, and LeftOf
  Screen       "Screen0" RightOf "Screen1"
  Screen       "Screen1"
EndSection

This example starts Traditional mode:

Section "ServerLayout"
  Identifier   "Traditional"
  InputDevice  "Default Keyboard0" "CoreKeyboard"
  InputDevice  "Default Mouse0" "CorePointer"
  Option       "Clone" "off"
  Option       "Xinerama"off"
#Other screen position options are Below, Above, and LeftOf
  Screen       "Screen0" RightOf "Screen "
  Screen       "Screen1"
EndSection


Discussion
Here is a sample XFree86Config, showing all the required elements, and two 
ServerLayouts.

The core elements are the Input Device, Device, and Monitor sections. These 
are the sections where your devices are identified and linked to their 
drivers. The Screen section sets resolution and color depth. In the 
ServerLayout sections, you put the pieces together for your various modes by 
their Identifiers.
Section "Files"
    FontPath      "unix/:7100"
    FontPath      "/usr/lib/X11/fonts/misc"
    FontPath      "/usr/lib/X11/fonts/cyrillic"
    FontPath      "/usr/lib/X11/fonts/75dpi"
EndSection

Section "ServerFlags"
  Option   "DefaultServerLayout"  "Xinerama"
EndSection

Section "Module"
    Load   "ddc"
    Load   "GLcore"
    Load   "dbe"
    Load   "dri"
    Load   "extmod"
    Load   "glx"
    Load   "record"
    Load   "bitmap"
    Load   "speedo"
EndSection

Section "InputDevice"
    Identifier    "Default Keyboard0"
    Driver        "keyboard"
    Option        "CoreKeyboard"
    Option"        XkbRules"          "xfree86"
    Option        "XkbModel"          "pc104"
    Option        "XkbLayout"         "us"
    EndSection

Section "InputDevice"
    Identifier     "Default Mouse0"
    Driver         "mouse"
    Option         "CorePointer"
    Option         "Device"             "/dev/input/mice"
    Option         "Protocol""IMPS/2"
    Option"         Emulate3Buttons"     "true"
    Option         "ZAxisMapping"        "4 5"
EndSection

Section "Device"
    Identifier  "3dfx"
    Driver      "tdfx"
    BusID       "PCI:1:0:0"
EndSection

Section "Device"
    Identifier  "nVidia"
    Driver      "nv"
    BusID       "PCI:0:12:0"
EndSection

Section "Monitor"
    VendorName           "0195"
    ModelName            "SYL"
    Identifier           "Monitor0"
    HorizSync             30-70
    VertRefresh           0-160
    Option               "DPMS"
EndSection

Section "Monitor"
    VendorName           "0195"
    ModelName            "SYL"
    Identifier           "Monitor1"
    HorizSync             30-70
    VertRefresh           0-160
    Option               "DPMS"
EndSection

Section "Screen"
    Identifier      "Screen0"
    Device          "3dfx"
    Monitor         "Monitor0"
    DefaultDepth     24
    SubSection "Display"
         Depth    24
         Modes   "1024x768"
    EndSubSection
EndSection

Section "Screen"
    Identifier      "Screen1"
    Device          "nVidia"
    Monitor         "Monitor1"
    DefaultDepth     24
    SubSection "Display"
         Depth    24
         Modes   "1024x768"
    EndSubSection
EndSection

Section "ServerLayout"
  Identifier     "Xinerama"
  InputDevice    "Default Keyboard0"      "CoreKeyboard"
  InputDevice    "Default Mouse0"         "CorePointer"
  Option         "Clone"         "off"
  Option         "Xinerama"      "on"
#Other screen position options are Below, Above, and LeftOf
  Screen         "Screen0" RightOf "Screen1"
  Screen         "Screen1"
EndSection

Section "ServerLayout"
  Identifier    "Single0"
  InputDevice   "Default Keyboard0"    "CoreKeyboard"
  InputDevice   "Default Mouse0"       "CorePointer"
  Screen        "Screen0"
EndSection

See Also
XF86Config (5x) for a complete description of all the available configuration 
options.

 Setting A Default ServerLayout

Problem
You like having all those X startup options. But you also want a default, so 
you don't have to be bothered with selecting one every time
.
Solution
Create a ServerFlags section to set the default. This must come before the 
ServerLayout entries:

Section "ServerFlags"
  Option     "DefaultServerLayout"  "Xinerama"
EndSection

Then simply use

$ startx

to start an X session.
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder
this message brought to you
by Libranet 2.8 and Kmail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Techtalk mailing list