From: kaleb@stingray.Jpl.Nasa.Gov (Kaleb Keithley)
Newsgroups: fj.mail-lists.x-window
Subject: R5.Xsun.multi-screen
Date: 23 Dec 92 04:09:45 GMT
Distribution: fj
Organization: Workstation Div., Supermicro Systems Group, Sony Corporation

Date: Tue, 22 Dec 92 16:42:57 -0500
Message-Id: <9212222142.AA14415@expo.lcs.mit.edu>

I have installed a new version of the R5.Xsun.multi-screen server on
export.lcs.mit.edu (18.24.0.12).  It may be found in the file
~ftp/contrib/R5.Xsun.multi-screen.tar.Z.  The highlights are:

    Incorporated Martin Forssen's 16 December 1992 keyboard patch.

    A fix for the CG2 screen-saver and colormap-install when compiled 
    with gcc-2.x.x.

    A fix for a spurious abort when running under xdm and 
    "*terminateServer: False"

The complete README follows.

========================================================================

The R5 Xsun Multi-screen server is a general purpose replacement for the 
MIT server/ddx/sun layer.  

It was written to fulfill the following requirements:

    First, (and foremost) to support up to three of the same type of
    frame buffers on VME and S-Bus architectures.

    Second, to simplify the interface to the frame buffers.

    Third, to eliminate the SunView support.  The King is dead.  Long 
    live the King.

    Fourth, fully integrated keyboard support, written by Martin Forssen.
    No patches to apply, no muss, no fuss, no hassles.  This source is
    current with his set of patches dated 16 December, 1992.

=============================================================================

Things to know and miscellaneous notes:

I've decided to stop advertising that you may use 24-bit frame buffers
in 8-bit mode.  I am currently working to make this this a reality, but 
until such a time as it truly works...


XDEVICE environment variable.  Xsun will look here first to get the
    device(s) to try; examples:  

    'setenv XDEVICE /dev/cgtwo0:/dev/cgtwo1' 
    'setenv XDEVICE /dev/cgeight0'
    'setenv XDEVICE /dev/cgthree0:/dev/cgsix0'
    'setenv XDEVICE /dev/cgsix0:/dev/cgthree0'

-dev command line argument.  Xsun will look here second, and override
    XDEVICE specified devices, to get the device(s) to try; examples:

    'Xsun -dev /dev/cgtwo0:/dev/cgtwo1'
    'Xsun -dev /dev/cgeight0'
    'Xsun -dev /dev/cgthree0:/dev/cgsix0'
    'Xsun -dev /dev/cgsix0:/dev/cgthree0'

fallback list.  If neither of the two methods listed above are employed,
    Xsun will resort to a fallback list of devices to try.  The list is:

    /dev/cgtwo0, /dev/cgtwo1, /dev/cgtwo2, /dev/cgthree0, /dev/cgthree1,
    /dev/cgthree2, /dev/cgsix0, /dev/cgsix1, /dev/cgsix2, /dev/cgfour0,
    /dev/bwtwo0, /dev/bwtwo1.


cgfour note:
    Some Suns are equipped with a mono frame buffer on the mother board.
    All cgfours have an implicit mono frame buffer.  /dev/bwtwo0, I believe 
    will find the mother board frame buffer rather than the cgfour mono 
    plane.  In the absence of a real bwtwo, /dev/bwtwo0 will find the
    cgfour mono plane.

    If you experience strange behaviour, i.e. you have a cgfour and the 
    cursor appears to go off the side of the screen, override the
    fallback list with either XDEVICE or -dev, e.g. 'Xsun -dev /dev/cgfour'

    Likely ways of having a bwtwo are: real bwtwo frame buffer in a
    slot, real bwtwo frame buffer on the mother board (3/60 only),
    or the cgfour emulates a bwtwo.  Real problems arise when you
    have both a cgfour and another bwtwo.  What happens is that the
    real bwtwo is assigned to /dev/bwtwo0, but this server expects
    /dev/bwtwo0 to be the mono plane of the cgfour, when there is
    one.  The consequences are, that dragging the pointer off the
    edge of the screen causes the cgfour code to enable the mono
    plane; that's okay when the /dev/bwtwo0 is using the cgfour
    mono plane, but not okay when it's some other bwtwo, especially
    if that other bwtwo isn't hooked up to a monitor.

    As there is no way to tell from software whether a given bwtwo
    is real or emulated, it poses real problems with trying to
    automagically set up the server to handle all the available
    hardware correctly.  Possible work arounds are:
      1) specify the device list with either -dev or XDEVICE.
      2) specify -zaphod
      3) ensure that /dev/bwtwo0 uses the cgfour:
         'cd /dev;mv bwtwo0 bwtwo1;MAKEDEV bwtwo0' is alleged to work.

