[comp.windows.x] X11R2 on IBM RTs

Richard.Draves@RPD.CAMELOT.CS.CMU.EDU (03/19/88)

I haven't seen this show up, so I think I used the wrong
address for xpert.  I hope this time works better...

Rich

------- Forwarded Message

To: xpert@expo.lcs.mit.edu
Reply-To: rpd@cs.cmu.edu
Subject: X11R2 on IBM RTs
Date: Thu, 17 Mar 88 02:24:10 EST
Message-ID: <11751.574586650@BULLWINKLE.MACH.CS.CMU.EDU>
From: Richard.Draves@BULLWINKLE.MACH.CS.CMU.EDU


I have X11R2 working with APA-16 displays on RTs running Mach.
I had to fix a fair number of non-Mach (I think) problems to get
it working.  A quick summary:

I changed server/Imakefile to link Xibm with ddx/ibm/rt/librtalloc.a
and ddx/snf/libsnf.a.

I compiled the server with hc (a version of hccom which sums to 14448/638)
and everything else with cc.  I compiled everything with -O, except for
server/ddx/ibm/aed/.

I changed !defined(_pcc_) to defined(hc) in X11/Xmd.h and server/include/os.h.

I fixed a bug in MakePixmapFromBitmap in clients/uwm/Icons.c that shows
up on RTs.

I changed _XtwaitForSomething in lib/Xt/NextEvent.c to work around a bug
in cc.  I also fixed bugs I noticed in XtAddInput, although I don't think
they were causing problems.

I changed server/os/4.2bsd/{osinit.c,oscolor.c} to use ndbm functions,
because our dbm library (fetch in particular) is broken (due to a bug in cc).
(Also changed server/Imakefile to not link against dbm library.)

I fixed a bug in rtCreateColormapMono in server/ddx/ibm/rt/rtcolor.c.
The function sunBW2CreateColormap in server/ddx/sun/sunBW2.c has the
same bug, but I don't think it manifests itself on Suns.  The qvss
equivalent gets it right.  I didn't check anybody else.

The server works OK on an APA-16 display.  My analog clock hands sometimes
leave a little trail, and the server has crashed a few times.  I tried
running the server on an AED display, and it is miserably flaky and slow.
There are many warnings from vikwait about the semaphore.
If anyone has X11R2 working on AEDs I would like to hear about it.

Rich

Diffs for the changes (to C source, not makefiles) that I mentioned:
(If you use patch to apply these, don't forget the -p flag.)
*** X11/Xmd.h	Thu Feb 25 22:33:37 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/X11/Xmd.h	Fri Mar 11 16:18:08 1988
***************
*** 31,37 ****
  /*
   * ibm pcc doesn't understand pragmas.
   */
! #if defined(ibm032) && !defined(_pcc_)
  pragma on(pointers_compatible);
  pragma off(char_default_unsigned);
  #endif
- --- 31,37 ----
  /*
   * ibm pcc doesn't understand pragmas.
   */
! #if defined(ibm032) && defined(hc)
  pragma on(pointers_compatible);
  pragma off(char_default_unsigned);
  #endif
*** server/include/os.h	Mon Jan  4 08:34:08 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/server/include/os.h	Fri Mar 11 23:38:09 1988
***************
*** 49,55 ****
   * define MALLOC_0_RETURNS_NULL.  This is necessary because some
   * server code expects malloc(0) to return a valid pointer to storage.
   */
! #if defined(ibm032) && !defined(_pcc_)
  
  char *alloca();
  
- --- 49,55 ----
   * define MALLOC_0_RETURNS_NULL.  This is necessary because some
   * server code expects malloc(0) to return a valid pointer to storage.
   */
! #if defined(ibm032) && defined(hc)
  
  char *alloca();
  
*** clients/uwm/Icons.c	Thu Feb 25 23:38:03 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/clients/uwm/Icons.c	Mon Mar 14 02:03:41 1988
***************
*** 82,89 ****
       */
      XCopyPlane( dpy, bitmap, tile, IconGC, 0, 0, width, height, 0, 0, 1 );
  
!     if (*width_return)  *width_return = width;
!     if (*height_return) *height_return = height;
  
      return( tile );
  }
- --- 82,89 ----
       */
      XCopyPlane( dpy, bitmap, tile, IconGC, 0, 0, width, height, 0, 0, 1 );
  
!     if (width_return)  *width_return = width;
!     if (height_return) *height_return = height;
  
      return( tile );
  }
