[comp.sys.ibm.pc.rt] compiling X11R4 under AOS for mpel

steven@pacific.csl.uiuc.edu (Steven Parkes) (01/09/90)

Can anyone (ibm?) recommend the proper compilers to use in compiling
the server directory for AOS/mpel?  I tried a vanilla compile which does
everything as hc (2.1s) -O and the results seem less than wonderful --
specifically, magic (6.0 beta) causes the server to go off into the trees
by trying to draw some scrollbar glyphs manually using XDrawPoint().

I'm recompiling ppc now w/o -O and if that doesn't work I'll try
the mpel directory, but I would like to optimize as much as possible.

steven parkes ---------------------------------------
University of Illinois Coordinated Science Laboratory
steven@pacific.csl.uiuc.edu -------------------------

jfc@athena.mit.edu (John F Carr) (01/10/90)

In article <1990Jan9.154135.13344@ux1.cso.uiuc.edu> steven@pacific.csl.uiuc.edu writes:
>Can anyone (ibm?) recommend the proper compilers to use in compiling
>the server directory for AOS/mpel?  I tried a vanilla compile which does
>everything as hc (2.1s) -O and the results seem less than wonderful --
>specifically, magic (6.0 beta) causes the server to go off into the trees
>by trying to draw some scrollbar glyphs manually using XDrawPoint().

I recently sent in a fix for this bug.

Subject: Fix for IBM Megapel PolyPoint
Date: Sat, 06 Jan 90 23:58:48 EST
From: John Carr <jfc@ATHENA.MIT.EDU>


VERSION:
	R4

CLIENT MACHINE and OPERATING SYSTEM:
	IBM RT, BSD 4.3

DISPLAY TYPE:
	IBM Megapel

WINDOW MANAGER:
	N/A

AREA:
	server

SYNOPSIS:
	Large poly point requests hang the server

DESCRIPTION:
	The X server does not verify that the size of a command
	sent to the megapel adapter is legal.  Poly point requests
	with 8K or more points are too large.  The server hangs in
	transmitting such a command because the adapter can not
	properly process it.

REPEAT BY:
	Run "xgc" and choose the points test.

SAMPLE FIX:

*** /afs/testers/src/x11r4/src/mit/server/ddx/ibm/mpel/mpelPolyPt.c	Thu Nov  9 22:52:22 1989
--- mpelPolyPt.c	Sat Jan  6 23:34:49 1990
***************
*** 52,57 ****
--- 52,60 ----
  extern int mpelCheckCursor() ;
  extern void mpelReplaceCursor() ;
  
+ /* The maximum number of points in a Polymarker request. */
+ #define MAXRQPTS	(32760 / sizeof(mpelPoint))
+ 
  void
  mpelPolyPoint( pDrawable, pGC, mode, npt, pptInit )
  DrawablePtr	pDrawable ;
***************
*** 65,74 ****
  	register RegionPtr pRegion = devPriv->pCompositeClip ;
  	int	cursor_saved ;
  
! 	TRACE( ("mpelPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
! 		pDrawable, pGC, mode, npt, pptInit ) ) ;
  
