[comp.windows.x] X11R3 on an IBM RT/PC

jonnyg@ROVER.UMD.EDU (Jon Greenblatt) (03/15/89)

	Has anyone been successful getting the megapel display to work
on the RT or the vga to work on the 6152 under X11R3 on the DEC 22'nd
release of AOS. If so, could you please tell me what steps you went
throught to compiler or fixes you made.

				Thanks,

					JonnyG.
					(jonnyg@rover.umd.edu)
					(jonnyg@umd5.umd.edu)

Richard.Draves@RPD.MACH.CS.CMU.EDU (03/21/89)

I sent out an earlier version of these fixes a few months ago.
This version fixes a couple more bugs.  These diffs are relative
to virgin X11R3 sources.

These are fixes to make the R3 server work on IBM RTs.  The only patch
outside of the ddx/ibm directory is for ddx/mi/miglblt.c, to correct
a problem that the IBM ppc code tickles.

CMU uses these fixes on RTs running Mach, but they are not Mach specific.
The patches add some code conditional on VIKING.  This is for a
small protocol extension that adds an XResetViking command, to work
around a bug in the AED microcode that scrambles its font store.
You can't turn on VIKING without more code that isn't included here.

I still observe some problems.  On AEDs, there is the font-store
problem.  There are still occasional display glitches on apa-16
displays; I picked up some QUEUE_WAIT() fixes from the ITC but
it probably needs more of them.  Most often a twm title bar won't
get (un)highlighted properly.  Sometimes a cursor gets trashed.  Rarely,
the apa-16 font cache gets scribbled on.  The Megapel code still has
two easy-to-reproduce bugs.  First, when scrolling out from under an
obscured region of an xterm window the newly exposed region doesn't
get refreshed properly.  Second, the text code glitches frequently
when displaying the new Courier fonts, especially when they get
highlighted in an xterm window.

server/ddx/mi/miglblt.c:
	fixed miPolyGlyphBlt to handle 0x0 glyphs.
	update x pos for all glyphs, but skip drawing 0x0 glyphs.
	the IBM ppc code seems to trigger this situation.

server/ddx/ibm/BSDrt/OSio.h:
	made OS_ScreenStateChange macro conditional
	on SIGGRANT, so it does nothing if SIGGRANT isn't defined.

server/ddx/ibm/apa16/apa16Text.c:
	picked up fixes for text with variable-width characters from ITC.

server/ddx/ibm/apa16/apa16{Tile,BBlt,PntA}.c:
	picked up QUEUE_WAIT()s from ITC.  these attempt to fix
	some of the random glitches that hit the apa-16.

server/ddx/ibm/aed/aedCursor.c:
	fixed cursor colors

server/ddx/ibm/aed/aedUtils.c:
	revised vikwait().  the original code didn't work
	for some obscure not-really-understood reason.
	this might be a Mach thing, but the new code isn't
	Mach-specific so I'm including it.

server/ddx/ibm/aed/aedFont.c:
	fixed "char fault on unknown character" messages

server/ddx/ibm/mpel/mpelScrInit.c:
	initialize devPriv->replicateArea

server/ddx/ibm/mpel/mpel{Fifo.h,Font.c,Img.c,Tile.c,Util.c}:
	keep mpel from dereferencing a null pointer for mpel hardware noop.
	I was debugging in a way that trapped these refs;
	normally they aren't a problem.

server/ddx/ibm/apa16/apa16FlSp.c:
	fixed use of DoRop for PURDUE

server/ddx/ibm/mpel/mpelGC.c:
	register validation-time interest in all changes, so that
	miValidateBackingStore always gets called when appropriate.
	fixes bug that kept BS from noticing font changes.

server/ddx/ibm/common/ibmIO.c:
	fixed bug that dragged cursors from apa-16 onto Megapel

Rich Draves (rpd@cs.cmu.edu)

