[comp.windows.x] Xsun patch for multiple screens

steve@lia (Stephen Williams) (04/14/91)

...
This shar contains patches necessary to make Xsun correctly search
for frame buffers on 4.1.1 UNIX.  I discovered the problem on an
IPC, so I called it an IPC bug.  Is it possible to get this patch into
the next release of X11?

This patch includes a new file as well as patches to existing
files.  To apply this patch, cd to the mit directory of your
X source, then run the following shar file through sh.  This
will create the new file, and leave a patch file, patch.ipc-bug.
Then, execute patch < patch.ipc-bug.


--Steve


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  server/ddx/sun/sunFB.c patch.ipc-bug
# Wrapped by steve@ararat on Tue Apr  9 18:27:14 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f server/ddx/sun/sunFB.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"server/ddx/sun/sunFB.c\"
else
echo shar: Extracting \"server/ddx/sun/sunFB.c\" \(1096 characters\)
sed "s/^X//" >server/ddx/sun/sunFB.c <<'END_OF_server/ddx/sun/sunFB.c'
X
X/*
X * This file is a new one to support CORRECT behavior
X * of the Xsun server.  The idea here is that the probe
X * routine simply decides if /dev/fb is needed and available.
X * If it is (on both counts) then slip in the correct create
X * routine and go.
X */
X
X
X# include  "sun.h"
X
Xextern Bool sunBW2Probe(), sunBW2Create();
X
X
X/*
X * This is the probe for the "/dev/fb" device.  This device
X * should only be used if there are no other devices.  It
X * is a device of last resort.
X */
XBool
XsunDefaultProbe(pScreenInfo, index, fbNum, argc, argv)
X    ScreenInfo	  *pScreenInfo;	/* The screenInfo struct */
X    int	    	  index;    	/* The index of pScreen in the ScreenInfo */
X    int	    	  fbNum;    	/* Index into the sunFbData array */
X    int	    	  argc;	    	/* The number of the Server's arguments. */
X    char    	  **argv;   	/* The arguments themselves. Don't change! */
X{
X
X	if ( index > 0 ) return FALSE;
X
X
X	/* XXXX For no really good reason, pretend this is a BWTWO device */
X
X	sunFbData[fbNum] . createProc = sunBW2Create;
X
X	return sunBW2Probe(pScreenInfo, index, fbNum, argc, argv);
X}
END_OF_server/ddx/sun/sunFB.c
if test 1096 -ne `wc -c <server/ddx/sun/sunFB.c`; then
    echo shar: \"server/ddx/sun/sunFB.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f patch.ipc-bug -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"patch.ipc-bug\"
