[comp.sources.x] v03i003: Purdue speedups to R3 server, Release 2, Part01/04

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

Submitted-by: spaf@purdue.edu (Gene Spafford)
Posting-number: Volume 3, Issue 3
Archive-name: p2speedups/part01


#  Purdue/Purdue+ patches, part 1 of 4
# Shar archive.  Give the following as input to /bin/sh
#  Packed Sun Jan 22 19:39:47 EST 1989 by spaf@uther.cs.purdue.edu
#
#  This archive contains:
#	README
#	Timings
#	Usenet
#	dbm-gcc.h.patch
#	miarc.c.patch
#	os.h.patch
#	cfboldmfb.c.patch
#	mfbbstore.c.patch
#	mfbfillrct.c.patch
#	mfbpntwin.c.patch
#	mfbimggblt.c.patch
#
#
echo x - README
sed 's/^X//' >README <<'*-*-END-of-README-*-*'
XAbout Purdue/PurduePlus 2.0
X---------------------------
XThis is the second release (for X11R3) of a set of changes to the
Xframe buffer code of the X11 sample server.  These changes are
Xdesigned to make the server faster for B/W for most machines, and Vax
Xand 68020 machines (e.g., MacIIs, Apollos, Sun 3s) in particular.
X(Patches for the color fb will follow, eventually.)
X
XThe changes make a significant (but sometimes difficult to measure
Xobjectively) impact on the speed of most operations.  This speedup
Xwill differ based on your job mix and machine configuration.  Some
Xoperations appear to take up to 50% less cpu time to complete.
XIncremental measurements with gprof, time, and other tools show each
Xchange to have a positive overall effect on the server efficiency.  In
Xparticular, painting windows and drawing lines appears to be much
Xfaster.  An "ico -r" is obviously faster and smoother, as is tiling
Xthe root window.
X
XInterestingly enough, the binary after installing these patches also
Xseems *smaller*.
X
XThis second release is basically an integration of the first release
Xof each of the Purdue and Purdue+ releases, along with new
Xoptimizations and bug fixes.  Some special changes have been made to
Xtake advantage of optimizations possible when using the GCC compiler.
XThese have all been ifdef'd on the symbol __GNUC__ so they will not
Xinterfere with compilation using other compilers.  However, if you
Xhave the GCC compiler, you can take advantage of these (and they are
Xwell-worth the effort!).  The GCC-specific changes are noted below.
X
XMotivation & Changes
X--------------------
XThe generic server shipped with X11R3 is designed to run on many
Xdifferent machines.  It was not written with speed in mind, although
Xsome efforts were made at optimization.  Looking at the code reveals
Xa number of places where changes could be made to make the code
Xfaster.  These include:
X    * Optimized or added bitmasking functions, taking advantage of
X      properties known to exist for certain arithmetic operators
X      and domains of input;
X    * Replacing calculated bitmasks with table lookups
X    * Use of Duff's device in some places where it looks beneficial
X      (note: the first release of these patches used a Duff's device
X       or order 8.  Tests with Sun 3s and MacIIs show that an order
X       4 device gives better performance, probably due to caching.)
X    * Reordering of code to share variables or move invariants out of
X      loops.
X    * Expanding some code inline instead of doing calls or loops
X    * Taking advantage of knowledge about *when* code is called.
X
XWe have tried to make these changes in a way that is maintainable
Xand easily marked; every modification is enclosed in ifdef's on
Xthe symbol PURDUE.
X
XInstallation
X------------
XThe patches in this archive should all be applied to the files in the
Xserver/ddx/{mfb,cfb,mi} and server/include directories.  These are all
Xformed to apply to *unmodified* X11R3 server sources.  Using Larry Wall's
X"patch" program, you can apply them all as follows:
X	server="path to your X11 server source directory"
X	for patch in *.patch
X	do
X	    patch -l -N -p -d $server < $patch
X	done
X
XNext, you need to set the symbol PURDUE (and possibly NO_3_60_CG4, see
X"A GCC & Sun Problem," below) in your site.def file (e.g., #define
XOptimizedCDebugFlags -O -DPURDUE") to use them.  You can also patch
Xyour Makefiles (e.g., server/ddx/mfb/Imakefile) as follows:
X
X    *** server/ddx/mfb/Imakefile.orig	Thu Nov 17 15:52:45 1988
X    --- server/ddx/mfb/Imakefile		Thu Nov 17 15:52:45 1988
X    ***************
X    *** 19,24 ****
X    --- 19,25 ----
X	     mfbpawhite.o mfbpablack.o mfbpainv.o mfbtile.o \
X	       mfbtewhite.o mfbteblack.o mfbmisc.o mfbbstore.o
X
X    + DEFINES = -DPURDUE
X      STD_DEFINES = ServerDefines
X      CDEBUGFLAGS = ServerCDebugFlags
X      INCLUDES = -I. -I../../include -I$(INCLUDESRC)
X
XSimilar patches must be made to ddx/mi/Imakefile and ddx/cfb/Imakefile
Xsince ddx/mfb/maskbits.h is included in files in those directories.
X
XNote: The change to ddx/mi/miarc.c is to fix a bug, and you may
Xinstall it if you wish.  The bug has been submitted to the X folks but
Xnot yet officially "blessed."  The change to ddx/mfb/mfbimggblt.c is
Xalso a bug fix for a clipping problem, and it too has yet to be
Xofficially sanctioned, but it works for us so you're welcome to use it
Xif you see fit.
X
XWhatever changes you make, you will need to cd to the server
Xdirectory, then:
X	make clean Makefile; make Makefiles depend; make
X
XGCC Notes
X---------
XA working server can be built using gcc 1.31 and the flags
X"-O -traditional -finline-functions -fstrength-reduce" and either of
X"-msoft-float" or "-m68881", as appropriate.  gcc 1.32 is known
Xto produce bad code and should be avoided.  
X
XGCC-specific changes in these patches include:
X    * Special "asm" instructions to use bitfield instructions on
X      Vaxen and 68020 machines in place of shift/mask combinations
X      in the getbits/putbits macros.
X    * Using the builtin alloca function instead of the library
X      alloca call.
X
XGCC-specific changes have been marked with ifdef __GNUC__.  Note that
Xthe change to include/os.h does *not* have the PURDUE symbol
Xassociated with it since it is dependent on only the compiler being
Xused.
X
XIf you have source code available, consider compiling your heap code
X(malloc, free, calloc, etc) with gcc and including it with the server.
XYou can either do this with the entire library, or you can copy the
Xheap source code into the os/4.2bsd directory and recompile it there.
XUnder SunOS 3.4 on a Sun 3, recompiling the heap code with gcc (using
Xthe -finline-functions and -fstrength-reduce options) results in more
Xthan a 100% speedup in heap operations.
X
XAlso, using GCC to compile os/4.2bsd/oscolor.c can result in problems
Xunless you take corrective measures.  The problem lies with the fact
Xthat GCC returns structures differently as function values than does
Xcc-derived code.  The symptom of this problem is that a GCC-compiled
Xserver will have totally black (or white) screens with no observable
Xtext.  To fix the problem, either compile oscolor.c with the regular
X"cc" compiler, or compile the dbm library with gcc and link against
Xthat.  You can also apply the enclosed dbm-gcc.h.patch file to your
X/usr/include/dbm.h file and compile oscolor.c with gcc as normal.
X
XIf you have source code available, copy both the dbm and heap files
Xto os/4.2bsd, then modify the Imakefile as follows:
X
X    *** Imakefile.orig	Sun Oct 30 22:46:56 1988
X    --- Imakefile	Wed Jan 18 22:49:37 1989
X    ***************
X    *** 13,23 ****
X       */
X
X      #ifndef OtherSources
X    ! #define OtherSources
X      #endif
X
X      #ifndef OtherObjects
X    ! #define OtherObjects
X      #endif
X
X      BOOTSTRAPCFLAGS = 
X    --- 13,23 ----
X       */
X
X      #ifndef OtherSources
X    ! #define OtherSources dbm.c malloc.c
X      #endif
X
X      #ifndef OtherObjects
X    ! #define OtherObjects dbm.o malloc.o
X      #endif
X
X      BOOTSTRAPCFLAGS = 
X
X
XA GCC & Sun Problem
X-------------------
XOne change in particular should be noted.  The inclusion of the
XGCC-defined "asm" statements to speed up bit operations is a big win
Xfor most 68020 machines and Vaxen.  Unfortunately, the Sun 3/60+CG4
Xcombination as sold by Sun has a bug in the firmware that causes
Xwrites using the "bfins" instruction to fail in some circumstances.
XThis has been reported to Sun as bug report #1016963.  You should
Xenquire of your Sun support people if some kind of fix is available.
X
XIn the meantime, this set of patches is distributed with a software
Xworkaround.  BY DEFAULT the workaround is installed.  If you are
Xbuilding a server that will NEVER run on Sun 3/60+CG4 machines, then
Xbe sure to define the symbol NO_3_60_CG4 along with the symbol PURDUE.
XI.e., your site.def file should include the flags -DPURDUE
X-DNO_3_60_CG4.  You only need to do this if you build the server with
Xthe gcc compiler and you are building for a mc68020 processor; the
Xoptimizations involved are automatically enabled for other
Xarchitectures.  Once Sun develops an ECO to fix the bug, this flag can
Xalso be turned on for 3/60+CG4 machines.  This would be nice, because
Xwithout the fix, those machines can only use 1/2 of the speedups.
X
XColor Machines
X--------------
XAs time allows, we will examine similar changes to the cfb code for
Xcolor machines.  Stay tuned.
X
XQuestions
X-----------
XWe will try to respond to any of your questions or comments about
Xthese patches -- just send us some e-mail.  We would also like to hear
Xabout any of your own enhancements, benchmarks, etc.  Enjoy!
X
XGene Spafford		&	Martin Friedmann
Xspaf@cs.purdue.edu		martin@citi.umich.edu
X1/22/89
X
XThanks to:
X----------
XSam Kimery of PURDUE ECN helped develop the optimizations in
Xthe first release of these fixes (for X11R2).  Terry Donahue of
XProject Athena contributed some server fixes with the X11R3 release
Xthat helped focus our attention on certain sections of code.  The
XPurdue/Florida Software Engineering Research Center provided the
Xmachines and funding that allowed Spaf to do his tinkering.  Thanks
Xto Jim Fulton for testing the changes (Release I) on a Mac II, and for
Xrecommending some format changes.  Rusty Sanders of Megatek helped
Xisolate the bug in the Sun 3/60+CG4 combo.
X
XOur thanks and apologies to anyone else we forgot to mention.
X
*-*-END-of-README-*-*
echo x - Timings
sed 's/^X//' >Timings <<'*-*-END-of-Timings-*-*'
XThe following are some rough timing figures for the performance
Ximprovement possible using the Purdue/Purdue+ patches.
X
XSystem:
X	Sun 3/60 with CG4, Sun OS 3.4, 8Mb memory, local disk
X	All tests run with "-mono" switch on server.
X	All compiles done with software floating point.
X
XOriginal version:
X	X11R3 server, patches 1-4 applied.
X	Compiled with Sun cc compiler, -O -fsoft-float options
X
XNew version:
X	X11R3 server, patches 1-4 applied.
X	Purdue/Purdue+ 2.0 patches applied.
X	Compiled with 1.31 GCC, with options:
X	    -O -traditional -msoft-float -fstrength-reduce -finline-functions
X	Linked with Sun 3.4 "malloc" recompiled with GCC
X	    (same options as above)
X
XRun against canned exercise, including:
X	xload, xphoon, xsetroot -bitmap, xterm (with and without -j),
X	ico -r, and others.
X
XOriginal version user+sys time: 289.0 seconds, startup to shutdown.
XNew version user+sys time: 218.4 seconds, startup to shutdown, a 24+%
X    improvement.
X
XSome selected excerpts from grof for the two versions:
X
XOld version                        New version                      
X-----------			   -----------                      
X   total			      total                         
X ms/call name			    ms/call name                    
X  42.50  _mfbUnnaturalTileFS	     31.34  _mfbUnnaturalTileFS     
X  10.26  _mfbDoBitblt		      7.07  _mfbDoBitblt            
X   6.62  _mfbImageGlyphBltWhite	      4.19  _mfbImageGlyphBltWhite  
X   4.98  _mfbTEGlyphBltWhite	      3.70  _mfbTEGlyphBltWhite     
X   4.50  _mfbPaintWindow32	      3.88  _mfbPaintWindow32       
X   1.71  _mfbPushPixels		      1.43  _mfbPushPixels          
X   1.15  _mfbBlackSolidFS	      0.78  _mfbBlackSolidFS        
X   0.71  _mfbLineSS		      0.52  _mfbLineSS              
X   0.37  _mfbSolidBlackArea	      0.32  _mfbSolidBlackArea      
X   0.21  _mfbBresS		      0.12  _mfbBresS               
X   0.12  _malloc		      0.05  _malloc                 
*-*-END-of-Timings-*-*
echo x - Usenet
sed 's/^X//' >Usenet <<'*-*-END-of-Usenet-*-*'
X[Note: this was posted to the listed groups on 1/21/89]
X
XNewsgroups: comp.windows.x,comp.unix.wizards,comp.sys.sun
XSubject: Sun 3/60+CG4 problem -- Explained!
XFollowup-to: comp.windows.x
XKeywords: Purdue speedups, bitrot, bfins, gcc
X
XA while back, I posted a request concerning running the X11R3 server
Xwith Purdue+ patches on a Sun 3/60+CG4.  I had been having problems
Xwith "bitrot" that no one else seemed to get, and I couldn't find the
Xreason why.
X
XI found out why.
X
XThe 3/60+CG4 combo has a firmware bug not present in other systems.
X
XYup, you find this only on Sun 3/60's with a CG4, and the bug only
Xoccurs if you are trying to do a 24 bit write  to the frame buffer
Xmemory with the bfins instruction.  How's that for bizarre?  I was told
Xthat I am the first person in the 2 years since the machine was
Xreleased who has found a way to exercise the bug.  
X
XI don't know the exact cause of this bug, although I have some informed
Xspeculation based on flags & bus writes.  I do know there is no way to
Xfix it in software -- it will require a hardware fix.  This means that
Xour soon-to-be-released set of Purdue/Purdue+ patches using inline
Xassembly must have a special set of macros for that particular
Xcombination.  It also means that anyone with a Sun 3/60+CG4 cannot take
Xfull advantage of the speedups we've developed.
X
XThe problem has been filed as Sun bug report 1016963.  If you have a
XSun 3/60+CG4, you can ask your field service creatures if an ECO has
Xbeen issued to fix the problem.   If enough people ask, maybe they'll
Xcome up with one :-)
X
XIn the meantime, thanks to everyone who responded, including a number
Xof people at Sun who asked that I not mention their names  (either
Xbecause they're humble or because Sun penalizes employees for helping
Xcustomers?), folks at CSRI in Toronto who checked the code on lots of
Xdifferent Sun configurations, and especially Rusty Sanders @ Megatek
Xwho came up with a program that could reliably recreate the problem.
X
XWatch comp.windows.x for an announcement of the Purdue 2.0 patches.
X-- 
XGene Spafford
XNSF/Purdue/U of Florida  Software Engineering Research Center,
XDept. of Computer Sciences, Purdue University, W. Lafayette IN 47907-2004
XInternet:  spaf@cs.purdue.edu	uucp:	...!{decwrl,gatech,ucbvax}!purdue!spaf
*-*-END-of-Usenet-*-*
echo x - dbm-gcc.h.patch
sed 's/^X//' >dbm-gcc.h.patch <<'*-*-END-of-dbm-gcc.h.patch-*-*'
X*** /usr/include/dbm.h	Mon Sep 15 14:19:18 1986
X--- /u17/serc/lib/gcc-include/dbm.h	Wed Nov 23 09:09:31 1988
X***************
X*** 24,34 ****
X--- 24,48 ----
X  	int	dsize;
X  } datum;
X  
X+ #ifdef __GNUC__
X+ 
X+ datum	*fetch();
X+ #define fetch *fetch
X+ datum	*firstkey();
X+ #define firstkey *firstkey
X+ datum	*nextkey();
X+ #define nextkey *nextkey
X+ datum   *makdatum();
X+ #define makdatum *makdatum
X+ datum   *firsthash();
X+ #define firsthash *firsthash
X+ #else
X  datum	fetch();
X  datum	makdatum();
X  datum	firstkey();
X  datum	nextkey();
X  datum	firsthash();
X+ #endif
X  long	calchash();
X  long	hashinc();
X  
*-*-END-of-dbm-gcc.h.patch-*-*
echo x - miarc.c.patch
sed 's/^X//' >miarc.c.patch <<'*-*-END-of-miarc.c.patch-*-*'
X*** /tmp/,RCSt1a05374	Sun Jan 22 19:28:37 1989
X--- ddx/mi/miarc.c	Sun Jan 22 19:28:11 1989
X***************
X*** 711,717 ****
X--- 711,721 ----
X       * I'm just using cdt 'cause I'm lazy.
X       */
X      cdt = fmax(parc->width, parc->height)/2.0;
X+ #ifndef PURDUE
X      if(cdt <= 0)
X+ #else  /* PURDUE */
X+     if (cdt < 1.0)
X+ #endif  /* PURDUE */
X  	return 0;
X      dt = asin( 1.0 / cdt ); /* minimum step necessary */
X      count = et/dt;
*-*-END-of-miarc.c.patch-*-*
echo x - os.h.patch
sed 's/^X//' >os.h.patch <<'*-*-END-of-os.h.patch-*-*'
X*** include/os.h.orig	Thu Dec 29 17:37:18 1988
X--- include/os.h	Thu Dec 22 01:41:01 1988
X***************
X*** 69,74 ****
X--- 69,79 ----
X  #endif /* defined(__HIGHC__) */
X  
X  
X+ #ifdef __GNUC__
X+ #define alloca __builtin_alloca
X+ #define ALLOCATE_LOCAL(size) alloca((int)(size))
X+ #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
X+ #else /* ! __GNUC__ */
X  #if defined(vax) || defined(sun)
X  /*
X   * Some System V boxes extract alloca.o from /lib/libPW.a; if you
X***************
X*** 79,85 ****
X  #define ALLOCATE_LOCAL(size) alloca((int)(size))
X  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
X  #endif /* vax or sun */
X! 
X  
X  #ifndef ALLOCATE_LOCAL
X  char *malloc();
X--- 84,90 ----
X  #define ALLOCATE_LOCAL(size) alloca((int)(size))
X  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
X  #endif /* vax or sun */
X! #endif /* __GNUC__ */
X  
X  #ifndef ALLOCATE_LOCAL
X  char *malloc();
*-*-END-of-os.h.patch-*-*
echo x - cfboldmfb.c.patch
sed 's/^X//' >cfboldmfb.c.patch <<'*-*-END-of-cfboldmfb.c.patch-*-*'
X*** /tmp/,RCSt1a01511	Wed Jan 18 23:14:43 1989
X--- ddx/cfb/cfboldmfb.c	Wed Jan 18 22:43:16 1989
X***************
X*** 1,3 ****
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***************
X*** 26,31 ****
X--- 27,35 ----
X  #include "servermd.h"
X  #include "pixmapstr.h"
X  #include "../mfb/maskbits.h"
X+ #ifdef PURDUE
X+ #include "../mfb/mfb.h"
X+ #endif  /* PURDUE */
X  
X  /* mfbQuickBlt -- a quick and dirty bitblit routine
X   * copies from psrcBase(xSrc, ySrc) to pdstBase(xDst, yDst) an array of bits
X***************
X*** 104,110 ****
X--- 108,118 ----
X  	while(h--)
X  	{
X  	    getbits(psrc, srcBit, w, tmpSrc);
X+ #ifndef PURDUE
X  	    putbits(tmpSrc, dstBit, w, pdst);
X+ #else
X+ 	    u_putbits(tmpSrc, dstBit, w, pdst);
X+ #endif  /* PURDUE */
X  	    psrc += wSrc;
X  	    pdst += wDst;
X  	}
X***************
X*** 146,153 ****
X--- 154,165 ----
X  
X  		if (startmask)
X  		{
X+ #ifndef PURDUE
X  		    getbits(psrc, (xSrc & 0x1f), nstart, tmpSrc);
X  		    putbits(tmpSrc, (xDst & 0x1f), nstart, pdst);
X+ #else 
X+ 		    getandputbits(psrc, (xSrc&0x1f), (xDst&0x1f), nstart, pdst);
X+ #endif  /* PURDUE */
X  		    pdst++;
X  		    if (srcStartOver)
X  			psrc++;
X***************
X*** 154,159 ****
X--- 166,176 ----
X  		}
X  
X  		nl = nlMiddle;
X+ #if defined(PURDUE) && defined(FASTGETBITS)
X+ 		Duff(nl, { FASTGETBITS(psrc, xoffSrc, 32, tmpSrc);
X+ 			 *pdst++ = tmpSrc;
X+ 			 psrc++;});
X+ #else
X  		while (nl--)
X  		{
X  		    getbits(psrc, xoffSrc, 32, tmpSrc);
X***************
X*** 160,170 ****
X--- 177,192 ----
X  		    *pdst++ = tmpSrc;
X  		    psrc++;
X  		}
X+ #endif
X  
X  		if (endmask)
X  		{
X+ #ifndef PURDUE
X  		    getbits(psrc, xoffSrc, nend, tmpSrc);
X  		    putbits(tmpSrc, 0, nend, pdst);
X+ #else
X+ 		    getandputbits0(psrc, xoffSrc, nend, pdst);
X+ #endif  /* PURDUE */
X  		}
X  
X  		psrcLine += wSrc;
X***************
X*** 188,198 ****
X--- 210,229 ----
X  
X  		if (endmask)
X  		{
X+ #ifndef PURDUE
X  		    getbits(psrc, xoffSrc, nend, tmpSrc)
X  		    putbits(tmpSrc, 0, nend, pdst)
X+ #else
X+ 		    getandputbits0(psrc, xoffSrc, nend, pdst);
X+ #endif  /* PURDUE */
X  		}
X  
X  		nl = nlMiddle;
X+ #if defined(PURDUE) && defined(FASTGETBITS)
X+ 		Duff(nl, {--psrc;
X+ 			FASTGETBITS(psrc, xoffSrc, 32, tmpSrc);
X+ 			*--pdst = tmpSrc;});
X+ #else
X  		while (nl--)
X  		{
X  		    --psrc;
X***************
X*** 199,204 ****
X--- 230,236 ----
X  		    getbits(psrc, xoffSrc, 32, tmpSrc)
X  		    *--pdst = tmpSrc;
X  		}
X+ #endif  /* PURDUE */
X  
X  		if (startmask)
X  		{
X***************
X*** 205,212 ****
X--- 237,248 ----
X  		    if (srcStartOver)
X  			--psrc;
X  		    --pdst;
X+ #ifndef PURDUE
X  		    getbits(psrc, (xSrc & 0x1f), nstart, tmpSrc)
X  		    putbits(tmpSrc, (xDst & 0x1f), nstart, pdst)
X+ #else 
X+ 		    getandputbits(psrc, (xSrc&0x1f), (xDst&0x1f), nstart, pdst);
X+ #endif  /* PURDUE */
X  		}
X  
X  		pdstLine += wDst;
*-*-END-of-cfboldmfb.c.patch-*-*
echo x - mfbbstore.c.patch
sed 's/^X//' >mfbbstore.c.patch <<'*-*-END-of-mfbbstore.c.patch-*-*'
X*** /tmp/,RCSt1a01540	Wed Jan 18 23:15:09 1989
X--- ddx/mfb/mfbbstore.c	Tue Jan 17 23:39:16 1989
X***************
X*** 1,3 ****
X--- 1,4 ----
X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
X  /***********************************************************
X  
X  Copyright 1987 by the Regents of the University of California
X***************
X*** 60,65 ****
X--- 61,67 ----
X      
X      pBox = prgnSave->rects;
X      pPt = pPtsInit;
X+ #ifndef PURDUE
X      for (i = prgnSave->numRects; i > 0; i--) {
X  	pPt->x = pBox->x1 + xorg;
X  	pPt->y = pBox->y1 + yorg;
X***************
X*** 66,71 ****
X--- 68,77 ----
X  	pPt++;
X  	pBox++;
X      }
X+ #else
X+     i = prgnSave->numRects;
X+     Duff(i, pPt->x = pBox->x1 + xorg; pPt->y = pBox->y1 + yorg; pPt++; pBox++);
X+ #endif  /* PURDUE */
X  
X  
X      mfbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
X***************
X*** 112,117 ****
X--- 118,124 ----
X      
X      pBox = prgnRestore->rects;
X      pPt = pPtsInit;
X+ #ifndef PURDUE
X      for (i = prgnRestore->numRects; i > 0; i--) {
X  	pPt->x = pBox->x1 - xorg;
X  	pPt->y = pBox->y1 - yorg;
X***************
X*** 118,123 ****
X--- 125,134 ----
X  	pPt++;
X  	pBox++;
X      }
X+ #else
X+     i = prgnRestore->numRects;
X+     Duff(i, pPt->x = pBox->x1 - xorg; pPt->y = pBox->y1 - yorg; pPt++; pBox++);
X+ #endif  /* PURDUE */
X  
X  
X      mfbDoBitblt(pPixmap,
*-*-END-of-mfbbstore.c.patch-*-*
echo x - mfbfillrct.c.patch
sed 's/^X//' >mfbfillrct.c.patch <<'*-*-END-of-mfbfillrct.c.patch-*-*'
X*** /tmp/,RCSt1a01544	Wed Jan 18 23:15:11 1989
X--- ddx/mfb/mfbfillrct.c	Tue Jan 17 23:39:20 1989
X***************
X*** 1,3 ****
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***************
X*** 81,86 ****
X--- 82,88 ----
X  	yorg = ((WindowPtr)pDrawable)->absCorner.y;
X          prect = prectInit;
X  	n = nrectFill;
X+ #ifndef PURDUE
X          while(n--)
X          {
X  	    prect->x += xorg;
X***************
X*** 87,92 ****
X--- 89,97 ----
X  	    prect->y += yorg;
X  	    prect++;
X          }
X+ #else
X+ 	Duff (n, prect->x += xorg; prect->y += yorg; prect++);
X+ #endif
X      }
X  
X      prect = prectInit;
*-*-END-of-mfbfillrct.c.patch-*-*
echo x - mfbpntwin.c.patch
sed 's/^X//' >mfbpntwin.c.patch <<'*-*-END-of-mfbpntwin.c.patch-*-*'
X*** /tmp/,RCSt1a01570	Wed Jan 18 23:15:31 1989
X--- ddx/mfb/mfbpntwin.c	Tue Jan 17 23:39:43 1989
X***************
X*** 1,4 ****
X--- 1,5 ----
X  /* $XConsortium: mfbpntwin.c,v 1.2 88/09/06 14:53:46 jim Exp $ */
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***************
X*** 179,186 ****
X--- 180,191 ----
X  		    nlw = nlwMiddle;
X  		    *p = (*p & ~startmask) | (srcpix & startmask);
X  		    p++;
X+ #ifndef PURDUE
X  		    while (nlw--)
X  			*p++ = srcpix;
X+ #else
X+ 		    Duff (nlw, *p++ = srcpix );
X+ #endif  /* PURDUE */
X  		    *p = (*p & ~endmask) | (srcpix & endmask);
X  		    p += nlwExtra;
X  		}
X***************
X*** 195,202 ****
X--- 200,211 ----
X  		    nlw = nlwMiddle;
X  		    *p = (*p & ~startmask) | (srcpix & startmask);
X  		    p++;
X+ #ifndef PURDUE
X  		    while (nlw--)
X  			*p++ = srcpix;
X+ #else
X+ 		Duff (nlw, *p++ = srcpix );
X+ #endif  /* PURDUE */
X  		    p += nlwExtra;
X  		}
X  	    }
X***************
X*** 207,214 ****
X--- 216,227 ----
X  		    srcpix = psrc[y%tileHeight];
X  		    y++;
X  		    nlw = nlwMiddle;
X+ #ifndef PURDUE
X  		    while (nlw--)
X  			*p++ = srcpix;
X+ #else
X+ 		Duff (nlw, *p++ = srcpix);
X+ #endif  /* PURDUE */
X  		    *p = (*p & ~endmask) | (srcpix & endmask);
X  		    p += nlwExtra;
X  		}
X***************
X*** 220,227 ****
X--- 233,244 ----
X  		    srcpix = psrc[y%tileHeight];
X  		    y++;
X  		    nlw = nlwMiddle;
X+ #ifndef PURDUE
X  		    while (nlw--)
X  			*p++ = srcpix;
X+ #else
X+ 		Duff (nlw, *p++ = srcpix);
X+ #endif  /* PURDUE */
X  		    p += nlwExtra;
X  		}
X  	    }
*-*-END-of-mfbpntwin.c.patch-*-*
echo x - mfbimggblt.c.patch
sed 's/^X//' >mfbimggblt.c.patch <<'*-*-END-of-mfbimggblt.c.patch-*-*'
X*** /tmp/,RCSt1a05345	Sun Jan 22 19:06:24 1989
X--- ddx/mfb/mfbimggblt.c	Sun Jan 22 19:05:50 1989
X***************
X*** 1,3 ****
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***************
X*** 277,282 ****
X--- 278,286 ----
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*** 375,380 ****
X--- 379,387 ----
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*** 392,398 ****
X--- 399,409 ----
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*** 404,410 ****
X--- 415,425 ----
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-mfbimggblt.c.patch-*-*
exit
-- 
Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
Moderator of comp.sources.x