*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/mi/miglblt.c	Tue Sep  6 14:49:16 1988
--- server/ddx/mi/miglblt.c	Fri Dec 30 01:36:19 1988
***************
*** 112,140 ****
      while(nglyph--)
      {
  	pci = *ppci++;
- 	pglyph = pglyphBase + pci->byteOffset;
- 	gWidth = GLYPHWIDTHPIXELS(pci);
- 	gHeight = GLYPHHEIGHTPIXELS(pci);
- 	nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
- 	nbyPadGlyph = PixmapBytePad(gWidth, 1);
  
! 	for (i=0, pb = pbits; i<gHeight; i++, pb = pbits+(i*nbyPadGlyph))
! 	    for (j = 0; j < nbyGlyphWidth; j++)
! 		*pb++ = *pglyph++;
  
  
! 	if ((pGCtmp->serialNumber) != (pPixmap->drawable.serialNumber))
! 	    ValidateGC(pPixmap, pGCtmp);
! 	(*pGCtmp->PutImage)(pPixmap, pGCtmp, pPixmap->drawable.depth,
! 			    0, 0, gWidth, gHeight, 
! 			    0, XYBitmap, pbits);
  
! 	if ((pGC->serialNumber) != (pDrawable->serialNumber))
! 	    ValidateGC(pDrawable, pGC);
! 	(*pGC->PushPixels)(pGC, pPixmap, pDrawable,
! 			   gWidth, gHeight,
! 			   x + pci->metrics.leftSideBearing,
! 			   y - pci->metrics.ascent);
  	x += pci->metrics.characterWidth;
      }
      (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
--- 112,141 ----
      while(nglyph--)
      {
  	pci = *ppci++;
  
! 	if (((gWidth = GLYPHWIDTHPIXELS(pci)) != 0) &&
! 	    ((gHeight = GLYPHHEIGHTPIXELS(pci)) != 0)) {
! 	    pglyph = pglyphBase + pci->byteOffset;
! 	    nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
! 	    nbyPadGlyph = PixmapBytePad(gWidth, 1);
  
+ 	    for (i=0, pb = pbits; i<gHeight; i++, pb = pbits+(i*nbyPadGlyph))
+ 		for (j = 0; j < nbyGlyphWidth; j++)
+ 		    *pb++ = *pglyph++;
  
! 	    if ((pGCtmp->serialNumber) != (pPixmap->drawable.serialNumber))
! 		ValidateGC(pPixmap, pGCtmp);
! 	    (*pGCtmp->PutImage)(pPixmap, pGCtmp, pPixmap->drawable.depth,
! 				0, 0, gWidth, gHeight, 
! 				0, XYBitmap, pbits);
  
! 	    if ((pGC->serialNumber) != (pDrawable->serialNumber))
! 		ValidateGC(pDrawable, pGC);
! 	    (*pGC->PushPixels)(pGC, pPixmap, pDrawable,
! 			       gWidth, gHeight,
! 			       x + pci->metrics.leftSideBearing,
! 			       y - pci->metrics.ascent);
! 	}
  	x += pci->metrics.characterWidth;
      }
      (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/BSDrt/OSio.h	Tue Oct 25 06:55:21 1988
--- server/ddx/ibm/BSDrt/OSio.h	Mon Nov  7 11:57:47 1988
***************
*** 46,52 ****
--- 46,56 ----
  
  #define	OS_PreScreenInit()	BSDMachineDependentInit()
  #define	OS_PostScreenInit()	BSDInitEmulator()
+ #ifdef	SIGGRANT
  #define	OS_ScreenStateChange(e)	BSDScreenStateChange(e)
+ #else	SIGGRANT
+ #define	OS_ScreenStateChange(e)
+ #endif	SIGGRANT
  
  #define	OS_GetDefaultScreens()
  #define	OS_InitInput()
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/aed/aedCursor.c	Tue Oct 25 06:55:45 1988
--- server/ddx/ibm/aed/aedCursor.c	Thu Dec  1 01:12:05 1988
***************
*** 142,147 ****
--- 142,148 ----
      ScreenPtr	pScr;
      CursorPtr	pCurs;
  {
+     unsigned long int *pStart;
      register unsigned long int *pImage, *pMask;
      register unsigned long int *psrcImage, *psrcMask;
      register int srcHeight;
***************
*** 148,153 ****
--- 149,155 ----
      register unsigned long int endbits;
      int srcWidth;
      int srcRealWidth;
+     int i;
  
      TRACE(("aedRealizeCursor( pScr= 0x%x, pCurs= 0x%x)\n",pScr,pCurs));
  
***************
*** 156,162 ****
  	ErrorF("aedRealizeCursor: can't malloc\n");
  	return FALSE;
  	}
!     pMask = (unsigned long int *) pCurs->devPriv[pScr->myNum];
      pImage = pMask + 128;
      bzero((char *) pMask, 1024);
      psrcImage = pCurs->source;
--- 158,164 ----
  	ErrorF("aedRealizeCursor: can't malloc\n");
  	return FALSE;
  	}
!     pStart = pMask = (unsigned long int *) pCurs->devPriv[pScr->myNum];
      pImage = pMask + 128;
      bzero((char *) pMask, 1024);
      psrcImage = pCurs->source;
***************
*** 187,192 ****
--- 189,216 ----
  	    *pMask++  = *psrcMask++ ;
  	    *pImage++ = *psrcImage++ & endbits;
  	    *pMask++  = *psrcMask++  & endbits;
+ 	}
+ 
+     pMask = pStart;
+     pImage = pMask + 128;
+     if ((pCurs->foreRed + pCurs->foreGreen + pCurs->foreBlue) >
+ 	(pCurs->backRed + pCurs->backGreen + pCurs->backBlue))
+ 	for (i = 0; i < 128; i++)
+ 	{
+ 	    unsigned long int mask = *pMask;
+ 	    unsigned long int source = *pImage;
+ 
+ 	    *pMask++ = mask & ~source;
+ 	    *pImage++ = mask & source;
+ 	}
+     else
+ 	for (i = 0; i < 128; i++)
+ 	{
+ 	    unsigned long int mask = *pMask;
+ 	    unsigned long int source = *pImage;
+ 
+ 	    *pMask++ = mask & source;
+ 	    *pImage++ = mask & ~source;
  	}
  
      if (!ibmCurrentCursor(pScr->myNum)) {
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/aed/aedFont.c	Tue Oct 25 06:55:35 1988
--- server/ddx/ibm/aed/aedFont.c	Wed Nov 30 23:42:20 1988
***************
*** 152,158 ****
      TRACE(("aedUnrealizeFont( pscr=0x%x, pFont=0x%x)\n", pscr, pFont));
      if ( ( fontnum = (int)pFont->devPriv[ pscr->myNum ] ) != 0 )
      {
- #ifdef THISISDELETEDTOTRYANDFIXTHEAEDBUG
  	for ( i = 0 ; i < 256; i++ )
  	{
  	    vikint[1] = 6;	/* delete character */
--- 152,157 ----
***************
*** 164,170 ****
  	vikint[1] = 5;	/* delete font */
  	vikint[2] = fontnum;
  	command(2);
- #endif
  	aedRealizedFonts[fontnum] = (FontPtr)NULL;
      }
      TRACE(("unrealized font #%d\n",(int)pFont->devPriv[pscr->myNum]));
--- 163,168 ----
***************
*** 172,177 ****
--- 170,211 ----
      return(TRUE);
  }
  
+ /* This code is derived from the Linear8Bit case in GetGlyphs. */
+ 
+ static void
+ aedFontFault(font, vikptr)
+     FontPtr font;
+     register volatile unsigned short *vikptr;
+ {
+     CharInfoPtr		pCI = font->pCI;
+     FontInfoPtr		pFI = font->pFI;
+     unsigned int	firstCol = pFI->firstCol;
+     unsigned int	numCols = pFI->lastCol - firstCol + 1;
+     unsigned int	chDefault = pFI->chDefault;
+     unsigned int	cDef = chDefault - firstCol;
+     register unsigned int	i;
+ 
+     if (pFI->allExist && (cDef < numCols))
+     {
+         for (i = 0; i < 256; i++)
+ 	    VIKSTORE(*vikptr++, 0);
+     }
+     else
+     {
+ 	for (i = 0; i < 256; i++)
+ 	{
+ 	    register unsigned int c = i - firstCol;
+ 	    
+ 	    if ((c < numCols) && pCI[c].exists)
+ 		VIKSTORE(*vikptr++, 0);
+ 	    else if ((cDef < numCols) && pCI[cDef].exists)
+ 		VIKSTORE(*vikptr++, 0);
+ 	    else
+ 		VIKSTORE(*vikptr++, 1);
+ 	} 
+     }
+ }
+ 
  #define vikcmd ((volatile unsigned short *)(VIKROOT + 0x4002))
  aedCheckFault()
  {
***************
*** 198,210 ****
  	{
  	    case 1:
  		fontid = VIKLOAD(*(pvikcmd+1));
! 		if ( aedRealizedFonts[fontid] != 0 )
  		{
  		    TRACE(("Font fault on font #%d\n",fontid));
  		    VIKSTORE(*(pvikcmd) , 1);	/* font available */
! 		    vikptr = pvikcmd+1;
! 		    for ( i=0; i<256; i++ )
! 			VIKSTORE(*vikptr++ , 0);
  		    VIKSTORE(*semaphore , 0x0101);
  		}
  		else
--- 232,242 ----
  	{
  	    case 1:
  		fontid = VIKLOAD(*(pvikcmd+1));
! 		if ( (pFont = aedRealizedFonts[fontid]) != 0 )
  		{
  		    TRACE(("Font fault on font #%d\n",fontid));
  		    VIKSTORE(*(pvikcmd) , 1);	/* font available */
! 		    aedFontFault(pFont, pvikcmd+1);
  		    VIKSTORE(*semaphore , 0x0101);
  		}
  		else
***************
*** 226,261 ****
  		    {
  			pglyph = ((char *)pFont->pGlyphs)+ci->byteOffset;
  			vikptr = pvikcmd;
! 			w = GLYPHWIDTHPIXELS((ci));
! 			h = GLYPHHEIGHTPIXELS((ci));
! 			widthGlyph = GLYPHWIDTHBYTESPADDED((ci));
! 			widthShorts = widthGlyph >> 1;
! 			oddWidth = widthGlyph != ( widthShorts << 1 );
! 			len = h*((w+15)/16) + 9;
! 			VIKSTORE(*vikptr++ , 1);	/* char available */
! 			VIKSTORE(*vikptr++ , len);
! 			VIKSTORE(*vikptr++ , 6);	/* move relative order */
! 			VIKSTORE(*vikptr++ , ci->metrics.leftSideBearing);
! 			VIKSTORE(*vikptr++ , -ci->metrics.ascent);
! 			VIKSTORE(*vikptr++ , 9);	/* draw image */
! 			VIKSTORE(*vikptr++ , w);
! 			VIKSTORE(*vikptr++ , h);
! 			pdst = vikptr;	 
! 			for ( i=0; i<h; i++ )
  			{
! 			    for( j=0; j < widthGlyph; j++ )
! 				VIKSTOREB(*pdst++ , *pglyph++);
! 			    vikptr = vikptr + widthShorts;
! 			    if ( oddWidth )
  			    {
! 				vikptr++;
! 				VIKSTOREB(*pdst++ , (char)0);
  			    }
  			}
- 			VIKSTORE(*vikptr++ , 6);	/* move relative */
- 			VIKSTORE(*vikptr++ , ci->metrics.characterWidth - ci->metrics.leftSideBearing);
- 			VIKSTORE(*vikptr++ , ci->metrics.ascent);
- 			VIKSTORE(*semaphore , 0x0101);
  		    }
  		    else
  		    {
--- 258,305 ----
  		    {
  			pglyph = ((char *)pFont->pGlyphs)+ci->byteOffset;
  			vikptr = pvikcmd;
! 			if (((w = GLYPHWIDTHPIXELS(ci)) == 0) ||
! 			    ((h = GLYPHHEIGHTPIXELS(ci)) == 0))
  			{
! 			    /* no glyph, so just move right */
! 			    VIKSTORE(*vikptr++, 1); /* char available */
! 			    VIKSTORE(*vikptr++, 3);
! 			    VIKSTORE(*vikptr++, 6); /* move relative order */
! 			    VIKSTORE(*vikptr++, ci->metrics.characterWidth);
! 			    VIKSTORE(*vikptr++, 0);
! 			    VIKSTORE(*semaphore, 0x0101);
! 			}
! 			else
! 			{
! 			    widthGlyph = GLYPHWIDTHBYTESPADDED((ci));
! 			    widthShorts = widthGlyph >> 1;
! 			    oddWidth = widthGlyph != ( widthShorts << 1 );
! 			    len = h*((w+15)/16) + 9;
! 			    VIKSTORE(*vikptr++ , 1);	/* char available */
! 			    VIKSTORE(*vikptr++ , len);
! 			    VIKSTORE(*vikptr++ , 6);	/* move relative order */
! 			    VIKSTORE(*vikptr++ , ci->metrics.leftSideBearing);
! 			    VIKSTORE(*vikptr++ , -ci->metrics.ascent);
! 			    VIKSTORE(*vikptr++ , 9);	/* draw image */
! 			    VIKSTORE(*vikptr++ , w);
! 			    VIKSTORE(*vikptr++ , h);
! 			    pdst = vikptr;	 
! 			    for ( i=0; i<h; i++ )
  			    {
! 				for( j=0; j < widthGlyph; j++ )
! 				    VIKSTOREB(*pdst++ , *pglyph++);
! 				vikptr = vikptr + widthShorts;
! 				if ( oddWidth )
! 				{
! 				    vikptr++;
! 				    VIKSTOREB(*pdst++ , (char)0);
! 				}
  			    }
+ 			    VIKSTORE(*vikptr++ , 6);	/* move relative */
+ 			    VIKSTORE(*vikptr++ , ci->metrics.characterWidth - ci->metrics.leftSideBearing);
+ 			    VIKSTORE(*vikptr++ , ci->metrics.ascent);
+ 			    VIKSTORE(*semaphore , 0x0101);
  			}
  		    }
  		    else
  		    {
***************
*** 278,280 ****
--- 322,344 ----
      vikwait();
      }
  }
+ 
+ #ifdef	VIKING
+ 
+ void
+ aedResetViking(pScreen)
+     ScreenPtr pScreen;
+ {
+     volatile unsigned short *pvikcmd = vikcmd;
+ 
+     TRACE(("aedResetViking(pScreen=0x%x)\n", pScreen));
+ 
+     vforce();
+     vikwait();
+ 
+     VIKSTORE(*pvikcmd, 0);		/* reset font store */
+     VIKSTORE(*semaphore, 0x0101);
+     vikwait();
+ }
+ 
+ #endif	VIKING
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/aed/aedProcs.h	Tue Oct 25 06:55:38 1988
--- server/ddx/ibm/aed/aedProcs.h	Wed Nov 30 23:01:59 1988
***************
*** 59,61 ****
--- 59,64 ----
  extern Bool aedUnrealizeFont();
  extern void aedImageText8();
  extern int aedPolyText8();
+ #ifdef	VIKING
+ extern void aedResetViking();
+ #endif	VIKING
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/aed/aedScrInit.c	Tue Oct 25 06:55:39 1988
--- server/ddx/ibm/aed/aedScrInit.c	Wed Nov 30 23:04:01 1988
***************
*** 178,183 ****
--- 178,187 ----
      pScreen->blockData = (pointer)0;
      pScreen->wakeupData = (pointer)0;
  
+ #ifdef	VIKING
+     pScreen->ResetViking = aedResetViking;
+ #endif	VIKING
+ 
      pVisual->vid = pScreen->rootVisual;
      pVisual->screen = index;
      pVisual->class = StaticGray;
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/aed/aedUtils.c	Tue Oct 25 06:55:39 1988
--- server/ddx/ibm/aed/aedUtils.c	Thu Dec  1 02:45:14 1988
***************
*** 40,59 ****
  int		vikoff = 0;     /* offset into viking buffer */
  int 		mergexlate[16] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
  
  
  vikwait()
  {
  int i, poll;
  i=0;
! while(VIKLOAD(*semaphore))
  	{
! 	for(poll = 1000; poll != 0; poll--); /* do nothing */
  		/* we need a sleep of microseconds for this */
! 	if (i++ >= 1000)
  		{
! 		ErrorF("vikwait: Semaphore apparently hung.\n");
! 		return(-1);
  		}
  	}
  return(i);
  }
--- 40,73 ----
  int		vikoff = 0;     /* offset into viking buffer */
  int 		mergexlate[16] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
  
+ #define	STANDALONE	1
+ #include <machine/machparam.h>
+ #undef	STANDALONE
  
+ static int aed_max_poll = 64;
+ static int aed_max_loops = 14000;
+ 
  vikwait()
  {
  int i, poll;
+ unsigned short value;
  i=0;
! DELAY(1);
! value = VIKLOAD(*semaphore);
! while(value)
  	{
! 	for(poll = aed_max_poll; poll != 0; poll--); /* do nothing */
  		/* we need a sleep of microseconds for this */
! 	if (i++ >= aed_max_loops)
  		{
! 		    ErrorF("vikwait: Semaphore apparently hung.\n");
! 		    /*
! 		     * Reset and keep waiting instead of aborting.
! 		     */
! 		    i = 0;
  		}
+ 	DELAY(1);
+ 	value = VIKLOAD(*semaphore);
  	}
  return(i);
  }
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16BBlt.c	Tue Oct 25 06:56:03 1988
--- server/ddx/ibm/apa16/apa16BBlt.c	Mon Nov 28 10:57:18 1988
***************
*** 202,212 ****
      if (pGC->planemask&1)
  	apa16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu, prgnDst, pptSrc);
  
!     if (((mfbPrivGC *)(pGC->devPriv))->fExpose)
          prgnExposed= miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
  		          	origSource.x, origSource.y,
  		          	origSource.width, origSource.height,
! 		          	origDest.x, origDest.y);
  		
      DEALLOCATE_LOCAL(pptSrc);
  freeRegions:
--- 202,214 ----
      if (pGC->planemask&1)
  	apa16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu, prgnDst, pptSrc);
  
!     if (((mfbPrivGC *)(pGC->devPriv))->fExpose) {
!         QUEUE_WAIT();
          prgnExposed= miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
  		          	origSource.x, origSource.y,
  		          	origSource.width, origSource.height,
!                                 origDest.x, origDest.y);
!     }
  		
      DEALLOCATE_LOCAL(pptSrc);
  freeRegions:
***************
*** 260,266 ****
  
      if ((pSrcDrawable->type != DRAWABLE_WINDOW)||
  	(pDstDrawable->type != DRAWABLE_WINDOW)||
! 	(alu==GXorReverse)||(alu==GXequiv)) {
  	mfbDoBitblt(pSrcDrawable,pDstDrawable,alu,prgnDst,pptSrc);
  	return;
      }
--- 262,269 ----
  
      if ((pSrcDrawable->type != DRAWABLE_WINDOW)||
  	(pDstDrawable->type != DRAWABLE_WINDOW)||
!         (alu==GXorReverse)||(alu==GXequiv)) {
!         QUEUE_WAIT();
  	mfbDoBitblt(pSrcDrawable,pDstDrawable,alu,prgnDst,pptSrc);
  	return;
      }
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16FlSp.c	Tue Oct 25 06:55:48 1988
--- server/ddx/ibm/apa16/apa16FlSp.c	Sat Dec 10 22:53:09 1988
***************
*** 598,604 ****
--- 598,608 ----
  		    while(nlMiddle--)
  		    {
  			    getbits(psrc, nstart, 32, tmpSrc);
+ #ifdef	PURDUE
+ 			    DoRop(*pdst, rop, tmpSrc, *pdst);
+ #else	PURDUE
  			    *pdst = DoRop(rop, tmpSrc, *pdst);
+ #endif	PURDUE
  			    pdst++;
  			    psrc++;
  		    }
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16IO.c	Tue Oct 25 06:55:50 1988
--- server/ddx/ibm/apa16/apa16IO.c	Thu Dec  1 00:22:41 1988
***************
*** 128,133 ****
--- 128,137 ----
      pScreen->BlockHandler=	OS_BlockHandler;
      pScreen->WakeupHandler=	OS_WakeupHandler;
  