! 	if ( pGC->alu == GXnoop || REGION_NIL(pRegion) )
  		return ;
  
  	if ( pDrawable->type == DRAWABLE_PIXMAP ) {
--- 68,78 ----
  	register RegionPtr pRegion = devPriv->pCompositeClip ;
  	int	cursor_saved ;
  
! 	TRACE( ("mpelPolyPoint(0x%x,0x%x,\"%s\",%d,0x%x)\n",
! 		pDrawable, pGC, (mode == CoordModePrevious) ?
! 		"Relative" : "Absolute", npt, pptInit));
  
! 	if ( pGC->alu == GXnoop || REGION_NIL(pRegion) || npt == 0)
  		return ;
  
  	if ( pDrawable->type == DRAWABLE_PIXMAP ) {
***************
*** 82,128 ****
  	 */
  	{
  	register const int xorg = pDrawable->x ;
! 	register const int yorg =
! 		( MPEL_HEIGHT - 1 ) - pDrawable->y ;
  	register int nptTmp = npt ;
! 	if ( mode == CoordModePrevious )
! 		for ( ppt = pptInit ; --nptTmp ; ) {
  			ppt++ ;
! 			ppt->x += (ppt-1)->x + xorg ;
! 			ppt->y = yorg - ( ppt->y + (ppt-1)->y ) ;
  		}
! 	else
  		for ( ppt = pptInit ; nptTmp-- ; ppt++ ) {
  			ppt->x += xorg ;
! 			ppt->y = yorg - ppt->y ;
  		}
  	}
! 
! 	{ /* Validate & Translate the point list */
! 		register int (* PointInRegion)() = 
! 			pDrawable->pScreen->PointInRegion ;
!         	register xPoint *mpt ; /* xPoint is the same as mpelPoint */
! 		BoxRec box ; /* Scratch Space */
! 
! 		/* NOTE: pGC->miTranslate is always TRUE in mpel */
! 		for ( ppt = pptInit ;
! 		      npt-- && (* PointInRegion)( pRegion, ppt->x,
! 						  MPEL_HEIGHT - 1 - ppt->y,
! 						  &box ) ;
! 		      ppt++ )
! 			/* Do Nothing */ ;
! 		if ( npt > 0 )
! 			{
! 			for ( mpt = ppt ; npt-- ; ppt++ )
! 				if ( (* PointInRegion)( pRegion, ppt->x,
! 							ppt->y, &box ) )
! 					*mpt++ = *ppt ;
  			}
- 
- 		if ( !( npt = mpt - pptInit) )
- 			return ;
- 
  	}
  	/* If Cursor Is In The Way Remove It */
  	cursor_saved = !mpelcursorSemaphore
  		&& mpelCheckCursor(
--- 86,133 ----
  	 */
  	{
  	register const int xorg = pDrawable->x;
! 	register const int yorg = pDrawable->y;
  	register int nptTmp = npt;
! 	register xPoint *mpt = pptInit;
! 	register int (* PointInRegion)() = pDrawable->pScreen->PointInRegion;
! 	BoxRec box;
! 
! 	if ( mode == CoordModePrevious ) {
! 		ppt = pptInit;
! 		ppt->x += xorg;
! 		ppt->y += yorg;
! 		if((* PointInRegion)( pRegion, ppt->x, ppt->y, &box)) {
! 			mpt->x = ppt->x;
! 			mpt->y = (MPEL_HEIGHT - 1) - ppt->y;
! 			mpt++;
! 		}
! 		while (--nptTmp) {
  			ppt++;
! 			ppt->x += xorg + (ppt-1)->x;
! 			ppt->y = yorg + ppt->y + (ppt-1)->y;
! 			if((* PointInRegion)( pRegion, ppt->x, ppt->y, &box)) {
! 				mpt->x = ppt->x;
! 				mpt->y = (MPEL_HEIGHT - 1) - ppt->y;
! 				mpt++;
  			}
! 		}
! 		npt = mpt - pptInit;
! 	} else {
  		for ( ppt = pptInit ; nptTmp-- ; ppt++ ) {
  			ppt->x += xorg;
! 			ppt->y += yorg;
! 			if((* PointInRegion)( pRegion, ppt->x, ppt->y, &box)) {
! 				mpt->x = ppt->x;
! 				mpt->y = (MPEL_HEIGHT - 1) - ppt->y;
! 				mpt++;
  			}
  		}
! 		npt = mpt - pptInit;
  	}
  	}
+ 	TRACE(("mpelPolyPoint: %d points\n", npt));
+ 	if(!npt)	/* Nothing to do */
+ 		return;
  	/* If Cursor Is In The Way Remove It */
  	cursor_saved = !mpelcursorSemaphore
  		&& mpelCheckCursor(
***************
*** 146,153 ****
  		MPELSetPolymarkerColor( pGC->fgPixel ) ;
  	}
  	MPELSetMarkerType( 1 ) ; /* Magic number for solid dots */
! 	MPELPolymarker( npt, pptInit ) ;
! 
  	if ( cursor_saved )
  		mpelReplaceCursor() ;
  
--- 151,164 ----
  		MPELSetPolymarkerColor( pGC->fgPixel ) ;
  	}
  	MPELSetMarkerType( 1 ) ; /* Magic number for solid dots */
! 	/* Break into bite-sized pieces */
! 	{
! 	  register int rem;
! 	  /* MPELPolymarker does not evaluate any of its arguments
! 	     more than once. */
! 	  for(rem = npt;rem > 0;rem -= MAXRQPTS, pptInit+=MAXRQPTS)
! 	    MPELPolymarker((rem>MAXRQPTS)?MAXRQPTS:rem, pptInit);
! 	}
  	if ( cursor_saved )
  		mpelReplaceCursor() ;
  


  --John Carr (jfc@athena.mit.edu)
  Project Athena Systems Development

schwartz@cs.psu.edu (Scott Schwartz) (01/10/90)

In article <1990Jan9.154135.13344@ux1.cso.uiuc.edu> steven@pacific.csl.uiuc.edu writes:
>Can anyone (ibm?) recommend the proper compilers to use in compiling
>the server directory for AOS/mpel?  I tried a vanilla compile which does
>everything as hc (2.1s) -O and the results seem less than wonderful --
>specifically, magic (6.0 beta) causes the server to go off into the trees
>by trying to draw some scrollbar glyphs manually using XDrawPoint().

Try with gcc, if you have it.  I don't have R4 in hand, yet, so I don't
know if this will win, but hc2.1s definately generates bad code, so you
probably can't do much worse.  (Yes, the codegeneration bugs have been
reported to IBM -- about three months ago.)