Multi Head Setup Using Xinerama =============================== Shanker Balan http://shankerbalan.com/ Changelog: Wed Apr 30 15:15:22 IST 2003 - Initial commit. What is Multi Head? Multihead is the concept of using more than one display monitor on your PC. This can be achieved either by using multiple display boards or by using a single display baord which supports multiple heads like the Matrox G400 dual head series. What is Xinerama? Normally, the Xserver will treat each "head" as a seperate desktop which is independant of each other. Enter Xinerams! Xinerama is an Xwindows extension which lets you combine multiple "heads" into a single large desktop. Why and for whom is it useful? Why would anyone want to use multiple displays u ask? Well... It all comes down to productivity. For instance, graphic designers who could use all the screen real esate thet they could get, will be greatly benefitted by using a multi-head setup. Programmers would find it very convenient to use one head for running the code editor and the debugger/documentaion on the second head. Games are also being written to make use multi-head setups. The gaming window, extra camera views, score card are all shown in realtime using multi-head setup. A multihead setup lets you expand your desktop and see more information at once. What you do with the extra information is totally dependant on your imagination. What hardware/software is needed? A Xinerama setup is quite simple - get atleast 2 graphic cards which is supported by XFree86 under Linux and 2 compatible monitors, stick it into your system, configure Xwindows and you are on. For this setup, i will be using a ATI Rage Fury 16MB AGP graphics card for my primary display and a Matrox Mystique 4MB PCI as my secondary display. Running the latest version of X windows is always advised. Users of XFree86 4.0.2 and below should consider upgrading to RedHat Linux 7.1 if they plan to use Xinerama. RHL 7.1 ships with XFree86 4.0.3 which has improved support for multi-head and Xinerama. Also make sure to solve any IRQ clashes that you might have with the graphics cards before you start configuring it. Verify that you are running X 4.0.3 or better by running the following command: ~# X -version How to put it all together? Now that we have the software and hardware in place, time to configure X windows. Readers please note that there are 2 config files under /etc/X11/ - XF86Config and XF86Config-4. XFree86 4.0 and lster use "XF86Config-4". "XF86Config" is meant for XFree86 3.3.6 and below. All changes are made to XF86Config-4 and not the legacy XF86Config. Got it? Make a backup of your old config file: ~# cd /etc/X11/ ~# cp XF86Config-4 XF86Config-4.orig The RedHat tool "Xconfigurator" cannot be used to configure a multihead setup. We will be doing the config "by hand". Scan the PCI bus: ~# XFree86 -scanpci X will then output the PCI bus IDs for all PCI devices on your system. (0:0:0) unknown chip (DeviceId 0x0305) from VIA (0:1:0) unknown chip (DeviceId 0x8305) from VIA (0:7:0) VIA card using a VIA VT 82C686 MVP4 ISA Bridge (0:7:1) VIA card using a VIA VT 82C586 MVP3 IDE Bridge (0:7:4) VIA card using a VIA VT 8501 MVP4 ACPI Bridge (0:11:0) Matrox unknown card (0x2100) using a Matrox MGA 1064SG (0:18:0) unknown card (0x1186/0x1300) using a Realtek RTL8139 10/100 Ethernet (0:20:0) Realtek Generic using a Realtek RTL8139 10/100 Ethernet (1:0:0) ATI card using a ATI Rage 128 RF Note down the BusIDs for your graphics cards. In my case its "1:0:0" fot the ATI Rage Fury and "0:11:0" for the Matrox. It is very important that you get the IDs correct. Editing XF86Config-4: Editing the XF86Config config file can be quite tricky to the clueless. I recommend going thru "man XF86Config" at this stage. It will greatly increase your knowldge of the config semantics. Go to the end of XF86Config-4 and add the following lines: Add the second "Device" entry. This entry deals with the graphics device description. There will already be one defined for your primary graphice device. Section "Device" Identifier "Card1" Driver "mga" BusID "0:11:0" VideoRAM 4096 EndSection You will need to change the "Driver", "BusID" and "VideoRAM" lines depending on the graphics card you have. For example, if you have a SiS card with 8MB of video RAM, the config will look like this: Section "Device" Identifier "Card1" Driver "sis" BusID "0:11:0" VideoRAM 8192 EndSection For a full list of drivers available, take a look at /usr/X11R6/lib/X11/doc/ Now add the "Monitor" section for your second monitor. The "Monitor" section deals with the monitor configuration: Section "Monitor" Identifier "Monitor1" HorizSync 31.5 - 54.0 VertRefresh 50-120 EndSection You should change the "HorizSync" and "VertRefresh" values to reflect the ones meant for your monitor. Refer to the monitor manual for correct values. The values i have used is suitable for most entry level SVGA monitors currently shiiped in the market. YMMV. Add the "Screen" section. This deals with the screen settings like resolutions, colordepth etc. Section "Screen" Identifier "Screen1" Device "Card1" Monitor "Monitor1" DefaultDepth 16 Subsection "Display" Depth 16 Modes "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection Subsection "Display" Depth 16 Modes "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection EndSection Make sure that the screen settings for the second monitor resembles the one for the primary monitor with respect to depth, modes and defaultdepth. Add finally add the "ServerLayout" section. This deals with the overall layout of the screens and devices. Section "ServerLayout" Identifier "XFree86 Configured" Screen "Screen0" Screen "Screen1" Rightof "Screen0" InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" Option "Xinerama" "on" EndSection In my case, "Screen1" is physically placed right of "Screen0". You can substitute "RightOf" with "Below", "Above" and "LeftOf" depending on where you have placed your monitor physically in relationship to the promary monitor. There are more relationships possible, take a look at the "ServerLayout" in 'man XF86Config". Testing: After making the necessarry changes to XF86Config-4, we can test our configuration by running "X -probeonly": ~# X -probeonly If you get errors like "no common visuals" or "no screens found", go back and recheck XF86config-4. Finally, start X windows. ~# startx Recommended WindowManagers - To make full use of the Xinerama extionsion, one needs to use a Xinerama aware window manager. Enlightenment for example, is smart enough to make sure that windows dont appear "in-between" the 2 monitors and windows dont get stretched across all the scrrens if you try maximizing it. Other Xinerama aware wm's include, sawfish and XFCE. Limitations and recommended hw setups Getting the right combination of hardware can also be tricky. In my experience, cards from well known manufacturers like ATI, 3DfX and Matrox are better suited for multi head setups as they are more stable and have excellent support in XFree86. I have gotten cards based on SiS and Cirrus Logic chipsets but stability and performance are nothing to talk about. IMHO, these cards are simply not "well beheaved". There are also boards which ship with built-in support for two heads like the Matrox G450 DualHead. This card has excellent support in XFree86 under Linux and is quite popular among Linux users. It is not very expensive either. Xinerama is not without its share of caveats. As of this writing, you cannot have 3D hardware accelaration using DRI and Xinerama simultaneously. Support hardware accelarion on the second head does not exist yet with XFree86. Which means that you cannot play any FPS games like Quake3 on a multihead system. You can however use commercial X servers like Metro X and AcceleratedX which provide 3d accelartion and multihead support simultaneosuly. Hopefully, this issue would be resolved soon. As far as possible, do not try to use monitors from differrent makers. There is serious differrence in visual clarity depending on the quality of the monitor you are using. Believe me, by the time you start using a multihead head setup, you will think about adding a third head to your computer and begin to wonder how people manage to use a single display on their PC. Sample Config file: Section "ServerLayout" Identifier "XFree86 Configured" Screen "Screen0" Screen "Screen1" Rightof "Screen0" InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" Option "Xinerama" "on" EndSection Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" ModulePath "/usr/X11R6/lib/modules" FontPath "unix/:7100" EndSection Section "Module" Load "extmod" Load "xie" Load "pex5" Load "glx" # Load "dri" #Load "v4l" Load "GLcore" Load "dbe" Load "record" Load "type1" Load "freetype" Load "speedo" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "keyboard" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Device" "/dev/mouse" Option "Protocol" "IMPS/2" Option "Emulate3Buttons" "off" Option "ZAxisMapping" "4 5" Option "Resolution" "200" EndSection Section "Monitor" Identifier "Monitor0" HorizSync 30 - 55 VertRefresh 50 - 120 EndSection Section "Monitor" Identifier "Monitor1" HorizSync 31.5 - 54.0 VertRefresh 50-120 EndSection Section "Device" Identifier "Card0" Driver "r128" BusID "PCI:1:0:0" Option "AGPMode" "2" Option "UseCCEFor2D" "false" VideoRAM 16384 EndSection Section "Device" Identifier "Card1" Driver "mga" BusID "0:11:0" VideoRAM 4096 EndSection Section "Screen" Identifier "Screen1" Device "Card1" Monitor "Monitor1" DefaultDepth 24 Subsection "Display" Depth 24 Modes "1024x768" "800x600" "640x480" "320x240" "352x240" ViewPort 0 0 EndSubsection Subsection "Display" Depth 24 Modes "1024x768" "800x600" "640x480" "320x240" "352x240" ViewPort 0 0 EndSubsection EndSection Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1024x768" "800x600" "640x480" "320x240" "352x240" EndSubSection SubSection "Display" Depth 24 Modes "1024x768" "800x600" "640x480" "320x240" "352x240" EndSubSection EndSection Section "DRI" Mode 0666 EndSection Resources: Xinerama HOWTO: http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Xinerama-HOWTO.html Matrox DualHead: http://www.matrox.com/mga/home.htm