[PLUG]Multihead How-To

Christopher N. Deckard cnd@ecn.purdue.edu
Sun, 02 Jul 2000 20:29:34 -0500


Someone asked me a few weeks to post how I got multihead working under
XFree4, and now that the newest X4 snapshot has been released, now is as
good a'time as any.

I would recommend getting the newest X4 source.  Current version is
4.0.1.  The last release came out in March, and is in my opinion very
buggy.  It works very well in single headed mode, but the xinerama stuff
just isn't the most stable thing in the world.  I have not tried this
with the newest source yet, so please be aware of that.

You will need to PCI video cards or 1 AGP and 1 PCI video card.  Note
that you can have more, though I have not tried this yet.  

Also, please refer to XFree86 documentation for frequent questions.  If
you are stuck on something, please mail PLUG and not me directly because
I may miss it otherwise.

So onto how to set up multihead under XFree4.  My video hardware
consists of 1 Diamond Viper V550 w/ 16MB RAM and 1 Matrox Mystique w/
4MB RAM.  Both are PCI cards.  The V550 is a TNT chipset and the
Mystique uses the MGA 1064SG.  

X4 has changed a lot from X3.  The configuration of the XServer is a lot
easier and the config files are even readable by humans.  The XServer
now probes the display to determine the proper settings for the monitor
so writing modelines is no longer needed.  Though, in the process of
figuring out how to get this working, I determined how modelines work.  

The config file is divided into short sections each with a specific
task.  Each input device, monitor, display adapter, and server
configuration gets a name.  What ends up happening is that you define
each of the above mentioned pieces, and then put them into some server
configuration, aka "ServerLayout".  

Here is my config file.  I will begin my comments with "#//" so you can
remove those if you want to when you go to use this.  Most sections are
pretty self explanatory.  I will comment where I tweaked the config
file.  Note that I did write this by hand following the documentation at
http://www.xfree86.org/4.0.1/XF86Config.5.html


<BEGIN CONFIG FILE>
# **********************************************************************
# Refer to the XF86Config(4/5) man page for details about the format of
# this file.
# **********************************************************************

Section "Files"

    RgbPath "/usr/X11R6/lib/X11/rgb"
    FontPath   "unix/:-1"

EndSection

# **********************************************************************
# Server flags section.
# **********************************************************************

Section "ServerFlags"

    # This  allows  the  server  to start up even if the
    # mouse device can't be opened/initialised.
    AllowMouseOpenFail

EndSection

# **********************************************************************
# Input devices
# **********************************************************************

# **********************************************************************
# Keyboard section
# **********************************************************************

Section "InputDevice"

    Identifier "Keyboard1"
    Driver      "Keyboard"
    Option "AutoRepeat"  "250 30"

    Option "XkbRules" "xfree86"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "us"

EndSection

# **********************************************************************
# Pointer section
# **********************************************************************

#// If your mouse doesn't have a rollyball thingy, then you'll 
#// probably want to use the Emulate3Buttons stuff.
#// ZAxisMapping is to get the up/down movement of the rollyball
#// to work.  This allows it to work under Gnome apps.
Section "InputDevice"

    Identifier "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/psaux"
#    Option "Emulate3Buttons"
#    Option "Emulate3Timeout"    "50"
    Option  "Buttons"   "5"
    Option  "ZAxisMapping"  "4 5"

EndSection

Section "Module"

#// Here is where you load all the little modules that go with it.
#// If you want 3d hardward acceleartion you need to include 
#// the glx module.  Note that I have not tried this yet with
#// the NVidia released stuff.
# This loads the DBE extension module.

    Load    "dri"
    Load    "GLcore"
    Load    "type1"
    Load    "freetype"
    Load    "glx"
    Load    "extmod"
    Load    "dbe"
    Load    "xie"
    Load    "record"

EndSection

# **********************************************************************
# Monitor section
# **********************************************************************

# Any number of monitor sections may be present