+ #ifdef	VIKING
+     pScreen->ResetViking=	0;
+ #endif	VIKING
+ 
      if (!ibmAllowBackingStore)
  	pScreen->backingStoreSupport = NotUseful;
  
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16PntA.c	Tue Oct 25 06:55:51 1988
--- server/ddx/ibm/apa16/apa16PntA.c	Mon Nov 28 10:57:19 1988
***************
*** 90,95 ****
--- 90,96 ----
  
      if (pDraw->type != DRAWABLE_WINDOW)
      {
+         QUEUE_WAIT();
  	if (rrop==RROP_BLACK)	
  	    mfbSolidBlackArea(pDraw,nbox,pbox,rrop,nop);
  	else if (rrop==RROP_WHITE)
***************
*** 156,161 ****
--- 157,164 ----
  
  
      unsigned int *pbits;	/* pointer to start of drawable */
+ 
+     QUEUE_WAIT();
  
      if (pDraw->type == DRAWABLE_WINDOW)
      {
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16Text.c	Tue Oct 25 06:55:49 1988
--- server/ddx/ibm/apa16/apa16Text.c	Mon Nov 28 10:57:16 1988
***************
*** 218,228 ****
  			afMap(aFont,count,charsOut,tmpCinfo,
  						aFont->afFont->pGlyphs);
  		    }
- 		    if (afChMapped(aFont,*charsOut)) {
- 			metrics=	&tmpCinfo[0]->metrics;
- 			width=		metrics->rightSideBearing-
- 					metrics->leftSideBearing;
  
  			COPY_RECT(bltCmd,
  				x+metrics->rightSideBearing,
  				y+metrics->descent,
--- 218,229 ----
  			afMap(aFont,count,charsOut,tmpCinfo,
  						aFont->afFont->pGlyphs);
  		    }
  
+ 		    metrics=	&tmpCinfo[0]->metrics;
+ 		    width=	metrics->rightSideBearing-
+ 				metrics->leftSideBearing;
+ 
+ 		    if (afChMapped(aFont,*charsOut)) {
  			COPY_RECT(bltCmd,
  				x+metrics->rightSideBearing,
  				y+metrics->descent,
***************
*** 407,417 ****
  			afMap(aFont,count,charsOut,tmpCinfo,
  						aFont->afFont->pGlyphs);
  		    }
- 		    if (afChMapped(aFont,*charsOut)) {
- 			metrics=	&tmpCinfo[0]->metrics;
- 			width=		metrics->rightSideBearing-
- 					metrics->leftSideBearing;
  
  			COPY_RECT(bltCmd,
  				x+metrics->leftSideBearing+width,
  				y+metrics->descent,
--- 408,419 ----
  			afMap(aFont,count,charsOut,tmpCinfo,
  						aFont->afFont->pGlyphs);
  		    }
  
+ 		    metrics=	&tmpCinfo[0]->metrics;
+ 		    width=	metrics->rightSideBearing-
+                                 metrics->leftSideBearing;
+ 
+ 		    if (afChMapped(aFont,*charsOut)) {
  			COPY_RECT(bltCmd,
  				x+metrics->leftSideBearing+width,
  				y+metrics->descent,
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16Tile.c	Tue Oct 25 06:56:02 1988
--- server/ddx/ibm/apa16/apa16Tile.c	Mon Nov 28 10:57:17 1988
***************
*** 163,170 ****
      tileWidth = ptile->width ;
  
      if ( pDraw->type != DRAWABLE_WINDOW ) {
! 	if ( tileWidth == 32 )
! 		mfbTileArea32( pDraw, nbox, pbox, alu, ptile ) ;
  	else
  puts( "Tile Width != 32. I give up!" ) ;
  /*		mfbTileAreaXX( pDraw, nbox, pbox, alu, ptile ) ; */
--- 163,172 ----
      tileWidth = ptile->width ;
  
      if ( pDraw->type != DRAWABLE_WINDOW ) {
!         if ( tileWidth == 32 ) {
!                 QUEUE_WAIT();
!                 mfbTileArea32( pDraw, nbox, pbox, alu, ptile ) ;
!         }
  	else
  puts( "Tile Width != 32. I give up!" ) ;
  /*		mfbTileAreaXX( pDraw, nbox, pbox, alu, ptile ) ; */
***************
*** 266,272 ****
  	    unsigned cmd;
  
  	    APA16_GET_CMD(ROP_RECT_COPY,alu,cmd);
! 	    if (cmd==0) {
  		mfbTileArea32( pDraw, nbox, pbox, alu, ptile );
  		return;
  	    }
--- 268,275 ----
  	    unsigned cmd;
  
  	    APA16_GET_CMD(ROP_RECT_COPY,alu,cmd);
!             if (cmd==0) {
!                 QUEUE_WAIT();
  		mfbTileArea32( pDraw, nbox, pbox, alu, ptile );
  		return;
  	    }
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/apa16/apa16WLine.c	Tue Oct 25 06:55:51 1988
--- server/ddx/ibm/apa16/apa16WLine.c	Wed Nov  9 22:22:06 1988
***************
*** 44,55 ****
  
  ******************************************************************/
  
! /* $Header: /andrew/X11/R3src/Xbeta/server/ddx/ibm/apa16/RCS/apa16WLine.c,v 9.1 88/10/17 14:45:17 erik Exp $ */
! /* $Source: /andrew/X11/R3src/Xbeta/server/ddx/ibm/apa16/RCS/apa16WLine.c,v $ */
  
  #ifndef lint
  static char sccsid[] = "@(#)apa16wline.c	3.1 88/09/22 09:31:23";
! static char *rcsid = "$Header: /andrew/X11/R3src/Xbeta/server/ddx/ibm/apa16/RCS/apa16WLine.c,v 9.1 88/10/17 14:45:17 erik Exp $";
  #endif
  
  #include "X.h"
--- 44,55 ----
  
  ******************************************************************/
  
! /* $Header: apa16WLine.c,v 1.2 88/10/31 14:25:01 rws Exp $ */
! /* $Source: /usr/expo/X/core.src/server/ddx/ibm/apa16/RCS/apa16WLine.c,v $ */
  
  #ifndef lint
  static char sccsid[] = "@(#)apa16wline.c	3.1 88/09/22 09:31:23";
! static char *rcsid = "$Header: apa16WLine.c,v 1.2 88/10/31 14:25:01 rws Exp $";
  #endif
  
  #include "X.h"
***************
*** 138,146 ****
  			SppPts[1].x = (double)tmpPts[1].x;
  			SppPts[1].y = (double)tmpPts[1].y;
  	    		SppPts[0] = 
! 				miExtendSegment(SppPts[0], SppPts[1], width/2);
  	    		SppPts[1] =
! 				miExtendSegment(SppPts[1], SppPts[0], width/2);
  		}
  	    }
  	}
--- 138,146 ----
  			SppPts[1].x = (double)tmpPts[1].x;
  			SppPts[1].y = (double)tmpPts[1].y;
  	    		SppPts[0] = 
! 				miExtendSegment(SppPts[0], SppPts[1], width/2.0);
  	    		SppPts[1] =
! 				miExtendSegment(SppPts[1], SppPts[0], width/2.0);
  		}
  	    }
  	}
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/common/ibmIO.c	Tue Oct 25 06:57:18 1988
--- server/ddx/ibm/common/ibmIO.c	Fri Dec 30 01:22:59 1988
***************
*** 218,231 ****
  		  ( y -= screenInfo->ibm_ScreenBounds.y1 ) ;
  
  		if ( oldScr != ibmCurrentScreen ) {
- 		    CursorPtr	prevCursor= screenInfo->ibm_CurrentCursor;
  		    (*ibmHideCursor( oldScr ) )( oldScr ) ;
  		    NewCurrentScreen( screenInfo->ibm_Screen, x, y ) ;
- 		    if ( screenInfo->ibm_CurrentCursor == prevCursor ) {
- 			(* screenInfo->ibm_Screen->DisplayCursor )(
- 					screenInfo->ibm_Screen,
- 					ibmCurrentCursor( oldScr ) ) ;
- 		    }
  		}
  
  		if (pE->xe_device==XE_MOUSE) {
--- 218,225 ----
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelFifo.h	Tue Oct 25 22:25:15 1988
--- server/ddx/ibm/mpel/mpelFifo.h	Sat Dec 10 15:34:44 1988
***************
*** 60,65 ****
--- 60,67 ----
  extern	void	mfData();
  #endif /* PORTABLE */
  
+ extern int MPELNoOpData;
+ 
  #define	MPELSetLineType(t)			mfCmd1Arg(0x5040,(t))
  #define	MPELSetPolylineColor(i)			mfCmd1Arg(0x5042,(i))
  #define	MPELSetMarkerType(t)			mfCmd1Arg(0x5043,(t))
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelFont.c	Tue Oct 25 22:25:16 1988
--- server/ddx/ibm/mpel/mpelFont.c	Sat Dec 10 15:33:08 1988
***************
*** 273,279 ****
  
      TRACE(("mpelCleanXFont(0x%x)\n",xFont));
  
!     MPELNoOp(2,0);
      MPELWaitFifo();
      /* First, free any bands the font is holding */
      band= xFont->currentBand;
--- 273,279 ----
  
      TRACE(("mpelCleanXFont(0x%x)\n",xFont));
  
!     MPELNoOp(2,&MPELNoOpData);
      MPELWaitFifo();
      /* First, free any bands the font is holding */
      band= xFont->currentBand;
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelGC.c	Tue Oct 25 22:25:16 1988
--- server/ddx/ibm/mpel/mpelGC.c	Fri Dec 30 01:19:10 1988
***************
*** 79,88 ****
  
  extern void ppcWideLine();	/* should be in ppcProcs.h */
  
! #define mpelGCInterestValidateMask \
! ( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground	\
! | GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT		\
! | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
  
  Bool
  mpelCreateGC(pGC)
--- 79,85 ----
  
  extern void ppcWideLine();	/* should be in ppcProcs.h */
  
! #define mpelGCInterestValidateMask	(~0)
  
  Bool
  mpelCreateGC(pGC)
***************
*** 473,480 ****
  	    break;
  
  	default:
- 	    ErrorF("mpelValidateGC: Unexpected GC Change\n") ;
- 	    changes &= ~ index ; /* Remove it anyway */
  	    break;
  	}
      }
--- 470,475 ----
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelImg.c	Tue Oct 25 22:25:17 1988
--- server/ddx/ibm/mpel/mpelImg.c	Sat Dec 10 15:33:10 1988
***************
*** 134,140 ****
  	        MOVE( data, (volatile unsigned char *) MPEL_BLIT_STAGE, w*nh) ;
  
  	    MPELSrcBLTVPM( &blt ) ;
! 	    MPELNoOp( 2, 0 ) ;
  	} /* end while */
      } /* end else */
  
