Revert "dtudcfonted, dtudcexch: delete from repository"
[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 #if defined(ibm032) || defined (ibm)
175
176 #ifdef i386
177 # define IMAGE_BYTE_ORDER       LSBFirst        /* Value for PS/2 only */
178 #else
179 # define IMAGE_BYTE_ORDER       MSBFirst        /* Values for the RT only*/
180 #endif
181 #define BITMAP_BIT_ORDER        MSBFirst
182 #define GLYPHPADBYTES           1
183 #define GETLEFTBITS_ALIGNMENT   4
184 /* ibm pcc doesn't understand pragmas. */
185
186 #endif /* ibm */
187
188 #ifdef hpux
189
190 #define IMAGE_BYTE_ORDER        MSBFirst        /* Values for the HP only */
191 #define BITMAP_BIT_ORDER        MSBFirst
192 #define GLYPHPADBYTES           2               /* to match product server */
193 #define GETLEFTBITS_ALIGNMENT   1
194
195 #endif /* hpux */
196
197 #if defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
198
199 #define IMAGE_BYTE_ORDER        MSBFirst        /* Values for Pegasus only */
200 #define BITMAP_BIT_ORDER        MSBFirst
201 #define GLYPHPADBYTES           4
202 #define GETLEFTBITS_ALIGNMENT   1
203
204 #define FAST_UNALIGNED_READS
205
206 #endif /* tektronix */
207
208 #ifdef mips
209
210 #ifdef MIPSEL
211 # define IMAGE_BYTE_ORDER       LSBFirst        /* Values for the PMAX only */
212 # define BITMAP_BIT_ORDER       LSBFirst
213 # define GLYPHPADBYTES          4
214 # define GETLEFTBITS_ALIGNMENT  1
215 #else
216 # define IMAGE_BYTE_ORDER       MSBFirst        /* Values for the MIPS only */
217 # define BITMAP_BIT_ORDER       MSBFirst
218 # define GLYPHPADBYTES          4
219 # define GETLEFTBITS_ALIGNMENT  1
220 #endif
221
222 #define AVOID_MEMORY_READ
223 #define FAST_CONSTANT_OFFSET_MODE
224 #define LARGE_INSTRUCTION_CACHE
225 #define PLENTIFUL_REGISTERS
226
227 #endif /* mips */
228
229 #ifdef stellar
230
231 #define IMAGE_BYTE_ORDER        MSBFirst       /* Values for the stellar only*/
232 #define BITMAP_BIT_ORDER        MSBFirst
233 #define GLYPHPADBYTES           4
234 #define GETLEFTBITS_ALIGNMENT   4
235 /*
236  * Use SysV random number generator.
237  */
238 #define random rand
239
240 #endif /* stellar */
241
242 /* size of buffer to use with GetImage, measured in bytes. There's obviously
243  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
244  * you) used and the number of times the ddx routine has to be called.
245  *
246  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get
247  * 8192/4 words per buffer
248  * (1024/32) = 32 words per scanline
249  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
250  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
251  */
252 #if defined(stellar)
253 #define IMAGE_BUFSIZE           (64*1024)
254 #else
255 #define IMAGE_BUFSIZE           8192
256 #endif
257
258 /* pad scanline to a longword */
259 #if defined(ibm) && defined(i386)
260 #define BITMAP_SCANLINE_UNIT    8
261 #else
262 #define BITMAP_SCANLINE_UNIT    32
263 #endif
264 #define BITMAP_SCANLINE_PAD  32
265
266 #define LOG2_BITMAP_PAD         5
267 #define LOG2_BYTES_PER_SCANLINE_PAD     2
268
269 /*
270  *   This returns the number of padding units, for depth d and width w.
271  * For bitmaps this can be calculated with the macros above.
272  * Other depths require either grovelling over the formats field of the
273  * screenInfo or hardwired constants.
274  */
275
276 typedef struct _PaddingInfo {
277         int     padRoundUp;     /* pixels per pad unit - 1 */
278         int     padPixelsLog2;  /* log 2 (pixels per pad unit) */
279         int     padBytesLog2;   /* log 2 (bytes per pad unit) */
280 } PaddingInfo;
281 extern PaddingInfo PixmapWidthPaddingInfo[];
282
283 #define PixmapWidthInPadUnits(w, d) \
284     (((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
285         PixmapWidthPaddingInfo[d].padPixelsLog2)
286
287 /*
288  *      Return the number of bytes to which a scanline of the given
289  * depth and width will be padded.
290  */
291 #define PixmapBytePad(w, d) \
292     (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
293
294 #endif /* SERVERMD_H */