else
echo shar: Extracting \"patch.ipc-bug\" \(5685 characters\)
sed "s/^X//" >patch.ipc-bug <<'END_OF_patch.ipc-bug'
X*** /X/mit/server/ddx/sun/Imakefile	Tue Apr  9 15:49:34 1991
X--- server/ddx/sun/Imakefile	Mon Apr  8 18:45:00 1991
X***************
X*** 3,8 ****
X--- 3,9 ----
X  SRCS1 =	\
X  	sunInit.c \
X  	sunBW2.c \
X+ 	sunFB.c \
X  	sunCursor.c \
X  	sunIo.c \
X  	sunKbd.c \
X***************
X*** 21,26 ****
X--- 22,28 ----
X  
X  OBJS = \
X  	sunBW2.o \
X+ 	sunFB.o \
X  	sunCursor.o \
X  	sunIo.o \
X  	sunKbd.o \
X*** /X/mit/server/ddx/sun/sunInit.c	Tue Apr  9 15:49:31 1991
X--- server/ddx/sun/sunInit.c	Mon Apr  8 18:43:45 1991
X***************
X*** 60,65 ****
X--- 60,66 ----
X  extern Bool sunCG2CProbe(), sunCG2CCreate();
X  extern Bool sunCG3CProbe(), sunCG3CCreate();
X  extern Bool sunCG4CProbe(), sunCG4CCreate();
X+ extern Bool sunDefaultProbe();
X  #ifdef FBTYPE_SUNFAST_COLOR /* doesn't exist in sunos3.x */
X  extern Bool sunCG6CProbe(), sunCG6CCreate();
X  #endif
X***************
X*** 105,110 ****
X--- 106,112 ----
X  
X  sunFbDataRec sunFbData[] = {
X      sunBW2Probe,  	"/dev/bwtwo0",	    sunBW2Create,
X+     sunBW2Probe,  	"/dev/bwtwo1",	    sunBW2Create,
X      sunCG2CProbe,  	"/dev/cgtwo0",	    sunCG2CCreate,
X      sunCG3CProbe,  	"/dev/cgthree0",    sunCG3CCreate,
X  #ifdef FBTYPE_SUNFAST_COLOR
X***************
X*** 111,117 ****
X      sunCG6CProbe,	"/dev/cgsix0",	    sunCG6CCreate,
X  #endif
X      sunCG4CProbe,  	"/dev/cgfour0",	    sunCG4CCreate,
X!     sunBW2Probe,  	"/dev/bwtwo0",	    sunBW2Create,
X  };
X  
X  /*
X--- 113,119 ----
X      sunCG6CProbe,	"/dev/cgsix0",	    sunCG6CCreate,
X  #endif
X      sunCG4CProbe,  	"/dev/cgfour0",	    sunCG4CCreate,
X!     sunDefaultProbe,	"/dev/fb",	    0,
X  };
X  
X  /*
X***************
X*** 119,125 ****
X   * structures in sunFbData which have an actual probeProc).
X   */
X  #define NUMSCREENS (sizeof(sunFbData)/sizeof(sunFbData[0]))
X! #define NUMDEVICES  2
X  
X  fbFd sunFbs[NUMDEVICES];
X  
X--- 121,127 ----
X   * structures in sunFbData which have an actual probeProc).
X   */
X  #define NUMSCREENS (sizeof(sunFbData)/sizeof(sunFbData[0]))
X! #define NUMDEVICES  5
X  
X  fbFd sunFbs[NUMDEVICES];
X  
X***************
X*** 177,183 ****
X      int     	  i, n, dev;
X      int		  nonBlockConsole = 1;
X      static int	  setup_on_exit = 0;
X-     int		  devStart = 1;
X  
X      if (!monitorResolution)
X  	monitorResolution = 90;
X--- 179,184 ----
X***************
X*** 185,191 ****
X  	if (!strcmp(argv[i],"-debug"))
X  	    nonBlockConsole = 0;
X  	else if (!strcmp(argv[i],"-mono"))
X! 	    devStart = 0;
X      }
X      /*
X       *	Writes to /dev/console can block - causing an
X--- 186,192 ----
X  	if (!strcmp(argv[i],"-debug"))
X  	    nonBlockConsole = 0;
X  	else if (!strcmp(argv[i],"-mono"))
X! 	    ErrorF("InitOutput: -mono switch temporarily out of service\n");
X      }
X      /*
X       *	Writes to /dev/console can block - causing an
X***************
X*** 220,226 ****
X      if (!sunDevsProbed)
X      {
X  	n = 0;
X! 	for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) {
X  	    if ((*sunFbData[dev].probeProc)(pScreenInfo, n, dev, argc, argv))
X  		n++;
X  	    else
X--- 221,227 ----
X      if (!sunDevsProbed)
X      {
X  	n = 0;
X! 	for (dev = 0; dev < NUMSCREENS; dev+=1) {
X  	    if ((*sunFbData[dev].probeProc)(pScreenInfo, n, dev, argc, argv))
X  		n++;
X  	    else
X***************
X*** 229,238 ****
X  	sunDevsProbed = TRUE;
X  	if (n == 0)
X  	    return;
X      }
X      if (!sunSupportsDepth8)
X  	pScreenInfo->numPixmapFormats--;
X!     for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) {
X  	if (sunFbData[dev].createProc)
X  	    (*sunFbData[dev].createProc)(pScreenInfo, argc, argv);
X      }
X--- 230,240 ----
X  	sunDevsProbed = TRUE;
X  	if (n == 0)
X  	    return;
X+ 
X      }
X      if (!sunSupportsDepth8)
X  	pScreenInfo->numPixmapFormats--;
X!     for (dev = 0; dev < NUMSCREENS; dev+=1) {
X  	if (sunFbData[dev].createProc)
X  	    (*sunFbData[dev].createProc)(pScreenInfo, argc, argv);
X      }
X***************
X*** 405,412 ****
X      char       	  *name=(char *)0;
X      int           i;	    	/* Index into argument list */
X      int           fd = -1;	    	/* Descriptor to device */
X-     static int	  devFbUsed=FALSE;  /* true if /dev/fb has been used for a */
X-     	    	  	    	    /* screen already */
X      static Bool	  inited = FALSE;
X      static char	  *xdevice; 	/* string of devices to use from environ */
X      static char	  *devsw;   	/* string of devices from args */
X--- 407,412 ----
X***************
X*** 472,484 ****
X  	    name = sunFbData[fbNum].devName;
X      }
X  
X-     /*
X-      * If we still have nothing and have yet to use "/dev/fb" for
X-      * a screen, default the name to be "/dev/fb"
X-      */
X-     if (devsw == (char *)NULL && name == (char *)NULL && !devFbUsed) {
X- 	name = "/dev/fb";
X-     }
X  
X  
X      if (name != (char *) NULL && sunUseSunWindows()) {
X--- 472,477 ----
X***************
X*** 683,691 ****
X  	}
X      }
X  
X-     if (name && strcmp (name, "/dev/fb") == 0) {
X- 	devFbUsed = TRUE;
X-     }
X  
X      return (fd);
X  }
X--- 676,681 ----
X*** /X/mit/server/ddx/sun/sunBW2.c	Tue Apr  9 15:49:36 1991
X--- server/ddx/sun/sunBW2.c	Mon Apr  8 18:42:20 1991
X***************
X*** 256,266 ****
X      int	    	  argc;
X      char    	  **argv;
X  {
X!     if (sunGeneration != serverGeneration)
X      {
X  	sunBW2ScreenIndex = AllocateScreenPrivateIndex();
X  	if (sunBW2ScreenIndex < 0)
X  	    return FALSE;
X      }
X      return (AddScreen(sunBW2Init, argc, argv) >= 0);
X  }
X--- 256,269 ----
X      int	    	  argc;
X      char    	  **argv;
X  {
X!     static int getScreenGeneration = 0;
X!     if ( getScreenGeneration != serverGeneration )
X      {
X  	sunBW2ScreenIndex = AllocateScreenPrivateIndex();
X  	if (sunBW2ScreenIndex < 0)
X  	    return FALSE;
X+ 
X+ 	getScreenGeneration = serverGeneration;
X      }
X      return (AddScreen(sunBW2Init, argc, argv) >= 0);
X  }
END_OF_patch.ipc-bug
if test 5685 -ne `wc -c <patch.ipc-bug`; then
    echo shar: \"patch.ipc-bug\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0