[comp.sources.x] v03i007: Purdue speedups to R3 server, Release 2, Patch1

mikew@wyse.wyse.com (Mike Wexler) (02/01/89)

Submitted-by: Gene Spafford <spaf@purdue.edu>
Posting-number: Volume 3, Issue 7
Archive-name: p2speedups/patch1



The patch set for Purdue.2.1 I sent out yesterday was wrong.
Enclosed is the correct one.

This should be the last for a while.   The one works on Sun4 machines.

--spaf


# Update #1 to Purdue/Purdue+ patches 2.0 release (2.1)
# Shar archive.  Give the following as input to /bin/sh
#  Packed Wed Jan 25 23:32:34 EST 1989 by spaf@uther.cs.purdue.edu
#
#  This archive contains:
#	README
#	maskbits.h.patch
#	mfbplygblt.c.patch
#
#
echo x - README
sed 's/^X//' >README <<'*-*-END-of-README-*-*'
XThis contains a slight bugfix to the Purdue 2.0 patchset
X(maskbits.h.patch), and a bugfix to the way character glyphs are drawn
Xto the screen (mfbplygblt.c).  The second bugfix is not actually part
Xof the Purdue speedups, but fixes a bug present in the original
Xserver.
X
XApply the:
X   maskbits.h.patch file to the Purdue2.0 version of ddx/mfb/maskbits.h
X   mfbplygblt.c.patch file to the X.V11R3 version of ddx/mfb/mfbplygblt.c
X
X>From: John Irwin <franz!sparky!jdi@ucbarpa.Berkeley.EDU>
X>To: Gene Spafford <purdue.edu!spaf>
X>Cc: citi.umich.edu!martin
X>Date: Tue, 24 Jan 89 12:21:49 -0800
X>Return-Path: <sparky!jdi>
X>Subject: Re: Release 2.0 of Purdue/Purdue+ Speedups 
X>In-Reply-To: Your message of Sun, 22 Jan 89 19:38:34 -0500.
X>             <8901230038.AA05417@uther.cs.purdue.edu> 
X>
X>I guess neither of you has a Sun4, since I just tried to compile a sun4 server
X>with the Purdue 2.0 patches in place and it failed.
X>
X>The problem is that mfbfillsp uses getandputrop.  Since FASTGETBITS and
X>FASTPUTBITS are not defined on the sun4, since it isn't a vax or mc68020,
X>getandputrop is defined as <getbits, putbitsrop>.  However, you put the
X>definition of putbitsrop into a #ifndef PURDUE section, instead of putting it
X>into #ifndef FASTPUTBITS section.  (Thus putbitsrop isn't defined at all)
X>
X>In fact, glancing at the code would indicate that building a sun3 server with
X>NO_3_60_CG4 using sun's cc will fail similarly.
X>
X>	-- John
X
X
XThanks John,
X
XGene & Martin		1/24/89
X
Xspaf@purdue.edu
Xmartin@citi.umich.edu
*-*-END-of-README-*-*
echo x - maskbits.h.patch
sed 's/^X//' >maskbits.h.patch <<'*-*-END-of-maskbits.h.patch-*-*'
X*** ddx/mfb.purdue2.0/maskbits.h	Tue Jan 24 20:24:39 1989
X--- ddx/mfb/maskbits.h	Wed Jan 25 18:34:38 1989
X***************
X*** 1,4 ****
X! /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
X  /***********************************************************
X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X--- 1,4 ----
X! /* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */
X  /***********************************************************
X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X***************
X*** 346,356 ****
X  #endif mc68020
X  #endif __GNUC__
X  
X! /*  The following version is used on 3/60+CG4 machines, and those
X!  *  not defining FASTPUTBITS, above
X   */
X  
X! #define u_putbits(src, x, w, pdst) \
X  { \
X      register int n = (x)+(w)-32; \
X      \
X--- 346,374 ----
X  #endif mc68020
X  #endif __GNUC__
X  
X! /*  The following flag is used to override a bugfix for sun 3/60+CG4 machines,
X   */
X  
X! /*  We don't need to be careful about this unless we're dealing with sun3's 
X!  *  We will default its usage for those who do not know anything, but will
X!  *  override its effect if the machine doesn't look like a sun3 
X!  */
X! #if !defined(mc68020) || !defined(sun)
X! #define NO_3_60_CG4
X! #endif
X! 
X! /* This is gross.  We want to #define u_putbits as something which can be used
X!  * in the case of the 3/60+CG4, but if we use /bin/cc or are on another
X!  * machine type, we want nothing to do with u_putbits.  What a hastle.  Here
X!  * I used slo_putbits as something which either u_putbits or putbits could be
X!  * defined as.
X!  *
X!  * putbits gets it iff it is not already defined with FASTPUTBITS above.
X!  * u_putbits gets it if we have FASTPUTBITS (putbits) from above and have not
X!  * 	overridden the NO_3_60_CG4 flag.
X!  */
X! 
X! #define slo_putbits(src, x, w, pdst) \
X  { \
X      register int n = (x)+(w)-32; \
X      \
X***************
X*** 370,385 ****
X      } \
X  }
X  
X! /*  We don't need this flag unless we're dealing with Suns */
X! #ifndef mc68020
X! #define NO_3_60_CG4
X  #endif
X  
X! /* ...and we don't need this macro unless we have a 3/60+CG4 */
X! #ifdef NO_3_60_CG4
X! #undef u_putbits
X! #define u_putbits(src, x, w, pdst)  putbits(src, x, w, pdst)
X! #endif /* NO_3_60_C64 */
X  
X  /* Now if we have not gotten any really good bitfield macros, try some
X   * moderately fast macros.  Alas, I don't know how to do asm instructions
X--- 388,402 ----
X      } \
X  }
X  
X! #if defined(putbits) && !defined(NO_3_60_CG4)
X! #define u_putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
X! #else
X! #define u_putbits(src, x, w, pdst) putbits(src, x, w, pdst)
X  #endif
X  
X! #if !defined(putbits) 
X! #define putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
X! #endif
X  
X  /* Now if we have not gotten any really good bitfield macros, try some
X   * moderately fast macros.  Alas, I don't know how to do asm instructions
X***************
X*** 386,395 ****
X   * without gcc.
X   */
X  
X- #ifndef putbits
X- #define putbits(src, x, w, pdst)  u_putbits(src, x, w, pdst)
X- #endif
X- 
X  #ifndef getbits
X  #define getbits(psrc, x, w, dst) \
X  { \
X--- 403,408 ----
X***************
X*** 399,408 ****
X  }
X  #endif
X  
X- /* If our getbits and putbits are fast enough,
X-  * do this brute force, it's faster
X-  */
X- 
X  /*  We have to special-case putbitsrop because of 3/60+CG4 combos
X   */
X  
X--- 412,417 ----
X***************
X*** 432,439 ****
X      } \
X  }
X  
X! #if defined(FASTPUTBITS) && defined(FASTGETBITS)
X  
X  #define putbitsrop(src, x, w, pdst, rop) \
X  { \
X    register int _tmp, _tmp2; \
X--- 441,451 ----
X      } \
X  }
X  
X! /* If our getbits and putbits are FAST enough,
X!  * do this brute force, it's faster
X!  */
X  
X+ #if defined(FASTPUTBITS) && defined(FASTGETBITS) && defined(NO_3_60_CG4)
X  #define putbitsrop(src, x, w, pdst, rop) \
X  { \
X    register int _tmp, _tmp2; \
X***************
X*** 442,455 ****
X    DoRop(_tmp, rop, _tmp2, _tmp) \
X    FASTPUTBITS(_tmp, x, w, pdst); \
X  }
X- 
X- #ifdef NO_3_60_CG4
X- #undef u_putbitsrop
X- #else
X- #undef putbitsrop
X- #define putbitsrop(src, x, w, pdst, rop)  u_putbitsrop(src, x, w, pdst, rop)
X- #endif /* NO_3_60_C64 */
X- 
X  #define putbitsrrop(src, x, w, pdst, rop) \
X  { \
X    register int _tmp, _tmp2; \
X--- 454,459 ----
X***************
X*** 459,465 ****
X--- 463,474 ----
X    _tmp= DoRRop(rop, _tmp2, _tmp); \
X    FASTPUTBITS(_tmp, x, w, pdst); \
X  }
X+ #undef u_putbitsrop
X  #endif
X+ 
X+ #ifndef putbitsrop
X+ #define putbitsrop(src, x, w, pdst, rop)  u_putbitsrop(src, x, w, pdst, rop)
X+ #endif 
X  
X  #ifndef putbitsrrop
X  #define putbitsrrop(src, x, w, pdst, rop) \
*-*-END-of-maskbits.h.patch-*-*
echo x - mfbplygblt.c.patch
sed 's/^X//' >mfbplygblt.c.patch <<'*-*-END-of-mfbplygblt.c.patch-*-*'
X*** ddx/mfb/mfbplygblt.c~	Tue Sep  6 14:54:07 1988
X--- ddx/mfb/mfbplygblt.c	Tue Jan 24 17:48:54 1989
X***************
X*** 1,3 ****
X--- 1,4 ----
X+ /* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */
X  /***********************************************************
X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X***************
X*** 236,241 ****
X--- 237,245 ----
X  	int glyphRow;		/* first row of glyph not wholly
X  				   clipped out */
X  	int glyphCol;		/* leftmost visible column of glyph */
X+ #ifdef PURDUE
X+ 	int getWidth;           /* bits to get from glyph */
X+ #endif  /* PURDUE */
X  
X  	if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS))))
X  	    return;
X***************
X*** 327,332 ****
X--- 331,339 ----
X  
X  		glyphCol = (leftEdge - ppos[i].xpos) -
X  			   (pci->metrics.leftSideBearing);
X+ #ifdef PURDUE
X+ 		getWidth = w + glyphCol;
X+ #endif  /* PURDUE */
X  		xoff = xchar + (leftEdge - ppos[i].xpos);
X  		if (xoff > 31)
X  		{
X***************
X*** 344,350 ****
X--- 351,361 ----
X  		    maskpartialbits(xoff, w, startmask);
X  		    while (h--)
X  		    {
X+ #ifndef PURDUE
X  			getshiftedleftbits(pglyph, glyphCol, w, tmpSrc);
X+ #else  /* PURDUE */
X+ 			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
X+ #endif  /* PURDUE */
X  			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
X  			pglyph += widthGlyph;
X  			pdst += widthDst;
X***************
X*** 356,362 ****
X--- 367,377 ----
X  		    nFirst = 32 - xoff;
X  		    while (h--)
X  		    {
X+ #ifndef PURDUE
X  			getshiftedleftbits(pglyph, glyphCol, w, tmpSrc);
X+ #else  /* PURDUE */
X+ 			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
X+ #endif  /* PURDUE */
X  			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
X  			*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
X  			pglyph += widthGlyph;
*-*-END-of-mfbplygblt.c.patch-*-*
exit
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
Moderator of comp.sources.x