*** lib/Xt/NextEvent.c	Fri Feb 26 12:43:31 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/lib/Xt/NextEvent.c	Mon Mar 14 10:26:18 1988
***************
*** 193,199 ****
  			wmaskfd = composite.wmask;
  			emaskfd = composite.emask;
  		} else {
! 			rmaskfd = wmaskfd = emaskfd = zero;
  			XFD_SET (ConnectionNumber (toplevelDisplay), &rmaskfd);
  		}
  		if ((nfound = select (composite.nfds,
- --- 193,201 ----
  			wmaskfd = composite.wmask;
  			emaskfd = composite.emask;
  		} else {
! 			rmaskfd = zero;
! 			wmaskfd = zero;
! 			emaskfd = zero;
  			XFD_SET (ConnectionNumber (toplevelDisplay), &rmaskfd);
  		}
  		if ((nfound = select (composite.nfds,
***************
*** 340,363 ****
  	struct InputEvent *sptr;
  	XtInputMask condition = (XtInputMask) Condition;
  	
  	if(condition == XtInputReadMask){
- - 	    sptr = (struct InputEvent *)XtMalloc((unsigned) sizeof (*sptr));
  	    sptr->ie_next = Select_rqueue[source];
- - 	    sptr->ie_source = source;
  	    Select_rqueue[source] = sptr;
  	    XFD_SET(source, &composite.rmask);
  	} else if(condition == XtInputWriteMask) {
- - 	    sptr = (struct InputEvent *) XtMalloc((unsigned) sizeof (*sptr));
  	    sptr->ie_next = Select_wqueue[source];
  	    Select_wqueue[source] = sptr;
  	    XFD_SET(source, &composite.wmask);
  	} else if(condition == XtInputExceptMask) {
- - 	    sptr = (struct InputEvent *) XtMalloc((unsigned) sizeof (*sptr));
  	    sptr->ie_next = Select_equeue[source];
  	    Select_equeue[source] = sptr;
  	    XFD_SET(source, &composite.emask);
  	} else
  	  XtError("invalid condition passed to XtAddInput");
  	sptr->ie_proc = proc;
  	sptr->ie_closure =closure;
  
- --- 342,364 ----
  	struct InputEvent *sptr;
  	XtInputMask condition = (XtInputMask) Condition;
  	
+ 	sptr = (struct InputEvent *)XtMalloc((unsigned) sizeof (*sptr));
  	if(condition == XtInputReadMask){
  	    sptr->ie_next = Select_rqueue[source];
  	    Select_rqueue[source] = sptr;
  	    XFD_SET(source, &composite.rmask);
  	} else if(condition == XtInputWriteMask) {
  	    sptr->ie_next = Select_wqueue[source];
  	    Select_wqueue[source] = sptr;
  	    XFD_SET(source, &composite.wmask);
  	} else if(condition == XtInputExceptMask) {
  	    sptr->ie_next = Select_equeue[source];
  	    Select_equeue[source] = sptr;
  	    XFD_SET(source, &composite.emask);
  	} else
  	  XtError("invalid condition passed to XtAddInput");
+ 	sptr->ie_oq = NULL;
+ 	sptr->ie_source = source;
  	sptr->ie_proc = proc;
  	sptr->ie_closure =closure;
  
*** server/os/4.2bsd/osinit.c	Mon Feb 22 10:43:02 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/server/os/4.2bsd/osinit.c	Tue Mar 15 13:34:10 1988
***************
*** 22,31 ****
  
  ******************************************************************/
  /* $Header: osinit.c,v 1.12 88/02/22 10:42:50 rws Exp $ */
  #include "os.h"
  #include "opaque.h"
  #undef NULL
! #include <dbm.h>
  #undef NULL
  #include <stdio.h>
  
- --- 22,32 ----
  
  ******************************************************************/
  /* $Header: osinit.c,v 1.12 88/02/22 10:42:50 rws Exp $ */
+ #include <sys/file.h>
  #include "os.h"
  #include "opaque.h"
  #undef NULL
! #include <ndbm.h>
  #undef NULL
  #include <stdio.h>
  
***************
*** 33,39 ****
  #define ADMPATH "/usr/adm/X%dmsgs"
  #endif
  
! int	havergb = 0;
  extern char *display;
  
  OsInit()
- --- 34,40 ----
  #define ADMPATH "/usr/adm/X%dmsgs"
  #endif
  
! DBM *rgbdb = NULL;
  extern char *display;
  
  OsInit()
***************
*** 63,71 ****
  	been_here = TRUE;
      }
  
!     if(!havergb)
!         if(dbminit (rgbPath) == 0)
! 	    havergb = 1;
!         else
  	    ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
  }
- --- 64,73 ----
  	been_here = TRUE;
      }
  
!     if(rgbdb == NULL)
!     {
! 	rgbdb = dbm_open(rgbPath, O_RDONLY, 0);
! 	if (rgbdb == NULL)
  	    ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
+     }
  }
*** server/os/4.2bsd/oscolor.c	Sat Feb 13 20:53:49 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/server/os/4.2bsd/oscolor.c	Tue Mar 15 13:51:17 1988
***************
*** 22,28 ****
  
  ******************************************************************/
  /* $Header: oscolor.c,v 1.11 88/02/13 20:53:40 rws Exp $ */
! #include <dbm.h>
  #include "rgb.h"
  #include "os.h"
  #include <ctype.h>
- --- 22,28 ----
  
  ******************************************************************/
  /* $Header: oscolor.c,v 1.11 88/02/13 20:53:40 rws Exp $ */
! #include <ndbm.h>
  #include "rgb.h"
  #include "os.h"
  #include <ctype.h>
***************
*** 33,39 ****
   * time. Or implement a database package that allows you to have more than
   * one database open at a time.
   */
! extern int havergb;
  
  /*ARGSUSED*/
  int
- --- 33,39 ----
   * time. Or implement a database package that allows you to have more than
   * one database open at a time.
   */
! extern DBM *rgbdb;
  
  /*ARGSUSED*/
  int
***************
*** 50,56 ****
      register unsigned int i;
      register char c;
  
!     if(!havergb)
  	return(0);
  
      /* convert name to lower case */
- --- 50,56 ----
      register unsigned int i;
      register char c;
  
!     if(rgbdb == NULL)
  	return(0);
  
      /* convert name to lower case */
***************
*** 67,77 ****
  
      dbent.dptr = lowername;
      dbent.dsize = len;
!     dbent = fetch (dbent);
  
      DEALLOCATE_LOCAL(lowername);
  
!     if(dbent.dptr)
      {
  	bcopy(dbent.dptr, (char *) &rgb, sizeof (RGB));
  	*pred = rgb.red;
- --- 67,77 ----
  
      dbent.dptr = lowername;
      dbent.dsize = len;
!     dbent = dbm_fetch(rgbdb, dbent);
  
      DEALLOCATE_LOCAL(lowername);
  
!     if ((dbent.dptr != NULL) && (dbent.dsize == sizeof (RGB)))
      {
  	bcopy(dbent.dptr, (char *) &rgb, sizeof (RGB));
  	*pred = rgb.red;
*** server/ddx/ibm/rt/rtcolor.c	Wed Jan 21 19:45:36 1987
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/server/ddx/ibm/rt/rtcolor.c	Tue Mar 15 21:41:40 1988
***************
*** 97,102 ****
- --- 97,104 ----
      /* this is a monochrome colormap, it only has two entries, just fill
       * them in by hand.  If it were a more complex static map, it would be
       * worth writing a for loop or three to initialize it */
+ 
+     pix = 0;	/* start allocating with pixel 0 */
      red = green = blue = 0;
      AllocColor(pmap, &red, &green, &blue, &pix, 0);
      red = green = blue = ~0;
*** server/ddx/sun/sunBW2.c	Mon Feb 29 00:37:32 1988
- --- /afs/cs.cmu.edu/os/source/usr/misc/.X11tra/src/X.V11R2/server/ddx/sun/sunBW2.c	Tue Mar 15 21:52:31 1988
***************
*** 179,184 ****
- --- 179,186 ----
       * them in by hand.  If it were a more complex static map, it would be
       * worth writing a for loop or three to initialize it */
  
+     pix = 0;	/* start allocating with pixel 0 */
+ 
      /* this will be pixel 0 */
      red = green = blue = ~0;
      AllocColor(pmap, &red, &green, &blue, &pix, 0);

------- End of Forwarded Message

jeff@polyslo.UUCP (Jeff Weinstein) (03/27/88)

In article <487.574742218@RPD.CAMELOT.CS.CMU.EDU> Richard.Draves@RPD.CAMELOT.CS.CMU.EDU writes:
>I tried
>running the server on an AED display, and it is miserably flaky and slow.
>There are many warnings from vikwait about the semaphore.
>If anyone has X11R2 working on AEDs I would like to hear about it.


	This is probably due to a kernel problem.  We had to change the
	kernel to get the AED server to work because of some hacks that
	were put in for X10 that caused X11 to break.  See your local
	site support person to get the fix from IBM.

		Jeff Weinstein
		Computer Systems Lab
		Cal Poly State Univ.
		jeff@polyslo.uucp
		ucbvax!voder!polyslo!jeff

	DISCLAIMER:  I no longer work for IBM and do not speak for them