old-www/LDP/LG/issue82/ward.html

494 lines
19 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Multihead Systems under Linux and Windows LG #82</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="veerapen.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue82/ward.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<center>
<BIG><BIG><STRONG><FONT COLOR="maroon">Multihead Systems under Linux and Windows</FONT></STRONG></BIG></BIG><BR>
<STRONG>By <A HREF="mailto:award@andorra.ad">Alan Ward</A></STRONG></BIG>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<p align=center><i>Setting up several screens on your Win/Lin box.</i></p>
<p><b>Must-read section</b></p>
<p>This article has been much inspired by a paper entitled
&quot;Multihead systems&quot; (I think - I read the Spanish translation
called &quot;Sistemas multihead&quot;) in Linux Journal, by Brian
Gollsneider and Arthur M. Messenger. They're the guys to blame for
getting me interested in this!</p>
<p>The &quot;X --help&quot; page ... worth browsing.</p>
<hr>
<p><b>About multiheading</b></p>
<p>As you people know, multiheading is all about hanging many screens
on one computer. You can then either use the different screens to display
various parts of the same desktop, or different desktops. It has
been done with Unix systems since very early on - around about when they
invented the X-Windowing system. It can be useful when you tend to get a lot
of data on screen -- typical examples are engineering (drawing and 3D
models) and system or network monitoring.</p>
<p>Its generalization is a bit more recent under Windows, though
several video card makers have pushed the idea with dual-head cards.
These are not necessary though; several ordinary video cards can
play the trick.</p>
<p>In fact, one can mix many different kinds of ISA, PCI and AGP cards.</p>
<p>In this article, I will see how it works under Windows (98 version -
though others should be the same) and Linux + XFree86 version 4. Please
note that XFree86 version 3's configuration files are slightly different.</p>
<hr>
<p><b>Considerations about hardware</b></p>
<p>The BIOS will choose one screen to be the primary screen. This is
where your boot messages will appear and where you'll get the initial
console. The BIOS looks for the primary screen on the following buses
in order:
<ul>
<li>the ISA bus</li>
<li>the PCI bus</li>
<li>the AGP bus</li>
</ul>
<p>ISA cards: if anybody still uses them, be warned they get
preference before all others. Can still be useful for text
consoles.</p>
<p>PCI cards. The PCI bus is a mixed thing, in the sense that
you get both on-board devices and PCI cards all together. On
most motherboards, it is a single bus numbered 0, with devices
numbered 0:0 (host controller), 0:1, 0:2 etc. There can be
sub-devices such as 0:9:1, 0:9:2, and so forth.</p>
<p>On-board PCI devices get the lower numbers, generally
up to 0:7. Afterwards, devices 0:8 to 0:12 should be your
PCI slots, numbered from the &quot;bottom&quot; of the motherboard
in the direction of the AGP slot.</p>
<p>Almost all motherboards have only one AGP slot, though
there is no technical reason why. It is identified as a PCI
device on bus 1, as 1:0</p>
<p>For example, if you have one on-board PCI video card, one
removable PCI and one AGP, your device ordering might be: </p>
<pre>
First (main) device: PCI 0:6 (on-board)
Second device: PCI 0:10 (removable)
Third device: PCI 1:0 (AGP)
</pre>
<p>Other motherboard manufacturers set up the on-board video devices
with higher numbers than the slots. This way, if your on-board
video burns out (or you just want to upgrade), you insert a
new PCI video card and its lower number gets preference at boot.</p>
<p>You can get detailed information on this under Linux, for
example, this system has a single AGP card:</p>
<pre>cat /proc/pci
PCI devices found:
(((snip)))
Bus 1, device 0, function 0:
VGA compatible controller: Intel Unknown device (rev 33).
Vendor id=8086. Device id=7800.
Medium devsel. Fast back-to-back capable. IRQ 11. Master Capable. No bursts.
Prefetchable 32 bit memory at 0xce000000 [0xce000008].
Non-prefetchable 32 bit memory at 0xcfe80000 [0xcfe80000].
</pre>
<p>Another way (with root privileges) is:</p>
<pre>scanpci</pre>
<p>Please note that the order of cards is BIOS stuff -- and so applicable
both to Windows and Linux.</p>
<hr>
<p><b>Configuration under Windows</b></p>
<p>This is meant to be pretty easy -- and is, except when you
run into driver trouble. So I would advise you to start out
by sticking *one* video card into your computer, then making sure
you have the necessary drivers. Then go for the next card alone,
and so forth. That way you get the pain in small pieces you can
hopefully handle, instead of all at once.</p>
<p>When you are confident you have all the required drivers either
on CD or on hard disk, and that they actually work with your cards,
stick all the video cards in together and hang screens on them. Boot.</p>
<p>You will then get to reconfigure the drivers once more, one
after the other. You may also get to reboot the computer -- but
you're used to that, right?</p>
<p>At this time, you should get the usual Windows desktop on your
first (main) screen, and a text message on all others telling you
that Windows has recognized the device correctly. If you don't,
go back and reconfigure that video card correctly.</p>
<p>When you take a look at the screen properties, you should see
something like this:</p>
<p align=center><img src="misc/ward/screen1.jpg"></p>
<p>You then click on the number 2 screen, activate it, configure,
and off you go. So forth for all others. Note that screens need not
have the same resolution or color depth:</p>
<p align=center><img src="misc/ward/screen2.jpg"></p>
<p>Hopefully, you are then in business, and can drag windows
from one screen to another. Try it!</p>
<hr>
<p><b>Configuration with XFree86</b></p>
<p>XFree86 version 4 has been changed in several ways from
its version 3 predecessor. To begin with, the configuration
file is now</p>
<pre>/etc/X11/XF86Config-4</pre>
<p>Please note the -4 ending.</p>
<p>It has now dealt away with the antique separate server binary file
for each screen. We now have a more modern modular scheme with a
single main server file, plus modules (drivers) for each family
of video cards. These can be found in most distributions in:</p>
<pre>/usr/X11R6/lib/modules/drivers</pre>
<p>This is similar to what has happened to the Linux kernel: from
a monolithic kernel with all drivers included, modern kernels have
progressed to a loadable modular scheme. Luckily for us.</p>
<p>Here's a list of the most-used drivers:</p>
<p><table border=1>
<tr><th>driver</th><th>cards supported</th></tr>
<tr><td>ati</td><td>most early ATI cards</td></tr>
<tr><td>r128</td><td>ATI Rage-128 and 128-based cards</td></tr>
<tr><td>cirrus</td><td>Cirrus Logic GD54??</td></tr>
<tr><td>cyrix</td><td>Cyrix Media GX CPU</td></tr>
<tr><td>i740</td><td>Intel 740-based cards</td></tr>
<tr><td>i810</td><td>Intel 810-based cards</td></tr>
<tr><td>mga</td><td>Matrox 100, 200, 400</td></tr>
<tr><td>nv</td><td>N-vidia Riva 128, TNT GeForce, etc.</td></tr>
<tr><td>s3</td><td>S3 non-Virge early PCI chipsets</td></tr>
<tr><td>s3virge</td><td>S3 Virge later PCI chipsets</td></tr>
<tr><td>vga</td><td>generic; replaces XFree86-SVGA</td></tr>
<tr><td>fbdev</td><td>generic; &quot;flat&quot; video memory mode</td></tr>
</table></p>
<p>This system also means that it will be relatively easy for
card manufacturers to produce their own modular drivers to support
new cards. Let's hope that they do so.</p>
<p>Configuration is not complicated. The first part of the
XF86Config-4 file should be pretty much self-explanatory, and is
often rather well set up by your favorite distribution's setup
program.</p>
<p><ul>The interesting parts are:
<li>the Monitor section, where you define actual monitors</li>
<li>the Device section, where you set up your video cards</li>
<li>the Screen section, where you give screen resolutions
and color depths</li>
<li>the ServerLayout section, where you set up the relationships
between screens</li></ul></p>
<p>In the Monitor section, each monitor gets its Section tag, such as:</p>
<pre>
Section "Monitor"
Identifier "monitor 1"
VendorName "Philips"
ModelName "Unknown"
HorizSync 30.0-64.0
VertRefresh 50.0-110.0
EndSection
</pre>
<p>You can put in as many monitors as you wish, and name them. I
usually call them "monitor 1" etc., as they are often of the same
type and make. But you can handle this whatever way you feel
most comfortable with.</p>
<p><strong>BE CAREFUL</strong> with the horizontal and vertical frequencies.
You can literally blow up your tube if you are not careful. Been there,
done that :-( Get the right frequencies from the monitor's guide, or look them
up on the manufacturer's site on the Web. If in doubt, go lower. Values that
have worked out to be &quot;safe&quot; for me -- i.e. no screens blown up
-- have been:</p>
<pre>
HorizSync 31.5-35.5
VertRefresh 50.0-70.0
</pre>
<p>Just about any modern multisync monitor can handle these -- however
they are so conservative you won't be able to go far beyond 640x480
with 8-bit color (256 colors). Just enough to prove the concept :-)</p>
<p>You then get to set up the driver for each video card. List
the directory mentioned above. One Section for each card:</p>
<pre>
Section "Device"
Identifier "device 1"
Driver "s3virge"
BusID "PCI:0:11:0"
EndSection
Section "Device"
Identifier "device 2"
VendorName "Unknown"
BoardName "Unknown"
Driver "i740"
VideoRam 8192
BusID "PCI:1:0:0"
EndSection
</pre>
<p>In this case, I have one S3 card inserted in a PCI slot, and
an Intel 740-based AGP card. With a single card, you do not need
to look up and specify the bus ID (from /proc/pci). But in our case
we need it to distinguish, for example, between several cards of
the same type.</p>
<p>In the above example, if I added a second S3 Virge in PCI slot
0:12, I would add a third Device section repeating the "s3virge"
driver line, and specifying "PCI:0:12:0". The server is smart enough
not to create two instances of the driver in memory, just two references
to the same driver.</p>
<p>As with monitors, the Identifier tag set up by the setup program
usually contains the card's chipset commercial identifier, though
you can change it at will.</p>
<p>You then set up a Screen section linking each Monitor to the
appropriate Device. I strip this down to the essentials:</p>
<pre>
Section "Screen"
Identifier "screen 1"
Device "device 1"
Monitor "monitor 1"
DefaultColorDepth 16
Subsection "Display"
Depth 16
Modes "1024x768"
ViewPort 0 0
EndSubsection
EndSection
Section "Screen"
Identifier "screen 2"
Device "device 2"
Monitor "monitor 2"
DefaultColorDepth 24
Subsection "Display"
Depth 24
Modes "800x600"
ViewPort 0 0
EndSubsection
EndSection
</pre>
<p>Finally, you set up the whole system:</p>
<pre>
Section "ServerLayout"
Identifier "layout 1"
Screen "screen 1"
Screen "screen 2" RightOf "screen 1"
Option "Xinerama" "on"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection
</pre>
<p>Here, I have screen 2 at the right of screen 1. I could also
have specified it to be at the left, above of below any existing
screen.</p>
<p>The Xinerama option is also important. This is an extension of
the X server that links screen 1 with screen 2, to form a single
desktop I can drag windows and icons across.</p>
<p>This works in the same way as Windows, but needs both (or all)
screens to have the same color depth: generally 8, 16 or 24 bits.
This means the above example shouldn't work! (Read it again to
make sure you understand why before reading on.)</p>
<p>But you may prefer two screens with separate desktops. For example,
you could have one screen for your own use, and make the other
available over your local network. Or one screen with KDE and the other
without any window manager. Your choice. This can be done simply by
turning off Xinerama:</p>
<pre>
Option "Xinerama" "off"
</pre>
<p>Finally, you may prefer to keep a screen for the text console:
include "screen 2", "screen 3", etc in your ServerLayout section,
omitting "screen 1" (generally the console if where you boot from
and where you get system error messages).</p>
<hr>
<p><b>Trying out XFree</b></p>
<p>As with Windows, it is best to start out by testing each
video card individually. Start at the text console (runlevel 3).
Keep one screen in your ServerLayout, commenting out the others
with a # at the beginning of the line. You can then start up the
X server (no need for a desktop yet):</p>
<pre>X</pre>
<p>You should get a black-and-white crisscross pattern, with an
X-shaped mouse cursor in the middle. Good. You can shut down
X and get back to the text console with</p>
<pre>Ctrl + Alt + Backspace</pre>
<p>Now do the same for the other cards. When you have everything
set up, just uncomment all screen entries in ServerLayout, and
test X once more. You should now get the crisscross pattern on
all screens, and if you activated Xinerama, the mouse should move
between screens.</p>
<p>&lt;smirk&gt;And you didn't need to reboot, did you?&lt;/smirk&gt;</p>
<p>You can now either go directly into the graphical desktop
with startx, or switch to a graphical login with runlevel 5:</p>
<pre>init 5</pre>
<hr>
<p><b>Comparison between Windows and Linux</b></p>
<p>As usual, there are differences between either way of doing
things, and thus between the end results. To be objective:</p>
<p>- Windows lets you use devices with different levels of
color and resolutions together as part of the same desktop.
However, it cannot handle more than one desktop, nor can it
mix text consoles with graphics.</p>
<p>- Windows can be a pain to configure, with much rebooting.</p>
<p>- conversely, Linux can mix text screen with graphics -- this
is great for keyboard-trained systems administrators --, can
use more than one desktop, or can use all screens (or a
combination of screens) for a single desktop. If you want KDE and
Gnome at the same time, you get it. If you just want one single
big WindowMaker, you get that. If you want to set up a 2x2 or
3x3 video wall, all you need are enough cards, and enough slots
to set them in.</p>
<p>- If you want to mix screens with Xinerama under Linux,
you need to use the same color depth on all of them.</p>
<p>- Linux with XFree86 version 4 is much easier to configure --
though maybe that's my bias showing through.</p>
<p>Seriously though, the last time I installed Mandrake 8.2, it
detected all video cards and went multihead all on its own. Good
show.</p>
<p>One last warning the reader may do well to heed: do this on
a computer with backups up to date, not on a production machine.
Video cards are tricky little things that can bite.</p>
<p>PS. Should anybody want to translate this article: I wrote it in
the spirit of the GPL software licence. i.e. you are free (and
indeed encouraged) to copy, post and translate it -- but please,
PLEASE, send me notice by email! I like to keep track of translations --
it's good for the curriculum :-)</p>
<!-- *** BEGIN bio *** -->
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Alan Ward</H4>
<EM>Alan teaches CS in Andorra at high-school and university levels. His
hobbies
include science photography (both digital and traditional), trekking,
rock and processor collecting.</EM>
<!-- *** END bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2002, Alan Ward.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 82 of <i>Linux Gazette</i>, September 2002</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<!--startcut ==========================================================-->
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="veerapen.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue82/ward.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->