--- 134,140 ----
  	        MOVE( data, (volatile unsigned char *) MPEL_BLIT_STAGE, w*nh) ;
  
  	    MPELSrcBLTVPM( &blt ) ;
! 	    MPELNoOp( 2, &MPELNoOpData ) ;
  	} /* end while */
      } /* end else */
  
***************
*** 182,188 ****
  	/* do a DestBlt VPM */
  	MPELVPMBLTDest( &blt ) ;
  	/* Make Sure The Transfer is complete */
! 	MPELNoOp( 2, 0 ) ;
  	MPELWaitFifo() ;
  	/* NOW, read the data from the Stage */
  	if ( skip ) {
--- 182,188 ----
  	/* do a DestBlt VPM */
  	MPELVPMBLTDest( &blt ) ;
  	/* Make Sure The Transfer is complete */
! 	MPELNoOp( 2, &MPELNoOpData ) ;
  	MPELWaitFifo() ;
  	/* NOW, read the data from the Stage */
  	if ( skip ) {
***************
*** 210,216 ****
  	    /* do a DestBlt VPM */
  	    MPELVPMBLTDest( &blt ) ;
  	    /* Make Sure The Transfer is complete */
! 	    MPELNoOp( 2, 0 ) ;
  
  	    h -= nh ;
  
--- 210,216 ----
  	    /* do a DestBlt VPM */
  	    MPELVPMBLTDest( &blt ) ;
  	    /* Make Sure The Transfer is complete */
! 	    MPELNoOp( 2, &MPELNoOpData ) ;
  
  	    h -= nh ;
  
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelScrInit.c	Tue Oct 25 22:25:19 1988
--- server/ddx/ibm/mpel/mpelScrInit.c	Sat Dec  3 13:52:51 1988
***************
*** 171,176 ****
--- 171,177 ----
      devPriv->CheckCursor = mpelCheckCursor ;
      devPriv->ReplaceCursor = mpelReplaceCursor ;
      devPriv->DestroyGCPriv = mpelDestroyGCPriv;
+     devPriv->replicateArea = ppcReplicateArea;
  
      pPixmap = (PixmapPtr) pScreen->devPrivate;
  
***************
*** 242,247 ****
--- 243,252 ----
      pScreen->WakeupHandler = OS_WakeupHandler;
      pScreen->blockData = (pointer)0;
      pScreen->wakeupData = (pointer)0;
+ 
+ #ifdef	VIKING
+     pScreen->ResetViking = 0;
+ #endif	VIKING
  
      pVisual->vid = pScreen->rootVisual;
      pVisual->screen = index;
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelTile.c	Tue Oct 25 22:25:20 1988
--- server/ddx/ibm/mpel/mpelTile.c	Sat Dec 10 15:33:11 1988
***************
*** 191,197 ****
      }
  
      if ( widthLeftOver ) {
! 	MPELNoOp( 2, 0 ) ;
  	pdst = ( (volatile unsigned char *)MPEL_BLIT_STAGE )
  	     + MPEL_BLIT_STAGE_SIZE/2;
  	psrc = psrcSave;
--- 191,197 ----
      }
  
      if ( widthLeftOver ) {
! 	MPELNoOp( 2, &MPELNoOpData ) ;
  	pdst = ( (volatile unsigned char *)MPEL_BLIT_STAGE )
  	     + MPEL_BLIT_STAGE_SIZE/2;
  	psrc = psrcSave;
*** /afs/cs.cmu.edu/archive/X.V11R3-source/server/ddx/ibm/mpel/mpelUtil.c	Tue Oct 25 22:25:20 1988
--- server/ddx/ibm/mpel/mpelUtil.c	Sat Dec 10 15:33:45 1988
***************
*** 61,66 ****
--- 61,68 ----
  
  #define MAXRETRY 500
  
+ int MPELNoOpData = 0;
+ 
  mpelRectangle mpelDfltScissor = {
  	{ 0, 0 }, { MPEL_WIDTH - 1, MPEL_HEIGHT - 1 }
  } ;