home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / g / gs241j11.zip / INCLUDE.PCF / SERVERMD.H < prev   
C/C++ Source or Header  |  1992-04-02  |  10KB  |  313 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. #ifndef SERVERMD_H
  25. #define SERVERMD_H 1
  26. /* $XConsortium: servermd.h,v 1.60 91/06/30 11:29:35 rws Exp $ */
  27.  
  28. /*
  29.  * Machine dependent values:
  30.  * GLYPHPADBYTES should be chosen with consideration for the space-time
  31.  * trade-off.  Padding to 0 bytes means that there is no wasted space
  32.  * in the font bitmaps (both on disk and in memory), but that access of
  33.  * the bitmaps will cause odd-address memory references.  Padding to
  34.  * 2 bytes would ensure even address memory references and would
  35.  * be suitable for a 68010-class machine, but at the expense of wasted
  36.  * space in the font bitmaps.  Padding to 4 bytes would be good
  37.  * for real 32 bit machines, etc.  Be sure that you tell the font
  38.  * compiler what kind of padding you want because its defines are
  39.  * kept separate from this.  See server/include/font.h for how
  40.  * GLYPHPADBYTES is used.
  41.  *
  42.  * Along with this, you should choose an appropriate value for
  43.  * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
  44.  * constant choses what kind of memory references are guarenteed during
  45.  * font access; either 1, 2 or 4, for byte, word or longword access,
  46.  * respectively.  For instance, if you have decided to to have
  47.  * GLYPHPADBYTES == 4, then it is pointless for you to have a
  48.  * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
  49.  * guarenteed you that your fonts are longword aligned.  On the other
  50.  * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
  51.  * also decide that the computing involved in aligning the pointer is more
  52.  * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
  53.  *
  54.  * Next, choose the tuning parameters which are appropriate for your
  55.  * hardware; these modify the behaviour of the raw frame buffer code
  56.  * in ddx/mfb and ddx/cfb.  Defining these incorrectly will not cause
  57.  * the server to run incorrectly, but defining these correctly will
  58.  * cause some noticeable speed improvements:
  59.  *
  60.  *  AVOID_MEMORY_READ - (8-bit cfb only)
  61.  *    When stippling pixels on the screen (polytext and pushpixels),
  62.  *    don't read long words from the display and mask in the
  63.  *    appropriate values.  Rather, perform multiple byte/short/long
  64.  *    writes as appropriate.  This option uses many more instructions
  65.  *    but runs much faster when the destination is much slower than
  66.  *    the CPU and at least 1 level of write buffer is availible (2
  67.  *    is much better).  Defined currently for SPARC and MIPS.
  68.  *
  69.  *  FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
  70.  *    This define is used on machines which have no auto-increment
  71.  *    addressing mode, but do have an effectively free constant-offset
  72.  *    addressing mode.  Currently defined for MIPS and SPARC, even though
  73.  *    I remember the cg6 as performing better without it (cg3 definitely
  74.  *    performs better with it).
  75.  *    
  76.  *  LARGE_INSTRUCTION_CACHE -
  77.  *    This define increases the number of times some loops are
  78.  *    unrolled.  On 68020 machines (with 256 bytes of i-cache),
  79.  *    this define will slow execution down as instructions miss
  80.  *    the cache frequently.  On machines with real i-caches, this
  81.  *    reduces loop overhead, causing a slight performance improvement.
  82.  *    Currently defined for MIPS and SPARC
  83.  *
  84.  *  FAST_UNALIGNED_READS -
  85.  *    For machines with more memory bandwidth than CPU, this
  86.  *    define uses unaligned reads for 8-bit BitBLT instead of doing
  87.  *    aligned reads and combining the results with shifts and
  88.  *    logical-ors.  Currently defined for 68020 and vax.
  89.  *  PLENTIFUL_REGISTERS -
  90.  *    For machines with > 20 registers.  Currently used for
  91.  *    unrolling the text painting code a bit more.  Currently
  92.  *    defined for MIPS.
  93.  *  SHARED_IDCACHE -
  94.  *    For non-Harvard RISC machines, those which share the same
  95.  *    CPU memory bus for instructions and data.  This unrolls some
  96.  *    solid fill loops which are otherwise best left rolled up.
  97.  *    Currently defined for SPARC.
  98.  */
  99.  
  100. #ifdef vax
  101.  
  102. #define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the VAX only */
  103. #define BITMAP_BIT_ORDER    LSBFirst
  104. #define    GLYPHPADBYTES        1
  105. #define GETLEFTBITS_ALIGNMENT    4
  106. #define FAST_UNALIGNED_READS
  107.  
  108. #endif /* vax */
  109.  
  110. #ifdef sun
  111.  
  112. #if defined(sun386) || defined(sun5)
  113. # define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the SUN only */
  114. # define BITMAP_BIT_ORDER    LSBFirst
  115. #else
  116. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the SUN only */
  117. # define BITMAP_BIT_ORDER    MSBFirst
  118. #endif
  119.  
  120. #ifdef sparc
  121. # define AVOID_MEMORY_READ
  122. # define LARGE_INSTRUCTION_CACHE
  123. # define FAST_CONSTANT_OFFSET_MODE
  124. # define SHARED_IDCACHE
  125. #endif
  126.  
  127. #ifdef mc68020
  128. #define FAST_UNALIGNED_READS
  129. #endif
  130.  
  131. #define    GLYPHPADBYTES        4
  132. #define GETLEFTBITS_ALIGNMENT    1
  133.  
  134. #endif /* sun */
  135.  
  136. #ifdef apollo
  137.  
  138. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the Apollo only*/
  139. #define BITMAP_BIT_ORDER    MSBFirst
  140. #define    GLYPHPADBYTES        2
  141. #define GETLEFTBITS_ALIGNMENT    4
  142.  
  143. #endif /* apollo */
  144.  
  145. #if defined(AIXV3)
  146.  
  147. #define IMAGE_BYTE_ORDER        MSBFirst        /* Values for the RISC/6000 */
  148. #define BITMAP_BIT_ORDER        MSBFirst
  149. #define GLYPHPADBYTES           4
  150. #define GETLEFTBITS_ALIGNMENT   1
  151.  
  152. #endif /* AIXV3 */
  153.  
  154. #if defined(ibm032) || defined (ibm)
  155.  
  156. #ifdef i386
  157. # define IMAGE_BYTE_ORDER    LSBFirst    /* Value for PS/2 only */
  158. #else
  159. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the RT only*/
  160. #endif
  161. #define BITMAP_BIT_ORDER    MSBFirst
  162. #define    GLYPHPADBYTES        1
  163. #define GETLEFTBITS_ALIGNMENT    4
  164. /* ibm pcc doesn't understand pragmas. */
  165.  
  166. #ifdef i386
  167. #define BITMAP_SCANLINE_UNIT    8
  168. #endif
  169.  
  170. #endif /* ibm */
  171.  
  172. #ifdef hpux
  173.  
  174. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the HP only */
  175. #define BITMAP_BIT_ORDER    MSBFirst
  176. #define    GLYPHPADBYTES        2        /* to match product server */
  177. #define    GETLEFTBITS_ALIGNMENT    1
  178.  
  179. #endif /* hpux */
  180.  
  181. #if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
  182.  
  183. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for Pegasus only */
  184. #define BITMAP_BIT_ORDER    MSBFirst
  185. #define GLYPHPADBYTES        4
  186. #define GETLEFTBITS_ALIGNMENT    1
  187.  
  188. #define FAST_UNALIGNED_READS
  189.  
  190. #endif /* tektronix */
  191.  
  192. #ifdef macII
  193.  
  194. #define IMAGE_BYTE_ORDER          MSBFirst        /* Values for the MacII only */
  195. #define BITMAP_BIT_ORDER          MSBFirst
  196. #define GLYPHPADBYTES             4
  197. #define GETLEFTBITS_ALIGNMENT     1
  198.  
  199. /* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */
  200.  
  201. #endif /* macII */
  202.  
  203. #ifdef mips
  204.  
  205. #ifdef MIPSEL
  206. # define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the PMAX only */
  207. # define BITMAP_BIT_ORDER    LSBFirst
  208. # define GLYPHPADBYTES        4
  209. # define GETLEFTBITS_ALIGNMENT    1
  210. #else
  211. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the MIPS only */
  212. # define BITMAP_BIT_ORDER    MSBFirst
  213. # define GLYPHPADBYTES        4
  214. # define GETLEFTBITS_ALIGNMENT    1
  215. #endif
  216.  
  217. #define AVOID_MEMORY_READ
  218. #define FAST_CONSTANT_OFFSET_MODE
  219. #define LARGE_INSTRUCTION_CACHE
  220. #define PLENTIFUL_REGISTERS
  221.  
  222. #endif /* mips */
  223.  
  224. #ifdef stellar
  225.  
  226. #define IMAGE_BYTE_ORDER    MSBFirst       /* Values for the stellar only*/
  227. #define BITMAP_BIT_ORDER    MSBFirst
  228. #define    GLYPHPADBYTES        4
  229. #define GETLEFTBITS_ALIGNMENT    4
  230. #define IMAGE_BUFSIZE        (64*1024)
  231. /*
  232.  * Use SysV random number generator.
  233.  */
  234. #define random rand
  235.  
  236. #endif /* stellar */
  237.  
  238. #ifdef luna
  239.  
  240. #define IMAGE_BYTE_ORDER        MSBFirst       /* Values for the OMRON only*/
  241. #define BITMAP_BIT_ORDER    MSBFirst
  242. #define    GLYPHPADBYTES        4
  243. #define GETLEFTBITS_ALIGNMENT    1
  244.  
  245. #ifndef mc68000
  246. #define FAST_CONSTANT_OFFSET_MODE
  247. #define AVOID_MEMORY_READ
  248. #define LARGE_INSTRUCTION_CACHE
  249. #define PLENTIFUL_REGISTERS
  250. #endif
  251.  
  252. #endif /* luna */
  253.  
  254. #ifdef SYSV386
  255.  
  256. #define IMAGE_BYTE_ORDER    LSBFirst
  257. #define BITMAP_BIT_ORDER    LSBFirst
  258. #define GLYPHPADBYTES        4
  259. #define GETLEFTBITS_ALIGNMENT    1
  260. #define AVOID_MEMORY_READ
  261.  
  262. #endif /* SYSV386 */
  263.  
  264. /* size of buffer to use with GetImage, measured in bytes. There's obviously
  265.  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
  266.  * you) used and the number of times the ddx routine has to be called.
  267.  * 
  268.  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get 
  269.  * 8192/4 words per buffer 
  270.  * (1024/32) = 32 words per scanline
  271.  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
  272.  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
  273.  */
  274. #ifndef IMAGE_BUFSIZE
  275. #define IMAGE_BUFSIZE        8192
  276. #endif
  277.  
  278. /* pad scanline to a longword */
  279. #ifndef BITMAP_SCANLINE_UNIT
  280. #define BITMAP_SCANLINE_UNIT    32
  281. #endif
  282.  
  283. #define BITMAP_SCANLINE_PAD  32
  284. #define LOG2_BITMAP_PAD        5
  285. #define LOG2_BYTES_PER_SCANLINE_PAD    2
  286.  
  287. /* 
  288.  *   This returns the number of padding units, for depth d and width w.
  289.  * For bitmaps this can be calculated with the macros above.
  290.  * Other depths require either grovelling over the formats field of the
  291.  * screenInfo or hardwired constants.
  292.  */
  293.  
  294. typedef struct _PaddingInfo {
  295.     int     padRoundUp;    /* pixels per pad unit - 1 */
  296.     int    padPixelsLog2;    /* log 2 (pixels per pad unit) */
  297.     int     padBytesLog2;    /* log 2 (bytes per pad unit) */
  298. } PaddingInfo;
  299. extern PaddingInfo PixmapWidthPaddingInfo[];
  300.  
  301. #define PixmapWidthInPadUnits(w, d) \
  302.     (((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
  303.     PixmapWidthPaddingInfo[d].padPixelsLog2)
  304.  
  305. /*
  306.  *    Return the number of bytes to which a scanline of the given
  307.  * depth and width will be padded.
  308.  */
  309. #define PixmapBytePad(w, d) \
  310.     (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
  311.  
  312. #endif /* SERVERMD_H */
  313.