Section "Monitor"
    Identifier "Vivitron"
    VendorName "Gateway"
    ModelName  "Vivitron 17"

	#// I had to set HorizSync and VertRefresh in order for
	#// it to work correctly.  I couldn't get out of 640x480
	#// unless I set these.  I think these should work for 
	#// most people, but use the correct ones for your monitor
    HorizSync  31.5-64.3
    VertRefresh 50-90
EndSection

Section "Monitor"
    Identifier  "MAG15"
    VendorName  "MAG Innovision"
    ModelName   "MAG 15"

    HorizSync   31.5-64.3
    VertRefresh 50-90
EndSection

# **********************************************************************
# Graphics device section
# **********************************************************************

#// Here is where I had problems!!!
#// You MUST set the VideoRam for each of your graphics
#// adapters in order to get multihead to work correctly.
#// X with initialize both adapters, but will not track the
#// cursor on the second unless you have VideoRam set.

Section "Device"
    Identifier  "NVidiaTNT"
    Driver      "nv"
    VendorName  "NVidia"
    BoardName   "Riva TNT"
    BusID       "PCI:0:17:0"
    VideoRam    16384
    # Uncomment following option if you see a big white block
    # instead of the cursor!
    #Option "sw_cursor"

    Option      "power_saver"
EndSection

Section "Device"
    Identifier  "MatroxMystique"
    Driver      "mga"
    VendorName  "Matrox"
    BoardName   "MGA 1064SG"
    BusID       "PCI:0:15:0"
    VideoRam    4096

    Option      "power_save"
EndSection                  

# **********************************************************************
# Screen sections
# **********************************************************************

#// In the Modes section, just select the different resolutions
#// that you want to be able to use or switch to when using
#// CTRL ALT +/-
#// The first is the default resolution

Section "Screen"
    Identifier  "TNT"
    Device      "NVidiaTNT"
    Monitor     "Vivitron"
    DefaultColorDepth 16
    Subsection "Display"
        Depth       8
        Modes       "1280x1024" "1024x768" "800x600" "640x400"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       32
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
EndSection

Section "Screen"
    Identifier  "MGA"
    Device      "MatroxMystique"
    Monitor     "MAG15"
    DefaultColorDepth 16
    Subsection "Display"
        Depth       8
        Modes       "1280x1024" "1024x768" "800x600" "640x400"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       16
        Modes       "1280x1024" "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       24
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
    Subsection "Display"
        Depth       32
        Modes       "1024x768" "800x600" "640x480"
        ViewPort    0 0
    EndSubsection
EndSection                                                  

# **********************************************************************
# ServerLayout sections
# **********************************************************************

#// Here is where you set up the server and position the monitors
#// where you want them.

Section "ServerLayout"
    Identifier  "MainLayout"
    Screen      "TNT"
    Screen      "MGA" RightOf "TNT"
    Option      "xinerama"  "on"
    InputDevice "Mouse1" "CorePointer"
    InputDevice "Keyboard1" "CoreKeyboard"
EndSection 

<END CONFIG FILE>

For more information, refer to the X documentation.  Now, to test your
configuration, you need to run the XServer.  There is no longer seperate
servers for each of the different video cards.  It's all in one and only
loads the modules that it needs to run.  

The above config file will set up two heads.  The second is just right
of the first.  

Now.  What this gives you is a HUGE desktop.  You can drag windows from
one to the other etc.  The problem with the old snapshot is that it is
EXTREMELY unstable when you run in multihead mode.  Hopefully this has
changed with the new release.  It was not window manager or desktop
environment caused either.  The same lock ups happen under Gnome/Sawfish
and KDE.  

So read the docs.  If you have questions mail the plug list and we'll
try and work them out.  Hope this helps some of you.

-Chris

-- 
----------------------------------------------------------------------
    Christopher N. Deckard      |        Lead Web Technician
      cnd@ecn.purdue.edu        |    Engineering Computer Network
     http://triad.dhs.org       |   http://www.ecn.purdue.edu/ECN/
----------------------------------------------------------------------