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