cgeight/cgnine/cgtwelve note:
    Sun apparently has a utility program that will allow these devices to 
    emulate other "supported" devices.  MIT's Xsun checks the emulation 
    mode in a sort of backward way, thus, a cgeight, emulating a cgfour 
    would be rejected, and would terminate claiming that no screens were 
    found.  Needless to say, if the multi-screen server finds a cgeight,
    cgnine, or cgtwelve, and it is emulating a "supported" device, it 
    will be used.  

    NOTE, that since I don't have any of these devices, I haven't tested 
    this feature.

xdm note:
    Running MIT's Xsun with xdm has a funny peculiar problem.  The 
    keyboard driver will erroneously report an unknown keyboard type 
    within 750 milliseconds of a mode change.  Normally this isn't a 
    problem if you're running via xinit.  xdm, on the other hand, can 
    (and does) terminate and refork-and-exec the server fast enough to 
    encounter this.  The poor server, thinks it's got an unknown keyboard 
    type, aborts and leaves a spurious core file.  The multi-screen
    includes a fix for this problem.

Sun 386i notes:
    Even though a Sun 386i cannot have multiple screens, the multi-screen 
    server source contains conditional compilation for building on Sun 386 
    boxes.  The conditional eliminates support for devices that will never 
    be found on a Sun 386 and therefore produces a smaller binary than might
    otherwise be created.  

    Suns' 386 compiler has a severe bug and will not generate correct code 
    for mi/miscrinit.c, and cfb/cfbteblt8.c.  You may overcome this flaw by 
    compiling all the server code, or just these two files with gcc.  I have 
    used gcc-1.xx with success.

Bug fixes to server/ddx/mi:
    There is a bug in ddx/mi with regard to tracking the pointer across
    multiple screens.  This apparently seems to only be a problem on
    machines where there is no hardware cursor support.  This is true
    of all the "supported" Sun frame buffers.  Three files are supplied
    to fix the bug.  These files came from MIT, and, although the need
    to make them "public fixes" might seem apparent to those of us using
    multiple screens, MIT doesn't feel that the fixes, or the bug that
    they fix are critical enough to warrant their inclusion into a public 
    fix.  I've been told not to expect them to be official in any respect 
    until R6.  If you disagree with this assessment, I encourage you to 
    let MIT know.  Perhaps if enough people ask nicely, they'll make them 
    official by distributing them in a public fix.

    If you don't want to install the three ddx/mi files, the multi-screen
    feature will still work but you're apt to get some strange behavior 
    if you warp the pointer from screen to screen.


New constype.
    The old constype was pretty nearly useless (apologies to the original 
    author) and initial versions of the R5.Xsun.multi-screen didn't include 
    it for that, and some other reasons.  The new constype probes for all 
    the devices that Xsun supports, and reports any that it finds.


Old kbd_mode.
    Is included for completeness.


Credits:
    All the people at the X Consortium, and especially Keith Packard,
    who is, alas, no longer a Consortium employee.

    Thanks to George Ross (gdmr@dcs.edinburgh.ac.uk) for pointing
    out that I broke the support for high resolution monochrome
    monitors -- it's fixed now.

    Thanks to Jordan Hayes (jordan@moorenet.com) for pushing me to
    include (and indirectly to rewrite) constype and kbd_mode.

    Thanks to Andrew McRae (andrew@megadata.mega.oz.au) for finding
    a bug when used with Sun's SunOS GX patch.

    Thanks to Martin Forssen (maf@dtek.chalmers.se) and Ian Daniel
    (daniel@europarc.xerox.com) for the enhanced keyboard support and
    encouraging me to put it in, respectively.

    Thanks to Obi Thomas (obi@finnbogi.ocs.com) for finding and fixing
    a bug when used under xdm and *terminateServer: False.

    Thanks to Eirik Fuller (eirik@elf.tn.cornell.edu) for finding and
    fixing the CG2 colormap and screen saver when compiled with 
    GCC-2.x.x


Followup thoughts:
    If you're concerned, (and rightfully so) that I might have broken
    something else, rest assured that: 1) I've been adding multi-screen 
    support to Xsun since R3.  2) I have been running the server built
    from this source since shortly after the public release of R5. 
    3) This code is in wide use by numerous others, world-wide.


Installation instructions:
    'cd .../mit/server'
    'mv ddx/sun ddx/sun.orig'
    'mv ddx/mi/mieq.c ddx/mi/mieq.c.orig
    'mv ddx/mi/mipointer.c ddx/mi/mipointer.c.orig
    'mv ddx/mi/mipointrst.h ddx/mi/mipointrst.h.orig
    'mv ../include/Sunkeysym.h ../include/Sunkeysym.h.orig'
    'mv include/site.h include/site.h.orig
    'zcat R5.Xsun.multi-screen.tar | tar xvf -'
    'make Makefile'
    'make depend'
    'make'

If you have any questions or comments, please send them to:

kaleb@jpl-devvax.jpl.nasa.gov

--