home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / p2speedups / part01 next >
Encoding:
Internet Message Format  |  1989-01-31  |  26.4 KB

  1. Path: uunet!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v03i003:  Purdue speedups to R3 server, Release 2, Part01/04
  5. Message-ID: <2019@wyse.wyse.com>
  6. Date: 31 Jan 89 19:56:18 GMT
  7. Organization: Wyse Technology, San Jose
  8. Lines: 798
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: spaf@purdue.edu (Gene Spafford)
  12. Posting-number: Volume 3, Issue 3
  13. Archive-name: p2speedups/part01
  14.  
  15.  
  16. #  Purdue/Purdue+ patches, part 1 of 4
  17. # Shar archive.  Give the following as input to /bin/sh
  18. #  Packed Sun Jan 22 19:39:47 EST 1989 by spaf@uther.cs.purdue.edu
  19. #
  20. #  This archive contains:
  21. #    README
  22. #    Timings
  23. #    Usenet
  24. #    dbm-gcc.h.patch
  25. #    miarc.c.patch
  26. #    os.h.patch
  27. #    cfboldmfb.c.patch
  28. #    mfbbstore.c.patch
  29. #    mfbfillrct.c.patch
  30. #    mfbpntwin.c.patch
  31. #    mfbimggblt.c.patch
  32. #
  33. #
  34. echo x - README
  35. sed 's/^X//' >README <<'*-*-END-of-README-*-*'
  36. XAbout Purdue/PurduePlus 2.0
  37. X---------------------------
  38. XThis is the second release (for X11R3) of a set of changes to the
  39. Xframe buffer code of the X11 sample server.  These changes are
  40. Xdesigned to make the server faster for B/W for most machines, and Vax
  41. Xand 68020 machines (e.g., MacIIs, Apollos, Sun 3s) in particular.
  42. X(Patches for the color fb will follow, eventually.)
  43. X
  44. XThe changes make a significant (but sometimes difficult to measure
  45. Xobjectively) impact on the speed of most operations.  This speedup
  46. Xwill differ based on your job mix and machine configuration.  Some
  47. Xoperations appear to take up to 50% less cpu time to complete.
  48. XIncremental measurements with gprof, time, and other tools show each
  49. Xchange to have a positive overall effect on the server efficiency.  In
  50. Xparticular, painting windows and drawing lines appears to be much
  51. Xfaster.  An "ico -r" is obviously faster and smoother, as is tiling
  52. Xthe root window.
  53. X
  54. XInterestingly enough, the binary after installing these patches also
  55. Xseems *smaller*.
  56. X
  57. XThis second release is basically an integration of the first release
  58. Xof each of the Purdue and Purdue+ releases, along with new
  59. Xoptimizations and bug fixes.  Some special changes have been made to
  60. Xtake advantage of optimizations possible when using the GCC compiler.
  61. XThese have all been ifdef'd on the symbol __GNUC__ so they will not
  62. Xinterfere with compilation using other compilers.  However, if you
  63. Xhave the GCC compiler, you can take advantage of these (and they are
  64. Xwell-worth the effort!).  The GCC-specific changes are noted below.
  65. X
  66. XMotivation & Changes
  67. X--------------------
  68. XThe generic server shipped with X11R3 is designed to run on many
  69. Xdifferent machines.  It was not written with speed in mind, although
  70. Xsome efforts were made at optimization.  Looking at the code reveals
  71. Xa number of places where changes could be made to make the code
  72. Xfaster.  These include:
  73. X    * Optimized or added bitmasking functions, taking advantage of
  74. X      properties known to exist for certain arithmetic operators
  75. X      and domains of input;
  76. X    * Replacing calculated bitmasks with table lookups
  77. X    * Use of Duff's device in some places where it looks beneficial
  78. X      (note: the first release of these patches used a Duff's device
  79. X       or order 8.  Tests with Sun 3s and MacIIs show that an order
  80. X       4 device gives better performance, probably due to caching.)
  81. X    * Reordering of code to share variables or move invariants out of
  82. X      loops.
  83. X    * Expanding some code inline instead of doing calls or loops
  84. X    * Taking advantage of knowledge about *when* code is called.
  85. X
  86. XWe have tried to make these changes in a way that is maintainable
  87. Xand easily marked; every modification is enclosed in ifdef's on
  88. Xthe symbol PURDUE.
  89. X
  90. XInstallation
  91. X------------
  92. XThe patches in this archive should all be applied to the files in the
  93. Xserver/ddx/{mfb,cfb,mi} and server/include directories.  These are all
  94. Xformed to apply to *unmodified* X11R3 server sources.  Using Larry Wall's
  95. X"patch" program, you can apply them all as follows:
  96. X    server="path to your X11 server source directory"
  97. X    for patch in *.patch
  98. X    do
  99. X        patch -l -N -p -d $server < $patch
  100. X    done
  101. X
  102. XNext, you need to set the symbol PURDUE (and possibly NO_3_60_CG4, see
  103. X"A GCC & Sun Problem," below) in your site.def file (e.g., #define
  104. XOptimizedCDebugFlags -O -DPURDUE") to use them.  You can also patch
  105. Xyour Makefiles (e.g., server/ddx/mfb/Imakefile) as follows:
  106. X
  107. X    *** server/ddx/mfb/Imakefile.orig    Thu Nov 17 15:52:45 1988
  108. X    --- server/ddx/mfb/Imakefile        Thu Nov 17 15:52:45 1988
  109. X    ***************
  110. X    *** 19,24 ****
  111. X    --- 19,25 ----
  112. X         mfbpawhite.o mfbpablack.o mfbpainv.o mfbtile.o \
  113. X           mfbtewhite.o mfbteblack.o mfbmisc.o mfbbstore.o
  114. X
  115. X    + DEFINES = -DPURDUE
  116. X      STD_DEFINES = ServerDefines
  117. X      CDEBUGFLAGS = ServerCDebugFlags
  118. X      INCLUDES = -I. -I../../include -I$(INCLUDESRC)
  119. X
  120. XSimilar patches must be made to ddx/mi/Imakefile and ddx/cfb/Imakefile
  121. Xsince ddx/mfb/maskbits.h is included in files in those directories.
  122. X
  123. XNote: The change to ddx/mi/miarc.c is to fix a bug, and you may
  124. Xinstall it if you wish.  The bug has been submitted to the X folks but
  125. Xnot yet officially "blessed."  The change to ddx/mfb/mfbimggblt.c is
  126. Xalso a bug fix for a clipping problem, and it too has yet to be
  127. Xofficially sanctioned, but it works for us so you're welcome to use it
  128. Xif you see fit.
  129. X
  130. XWhatever changes you make, you will need to cd to the server
  131. Xdirectory, then:
  132. X    make clean Makefile; make Makefiles depend; make
  133. X
  134. XGCC Notes
  135. X---------
  136. XA working server can be built using gcc 1.31 and the flags
  137. X"-O -traditional -finline-functions -fstrength-reduce" and either of
  138. X"-msoft-float" or "-m68881", as appropriate.  gcc 1.32 is known
  139. Xto produce bad code and should be avoided.  
  140. X
  141. XGCC-specific changes in these patches include:
  142. X    * Special "asm" instructions to use bitfield instructions on
  143. X      Vaxen and 68020 machines in place of shift/mask combinations
  144. X      in the getbits/putbits macros.
  145. X    * Using the builtin alloca function instead of the library
  146. X      alloca call.
  147. X
  148. XGCC-specific changes have been marked with ifdef __GNUC__.  Note that
  149. Xthe change to include/os.h does *not* have the PURDUE symbol
  150. Xassociated with it since it is dependent on only the compiler being
  151. Xused.
  152. X
  153. XIf you have source code available, consider compiling your heap code
  154. X(malloc, free, calloc, etc) with gcc and including it with the server.
  155. XYou can either do this with the entire library, or you can copy the
  156. Xheap source code into the os/4.2bsd directory and recompile it there.
  157. XUnder SunOS 3.4 on a Sun 3, recompiling the heap code with gcc (using
  158. Xthe -finline-functions and -fstrength-reduce options) results in more
  159. Xthan a 100% speedup in heap operations.
  160. X
  161. XAlso, using GCC to compile os/4.2bsd/oscolor.c can result in problems
  162. Xunless you take corrective measures.  The problem lies with the fact
  163. Xthat GCC returns structures differently as function values than does
  164. Xcc-derived code.  The symptom of this problem is that a GCC-compiled
  165. Xserver will have totally black (or white) screens with no observable
  166. Xtext.  To fix the problem, either compile oscolor.c with the regular
  167. X"cc" compiler, or compile the dbm library with gcc and link against
  168. Xthat.  You can also apply the enclosed dbm-gcc.h.patch file to your
  169. X/usr/include/dbm.h file and compile oscolor.c with gcc as normal.
  170. X
  171. XIf you have source code available, copy both the dbm and heap files
  172. Xto os/4.2bsd, then modify the Imakefile as follows:
  173. X
  174. X    *** Imakefile.orig    Sun Oct 30 22:46:56 1988
  175. X    --- Imakefile    Wed Jan 18 22:49:37 1989
  176. X    ***************
  177. X    *** 13,23 ****
  178. X       */
  179. X
  180. X      #ifndef OtherSources
  181. X    ! #define OtherSources
  182. X      #endif
  183. X
  184. X      #ifndef OtherObjects
  185. X    ! #define OtherObjects
  186. X      #endif
  187. X
  188. X      BOOTSTRAPCFLAGS = 
  189. X    --- 13,23 ----
  190. X       */
  191. X
  192. X      #ifndef OtherSources
  193. X    ! #define OtherSources dbm.c malloc.c
  194. X      #endif
  195. X
  196. X      #ifndef OtherObjects
  197. X    ! #define OtherObjects dbm.o malloc.o
  198. X      #endif
  199. X
  200. X      BOOTSTRAPCFLAGS = 
  201. X
  202. X
  203. XA GCC & Sun Problem
  204. X-------------------
  205. XOne change in particular should be noted.  The inclusion of the
  206. XGCC-defined "asm" statements to speed up bit operations is a big win
  207. Xfor most 68020 machines and Vaxen.  Unfortunately, the Sun 3/60+CG4
  208. Xcombination as sold by Sun has a bug in the firmware that causes
  209. Xwrites using the "bfins" instruction to fail in some circumstances.
  210. XThis has been reported to Sun as bug report #1016963.  You should
  211. Xenquire of your Sun support people if some kind of fix is available.
  212. X
  213. XIn the meantime, this set of patches is distributed with a software
  214. Xworkaround.  BY DEFAULT the workaround is installed.  If you are
  215. Xbuilding a server that will NEVER run on Sun 3/60+CG4 machines, then
  216. Xbe sure to define the symbol NO_3_60_CG4 along with the symbol PURDUE.
  217. XI.e., your site.def file should include the flags -DPURDUE
  218. X-DNO_3_60_CG4.  You only need to do this if you build the server with
  219. Xthe gcc compiler and you are building for a mc68020 processor; the
  220. Xoptimizations involved are automatically enabled for other
  221. Xarchitectures.  Once Sun develops an ECO to fix the bug, this flag can
  222. Xalso be turned on for 3/60+CG4 machines.  This would be nice, because
  223. Xwithout the fix, those machines can only use 1/2 of the speedups.
  224. X
  225. XColor Machines
  226. X--------------
  227. XAs time allows, we will examine similar changes to the cfb code for
  228. Xcolor machines.  Stay tuned.
  229. X
  230. XQuestions
  231. X-----------
  232. XWe will try to respond to any of your questions or comments about
  233. Xthese patches -- just send us some e-mail.  We would also like to hear
  234. Xabout any of your own enhancements, benchmarks, etc.  Enjoy!
  235. X
  236. XGene Spafford        &    Martin Friedmann
  237. Xspaf@cs.purdue.edu        martin@citi.umich.edu
  238. X1/22/89
  239. X
  240. XThanks to:
  241. X----------
  242. XSam Kimery of PURDUE ECN helped develop the optimizations in
  243. Xthe first release of these fixes (for X11R2).  Terry Donahue of
  244. XProject Athena contributed some server fixes with the X11R3 release
  245. Xthat helped focus our attention on certain sections of code.  The
  246. XPurdue/Florida Software Engineering Research Center provided the
  247. Xmachines and funding that allowed Spaf to do his tinkering.  Thanks
  248. Xto Jim Fulton for testing the changes (Release I) on a Mac II, and for
  249. Xrecommending some format changes.  Rusty Sanders of Megatek helped
  250. Xisolate the bug in the Sun 3/60+CG4 combo.
  251. X
  252. XOur thanks and apologies to anyone else we forgot to mention.
  253. X
  254. *-*-END-of-README-*-*
  255. echo x - Timings
  256. sed 's/^X//' >Timings <<'*-*-END-of-Timings-*-*'
  257. XThe following are some rough timing figures for the performance
  258. Ximprovement possible using the Purdue/Purdue+ patches.
  259. X
  260. XSystem:
  261. X    Sun 3/60 with CG4, Sun OS 3.4, 8Mb memory, local disk
  262. X    All tests run with "-mono" switch on server.
  263. X    All compiles done with software floating point.
  264. X
  265. XOriginal version:
  266. X    X11R3 server, patches 1-4 applied.
  267. X    Compiled with Sun cc compiler, -O -fsoft-float options
  268. X
  269. XNew version:
  270. X    X11R3 server, patches 1-4 applied.
  271. X    Purdue/Purdue+ 2.0 patches applied.
  272. X    Compiled with 1.31 GCC, with options:
  273. X        -O -traditional -msoft-float -fstrength-reduce -finline-functions
  274. X    Linked with Sun 3.4 "malloc" recompiled with GCC
  275. X        (same options as above)
  276. X
  277. XRun against canned exercise, including:
  278. X    xload, xphoon, xsetroot -bitmap, xterm (with and without -j),
  279. X    ico -r, and others.
  280. X
  281. XOriginal version user+sys time: 289.0 seconds, startup to shutdown.
  282. XNew version user+sys time: 218.4 seconds, startup to shutdown, a 24+%
  283. X    improvement.
  284. X
  285. XSome selected excerpts from grof for the two versions:
  286. X
  287. XOld version                        New version                      
  288. X-----------               -----------                      
  289. X   total                  total                         
  290. X ms/call name                ms/call name                    
  291. X  42.50  _mfbUnnaturalTileFS         31.34  _mfbUnnaturalTileFS     
  292. X  10.26  _mfbDoBitblt              7.07  _mfbDoBitblt            
  293. X   6.62  _mfbImageGlyphBltWhite          4.19  _mfbImageGlyphBltWhite  
  294. X   4.98  _mfbTEGlyphBltWhite          3.70  _mfbTEGlyphBltWhite     
  295. X   4.50  _mfbPaintWindow32          3.88  _mfbPaintWindow32       
  296. X   1.71  _mfbPushPixels              1.43  _mfbPushPixels          
  297. X   1.15  _mfbBlackSolidFS          0.78  _mfbBlackSolidFS        
  298. X   0.71  _mfbLineSS              0.52  _mfbLineSS              
  299. X   0.37  _mfbSolidBlackArea          0.32  _mfbSolidBlackArea      
  300. X   0.21  _mfbBresS              0.12  _mfbBresS               
  301. X   0.12  _malloc              0.05  _malloc                 
  302. *-*-END-of-Timings-*-*
  303. echo x - Usenet
  304. sed 's/^X//' >Usenet <<'*-*-END-of-Usenet-*-*'
  305. X[Note: this was posted to the listed groups on 1/21/89]
  306. X
  307. XNewsgroups: comp.windows.x,comp.unix.wizards,comp.sys.sun
  308. XSubject: Sun 3/60+CG4 problem -- Explained!
  309. XFollowup-to: comp.windows.x
  310. XKeywords: Purdue speedups, bitrot, bfins, gcc
  311. X
  312. XA while back, I posted a request concerning running the X11R3 server
  313. Xwith Purdue+ patches on a Sun 3/60+CG4.  I had been having problems
  314. Xwith "bitrot" that no one else seemed to get, and I couldn't find the
  315. Xreason why.
  316. X
  317. XI found out why.
  318. X
  319. XThe 3/60+CG4 combo has a firmware bug not present in other systems.
  320. X
  321. XYup, you find this only on Sun 3/60's with a CG4, and the bug only
  322. Xoccurs if you are trying to do a 24 bit write  to the frame buffer
  323. Xmemory with the bfins instruction.  How's that for bizarre?  I was told
  324. Xthat I am the first person in the 2 years since the machine was
  325. Xreleased who has found a way to exercise the bug.  
  326. X
  327. XI don't know the exact cause of this bug, although I have some informed
  328. Xspeculation based on flags & bus writes.  I do know there is no way to
  329. Xfix it in software -- it will require a hardware fix.  This means that
  330. Xour soon-to-be-released set of Purdue/Purdue+ patches using inline
  331. Xassembly must have a special set of macros for that particular
  332. Xcombination.  It also means that anyone with a Sun 3/60+CG4 cannot take
  333. Xfull advantage of the speedups we've developed.
  334. X
  335. XThe problem has been filed as Sun bug report 1016963.  If you have a
  336. XSun 3/60+CG4, you can ask your field service creatures if an ECO has
  337. Xbeen issued to fix the problem.   If enough people ask, maybe they'll
  338. Xcome up with one :-)
  339. X
  340. XIn the meantime, thanks to everyone who responded, including a number
  341. Xof people at Sun who asked that I not mention their names  (either
  342. Xbecause they're humble or because Sun penalizes employees for helping
  343. Xcustomers?), folks at CSRI in Toronto who checked the code on lots of
  344. Xdifferent Sun configurations, and especially Rusty Sanders @ Megatek
  345. Xwho came up with a program that could reliably recreate the problem.
  346. X
  347. XWatch comp.windows.x for an announcement of the Purdue 2.0 patches.
  348. X-- 
  349. XGene Spafford
  350. XNSF/Purdue/U of Florida  Software Engineering Research Center,
  351. XDept. of Computer Sciences, Purdue University, W. Lafayette IN 47907-2004
  352. XInternet:  spaf@cs.purdue.edu    uucp:    ...!{decwrl,gatech,ucbvax}!purdue!spaf
  353. *-*-END-of-Usenet-*-*
  354. echo x - dbm-gcc.h.patch
  355. sed 's/^X//' >dbm-gcc.h.patch <<'*-*-END-of-dbm-gcc.h.patch-*-*'
  356. X*** /usr/include/dbm.h    Mon Sep 15 14:19:18 1986
  357. X--- /u17/serc/lib/gcc-include/dbm.h    Wed Nov 23 09:09:31 1988
  358. X***************
  359. X*** 24,34 ****
  360. X--- 24,48 ----
  361. X      int    dsize;
  362. X  } datum;
  363. X  
  364. X+ #ifdef __GNUC__
  365. X+ 
  366. X+ datum    *fetch();
  367. X+ #define fetch *fetch
  368. X+ datum    *firstkey();
  369. X+ #define firstkey *firstkey
  370. X+ datum    *nextkey();
  371. X+ #define nextkey *nextkey
  372. X+ datum   *makdatum();
  373. X+ #define makdatum *makdatum
  374. X+ datum   *firsthash();
  375. X+ #define firsthash *firsthash
  376. X+ #else
  377. X  datum    fetch();
  378. X  datum    makdatum();
  379. X  datum    firstkey();
  380. X  datum    nextkey();
  381. X  datum    firsthash();
  382. X+ #endif
  383. X  long    calchash();
  384. X  long    hashinc();
  385. X  
  386. *-*-END-of-dbm-gcc.h.patch-*-*
  387. echo x - miarc.c.patch
  388. sed 's/^X//' >miarc.c.patch <<'*-*-END-of-miarc.c.patch-*-*'
  389. X*** /tmp/,RCSt1a05374    Sun Jan 22 19:28:37 1989
  390. X--- ddx/mi/miarc.c    Sun Jan 22 19:28:11 1989
  391. X***************
  392. X*** 711,717 ****
  393. X--- 711,721 ----
  394. X       * I'm just using cdt 'cause I'm lazy.
  395. X       */
  396. X      cdt = fmax(parc->width, parc->height)/2.0;
  397. X+ #ifndef PURDUE
  398. X      if(cdt <= 0)
  399. X+ #else  /* PURDUE */
  400. X+     if (cdt < 1.0)
  401. X+ #endif  /* PURDUE */
  402. X      return 0;
  403. X      dt = asin( 1.0 / cdt ); /* minimum step necessary */
  404. X      count = et/dt;
  405. *-*-END-of-miarc.c.patch-*-*
  406. echo x - os.h.patch
  407. sed 's/^X//' >os.h.patch <<'*-*-END-of-os.h.patch-*-*'
  408. X*** include/os.h.orig    Thu Dec 29 17:37:18 1988
  409. X--- include/os.h    Thu Dec 22 01:41:01 1988
  410. X***************
  411. X*** 69,74 ****
  412. X--- 69,79 ----
  413. X  #endif /* defined(__HIGHC__) */
  414. X  
  415. X  
  416. X+ #ifdef __GNUC__
  417. X+ #define alloca __builtin_alloca
  418. X+ #define ALLOCATE_LOCAL(size) alloca((int)(size))
  419. X+ #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  420. X+ #else /* ! __GNUC__ */
  421. X  #if defined(vax) || defined(sun)
  422. X  /*
  423. X   * Some System V boxes extract alloca.o from /lib/libPW.a; if you
  424. X***************
  425. X*** 79,85 ****
  426. X  #define ALLOCATE_LOCAL(size) alloca((int)(size))
  427. X  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  428. X  #endif /* vax or sun */
  429. X! 
  430. X  
  431. X  #ifndef ALLOCATE_LOCAL
  432. X  char *malloc();
  433. X--- 84,90 ----
  434. X  #define ALLOCATE_LOCAL(size) alloca((int)(size))
  435. X  #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  436. X  #endif /* vax or sun */
  437. X! #endif /* __GNUC__ */
  438. X  
  439. X  #ifndef ALLOCATE_LOCAL
  440. X  char *malloc();
  441. *-*-END-of-os.h.patch-*-*
  442. echo x - cfboldmfb.c.patch
  443. sed 's/^X//' >cfboldmfb.c.patch <<'*-*-END-of-cfboldmfb.c.patch-*-*'
  444. X*** /tmp/,RCSt1a01511    Wed Jan 18 23:14:43 1989
  445. X--- ddx/cfb/cfboldmfb.c    Wed Jan 18 22:43:16 1989
  446. X***************
  447. X*** 1,3 ****
  448. X--- 1,4 ----
  449. X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  450. X  /*
  451. X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  452. X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  453. X***************
  454. X*** 26,31 ****
  455. X--- 27,35 ----
  456. X  #include "servermd.h"
  457. X  #include "pixmapstr.h"
  458. X  #include "../mfb/maskbits.h"
  459. X+ #ifdef PURDUE
  460. X+ #include "../mfb/mfb.h"
  461. X+ #endif  /* PURDUE */
  462. X  
  463. X  /* mfbQuickBlt -- a quick and dirty bitblit routine
  464. X   * copies from psrcBase(xSrc, ySrc) to pdstBase(xDst, yDst) an array of bits
  465. X***************
  466. X*** 104,110 ****
  467. X--- 108,118 ----
  468. X      while(h--)
  469. X      {
  470. X          getbits(psrc, srcBit, w, tmpSrc);
  471. X+ #ifndef PURDUE
  472. X          putbits(tmpSrc, dstBit, w, pdst);
  473. X+ #else
  474. X+         u_putbits(tmpSrc, dstBit, w, pdst);
  475. X+ #endif  /* PURDUE */
  476. X          psrc += wSrc;
  477. X          pdst += wDst;
  478. X      }
  479. X***************
  480. X*** 146,153 ****
  481. X--- 154,165 ----
  482. X  
  483. X          if (startmask)
  484. X          {
  485. X+ #ifndef PURDUE
  486. X              getbits(psrc, (xSrc & 0x1f), nstart, tmpSrc);
  487. X              putbits(tmpSrc, (xDst & 0x1f), nstart, pdst);
  488. X+ #else 
  489. X+             getandputbits(psrc, (xSrc&0x1f), (xDst&0x1f), nstart, pdst);
  490. X+ #endif  /* PURDUE */
  491. X              pdst++;
  492. X              if (srcStartOver)
  493. X              psrc++;
  494. X***************
  495. X*** 154,159 ****
  496. X--- 166,176 ----
  497. X          }
  498. X  
  499. X          nl = nlMiddle;
  500. X+ #if defined(PURDUE) && defined(FASTGETBITS)
  501. X+         Duff(nl, { FASTGETBITS(psrc, xoffSrc, 32, tmpSrc);
  502. X+              *pdst++ = tmpSrc;
  503. X+              psrc++;});
  504. X+ #else
  505. X          while (nl--)
  506. X          {
  507. X              getbits(psrc, xoffSrc, 32, tmpSrc);
  508. X***************
  509. X*** 160,170 ****
  510. X--- 177,192 ----
  511. X              *pdst++ = tmpSrc;
  512. X              psrc++;
  513. X          }
  514. X+ #endif
  515. X  
  516. X          if (endmask)
  517. X          {
  518. X+ #ifndef PURDUE
  519. X              getbits(psrc, xoffSrc, nend, tmpSrc);
  520. X              putbits(tmpSrc, 0, nend, pdst);
  521. X+ #else
  522. X+             getandputbits0(psrc, xoffSrc, nend, pdst);
  523. X+ #endif  /* PURDUE */
  524. X          }
  525. X  
  526. X          psrcLine += wSrc;
  527. X***************
  528. X*** 188,198 ****
  529. X--- 210,229 ----
  530. X  
  531. X          if (endmask)
  532. X          {
  533. X+ #ifndef PURDUE
  534. X              getbits(psrc, xoffSrc, nend, tmpSrc)
  535. X              putbits(tmpSrc, 0, nend, pdst)
  536. X+ #else
  537. X+             getandputbits0(psrc, xoffSrc, nend, pdst);
  538. X+ #endif  /* PURDUE */
  539. X          }
  540. X  
  541. X          nl = nlMiddle;
  542. X+ #if defined(PURDUE) && defined(FASTGETBITS)
  543. X+         Duff(nl, {--psrc;
  544. X+             FASTGETBITS(psrc, xoffSrc, 32, tmpSrc);
  545. X+             *--pdst = tmpSrc;});
  546. X+ #else
  547. X          while (nl--)
  548. X          {
  549. X              --psrc;
  550. X***************
  551. X*** 199,204 ****
  552. X--- 230,236 ----
  553. X              getbits(psrc, xoffSrc, 32, tmpSrc)
  554. X              *--pdst = tmpSrc;
  555. X          }
  556. X+ #endif  /* PURDUE */
  557. X  
  558. X          if (startmask)
  559. X          {
  560. X***************
  561. X*** 205,212 ****
  562. X--- 237,248 ----
  563. X              if (srcStartOver)
  564. X              --psrc;
  565. X              --pdst;
  566. X+ #ifndef PURDUE
  567. X              getbits(psrc, (xSrc & 0x1f), nstart, tmpSrc)
  568. X              putbits(tmpSrc, (xDst & 0x1f), nstart, pdst)
  569. X+ #else 
  570. X+             getandputbits(psrc, (xSrc&0x1f), (xDst&0x1f), nstart, pdst);
  571. X+ #endif  /* PURDUE */
  572. X          }
  573. X  
  574. X          pdstLine += wDst;
  575. *-*-END-of-cfboldmfb.c.patch-*-*
  576. echo x - mfbbstore.c.patch
  577. sed 's/^X//' >mfbbstore.c.patch <<'*-*-END-of-mfbbstore.c.patch-*-*'
  578. X*** /tmp/,RCSt1a01540    Wed Jan 18 23:15:09 1989
  579. X--- ddx/mfb/mfbbstore.c    Tue Jan 17 23:39:16 1989
  580. X***************
  581. X*** 1,3 ****
  582. X--- 1,4 ----
  583. X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  584. X  /***********************************************************
  585. X  
  586. X  Copyright 1987 by the Regents of the University of California
  587. X***************
  588. X*** 60,65 ****
  589. X--- 61,67 ----
  590. X      
  591. X      pBox = prgnSave->rects;
  592. X      pPt = pPtsInit;
  593. X+ #ifndef PURDUE
  594. X      for (i = prgnSave->numRects; i > 0; i--) {
  595. X      pPt->x = pBox->x1 + xorg;
  596. X      pPt->y = pBox->y1 + yorg;
  597. X***************
  598. X*** 66,71 ****
  599. X--- 68,77 ----
  600. X      pPt++;
  601. X      pBox++;
  602. X      }
  603. X+ #else
  604. X+     i = prgnSave->numRects;
  605. X+     Duff(i, pPt->x = pBox->x1 + xorg; pPt->y = pBox->y1 + yorg; pPt++; pBox++);
  606. X+ #endif  /* PURDUE */
  607. X  
  608. X  
  609. X      mfbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivate,
  610. X***************
  611. X*** 112,117 ****
  612. X--- 118,124 ----
  613. X      
  614. X      pBox = prgnRestore->rects;
  615. X      pPt = pPtsInit;
  616. X+ #ifndef PURDUE
  617. X      for (i = prgnRestore->numRects; i > 0; i--) {
  618. X      pPt->x = pBox->x1 - xorg;
  619. X      pPt->y = pBox->y1 - yorg;
  620. X***************
  621. X*** 118,123 ****
  622. X--- 125,134 ----
  623. X      pPt++;
  624. X      pBox++;
  625. X      }
  626. X+ #else
  627. X+     i = prgnRestore->numRects;
  628. X+     Duff(i, pPt->x = pBox->x1 - xorg; pPt->y = pBox->y1 - yorg; pPt++; pBox++);
  629. X+ #endif  /* PURDUE */
  630. X  
  631. X  
  632. X      mfbDoBitblt(pPixmap,
  633. *-*-END-of-mfbbstore.c.patch-*-*
  634. echo x - mfbfillrct.c.patch
  635. sed 's/^X//' >mfbfillrct.c.patch <<'*-*-END-of-mfbfillrct.c.patch-*-*'
  636. X*** /tmp/,RCSt1a01544    Wed Jan 18 23:15:11 1989
  637. X--- ddx/mfb/mfbfillrct.c    Tue Jan 17 23:39:20 1989
  638. X***************
  639. X*** 1,3 ****
  640. X--- 1,4 ----
  641. X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  642. X  /***********************************************************
  643. X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  644. X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  645. X***************
  646. X*** 81,86 ****
  647. X--- 82,88 ----
  648. X      yorg = ((WindowPtr)pDrawable)->absCorner.y;
  649. X          prect = prectInit;
  650. X      n = nrectFill;
  651. X+ #ifndef PURDUE
  652. X          while(n--)
  653. X          {
  654. X          prect->x += xorg;
  655. X***************
  656. X*** 87,92 ****
  657. X--- 89,97 ----
  658. X          prect->y += yorg;
  659. X          prect++;
  660. X          }
  661. X+ #else
  662. X+     Duff (n, prect->x += xorg; prect->y += yorg; prect++);
  663. X+ #endif
  664. X      }
  665. X  
  666. X      prect = prectInit;
  667. *-*-END-of-mfbfillrct.c.patch-*-*
  668. echo x - mfbpntwin.c.patch
  669. sed 's/^X//' >mfbpntwin.c.patch <<'*-*-END-of-mfbpntwin.c.patch-*-*'
  670. X*** /tmp/,RCSt1a01570    Wed Jan 18 23:15:31 1989
  671. X--- ddx/mfb/mfbpntwin.c    Tue Jan 17 23:39:43 1989
  672. X***************
  673. X*** 1,4 ****
  674. X--- 1,5 ----
  675. X  /* $XConsortium: mfbpntwin.c,v 1.2 88/09/06 14:53:46 jim Exp $ */
  676. X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  677. X  /***********************************************************
  678. X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  679. X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  680. X***************
  681. X*** 179,186 ****
  682. X--- 180,191 ----
  683. X              nlw = nlwMiddle;
  684. X              *p = (*p & ~startmask) | (srcpix & startmask);
  685. X              p++;
  686. X+ #ifndef PURDUE
  687. X              while (nlw--)
  688. X              *p++ = srcpix;
  689. X+ #else
  690. X+             Duff (nlw, *p++ = srcpix );
  691. X+ #endif  /* PURDUE */
  692. X              *p = (*p & ~endmask) | (srcpix & endmask);
  693. X              p += nlwExtra;
  694. X          }
  695. X***************
  696. X*** 195,202 ****
  697. X--- 200,211 ----
  698. X              nlw = nlwMiddle;
  699. X              *p = (*p & ~startmask) | (srcpix & startmask);
  700. X              p++;
  701. X+ #ifndef PURDUE
  702. X              while (nlw--)
  703. X              *p++ = srcpix;
  704. X+ #else
  705. X+         Duff (nlw, *p++ = srcpix );
  706. X+ #endif  /* PURDUE */
  707. X              p += nlwExtra;
  708. X          }
  709. X          }
  710. X***************
  711. X*** 207,214 ****
  712. X--- 216,227 ----
  713. X              srcpix = psrc[y%tileHeight];
  714. X              y++;
  715. X              nlw = nlwMiddle;
  716. X+ #ifndef PURDUE
  717. X              while (nlw--)
  718. X              *p++ = srcpix;
  719. X+ #else
  720. X+         Duff (nlw, *p++ = srcpix);
  721. X+ #endif  /* PURDUE */
  722. X              *p = (*p & ~endmask) | (srcpix & endmask);
  723. X              p += nlwExtra;
  724. X          }
  725. X***************
  726. X*** 220,227 ****
  727. X--- 233,244 ----
  728. X              srcpix = psrc[y%tileHeight];
  729. X              y++;
  730. X              nlw = nlwMiddle;
  731. X+ #ifndef PURDUE
  732. X              while (nlw--)
  733. X              *p++ = srcpix;
  734. X+ #else
  735. X+         Duff (nlw, *p++ = srcpix);
  736. X+ #endif  /* PURDUE */
  737. X              p += nlwExtra;
  738. X          }
  739. X          }
  740. *-*-END-of-mfbpntwin.c.patch-*-*
  741. echo x - mfbimggblt.c.patch
  742. sed 's/^X//' >mfbimggblt.c.patch <<'*-*-END-of-mfbimggblt.c.patch-*-*'
  743. X*** /tmp/,RCSt1a05345    Sun Jan 22 19:06:24 1989
  744. X--- ddx/mfb/mfbimggblt.c    Sun Jan 22 19:05:50 1989
  745. X***************
  746. X*** 1,3 ****
  747. X--- 1,4 ----
  748. X+ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
  749. X  /***********************************************************
  750. X  Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  751. X  and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  752. X***************
  753. X*** 277,282 ****
  754. X--- 278,286 ----
  755. X      int glyphRow;        /* first row of glyph not wholly
  756. X                     clipped out */
  757. X      int glyphCol;        /* leftmost visible column of glyph */
  758. X+ #ifdef PURDUE
  759. X+     int getWidth;        /* bits to get from glyph */
  760. X+ #endif  /* PURDUE */
  761. X  
  762. X      if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS))))
  763. X          return;
  764. X***************
  765. X*** 375,380 ****
  766. X--- 379,387 ----
  767. X  
  768. X          glyphCol = (leftEdge - ppos[i].xpos) -
  769. X                 (pci->metrics.leftSideBearing);
  770. X+ #ifdef PURDUE
  771. X+         getWidth = w + glyphCol;
  772. X+ #endif  /* PURDUE */
  773. X          xoff = xchar + (leftEdge - ppos[i].xpos);
  774. X          if (xoff > 31)
  775. X          {
  776. X***************
  777. X*** 392,398 ****
  778. X--- 399,409 ----
  779. X              maskpartialbits(xoff, w, startmask);
  780. X              while (h--)
  781. X              {
  782. X+ #ifndef PURDUE
  783. X              getshiftedleftbits(pglyph, glyphCol, w, tmpSrc);
  784. X+ #else  /* PURDUE */
  785. X+             getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
  786. X+ #endif  /* PURDUE */
  787. X              *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
  788. X              pglyph += widthGlyph;
  789. X              pdst += widthDst;
  790. X***************
  791. X*** 404,410 ****
  792. X--- 415,425 ----
  793. X              nFirst = 32 - xoff;
  794. X              while (h--)
  795. X              {
  796. X+ #ifndef PURDUE
  797. X              getshiftedleftbits(pglyph, glyphCol, w, tmpSrc);
  798. X+ #else  /* PURDUE */
  799. X+             getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
  800. X+ #endif  /* PURDUE */
  801. X              *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
  802. X              *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
  803. X              pglyph += widthGlyph;
  804. *-*-END-of-mfbimggblt.c.patch-*-*
  805. exit
  806. -- 
  807. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  808. Moderator of comp.sources.x
  809.