1 | /***********************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 |
|
---|
25 |
|
---|
26 | Copyright 1987 by Digital Equipment Corporation, Maynard, 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 name of Digital 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 | ******************************************************************/
|
---|
47 |
|
---|
48 | #ifndef SERVERMD_H
|
---|
49 | #define SERVERMD_H 1
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Note: much of this is vestigial from mfb/cfb times. This should
|
---|
53 | * really be simplified even further.
|
---|
54 | */
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * Machine dependent values:
|
---|
58 | * GLYPHPADBYTES should be chosen with consideration for the space-time
|
---|
59 | * trade-off. Padding to 0 bytes means that there is no wasted space
|
---|
60 | * in the font bitmaps (both on disk and in memory), but that access of
|
---|
61 | * the bitmaps will cause odd-address memory references. Padding to
|
---|
62 | * 2 bytes would ensure even address memory references and would
|
---|
63 | * be suitable for a 68010-class machine, but at the expense of wasted
|
---|
64 | * space in the font bitmaps. Padding to 4 bytes would be good
|
---|
65 | * for real 32 bit machines, etc. Be sure that you tell the font
|
---|
66 | * compiler what kind of padding you want because its defines are
|
---|
67 | * kept separate from this. See server/include/font.h for how
|
---|
68 | * GLYPHPADBYTES is used.
|
---|
69 | */
|
---|
70 |
|
---|
71 | #ifdef __avr32__
|
---|
72 |
|
---|
73 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
74 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
75 | #define GLYPHPADBYTES 4
|
---|
76 |
|
---|
77 | #endif /* __avr32__ */
|
---|
78 |
|
---|
79 | #ifdef __arm32__
|
---|
80 |
|
---|
81 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
82 | #define BITMAP_BIT_ORDER LSBFirst
|
---|
83 | #define GLYPHPADBYTES 4
|
---|
84 |
|
---|
85 | #endif /* __arm32__ */
|
---|
86 |
|
---|
87 | #if defined __hppa__
|
---|
88 |
|
---|
89 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
90 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
91 | #define GLYPHPADBYTES 4 /* to make fb work */
|
---|
92 | /* byte boundries */
|
---|
93 | #endif /* hpux || __hppa__ */
|
---|
94 |
|
---|
95 | #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
|
---|
96 |
|
---|
97 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
98 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
99 | #define GLYPHPADBYTES 4
|
---|
100 |
|
---|
101 | #endif /* PowerPC */
|
---|
102 |
|
---|
103 | #if defined(__sh__)
|
---|
104 |
|
---|
105 | #if defined(__BIG_ENDIAN__)
|
---|
106 | # define IMAGE_BYTE_ORDER MSBFirst
|
---|
107 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
108 | # define GLYPHPADBYTES 4
|
---|
109 | #else
|
---|
110 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
111 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
112 | # define GLYPHPADBYTES 4
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #endif /* SuperH */
|
---|
116 |
|
---|
117 | #if defined(__m32r__)
|
---|
118 |
|
---|
119 | #if defined(__BIG_ENDIAN__)
|
---|
120 | # define IMAGE_BYTE_ORDER MSBFirst
|
---|
121 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
122 | # define GLYPHPADBYTES 4
|
---|
123 | #else
|
---|
124 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
125 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
126 | # define GLYPHPADBYTES 4
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #endif /* __m32r__ */
|
---|
130 |
|
---|
131 | #if (defined(sun) && (defined(__sparc) || defined(sparc))) || \
|
---|
132 | (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \
|
---|
133 | defined(__sparc__) || defined(__mc68000__)
|
---|
134 |
|
---|
135 | #if defined(__sparc) || defined(__sparc__)
|
---|
136 | # if !defined(sparc)
|
---|
137 | # define sparc 1
|
---|
138 | # endif
|
---|
139 | #endif
|
---|
140 |
|
---|
141 | #if defined(sun386) || defined(sun5)
|
---|
142 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
|
---|
143 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
144 | #else
|
---|
145 | # define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */
|
---|
146 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | #define GLYPHPADBYTES 4
|
---|
150 |
|
---|
151 | #endif /* sun && !(i386 && SVR4) */
|
---|
152 |
|
---|
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 | /* ibm pcc doesn't understand pragmas. */
|
---|
164 |
|
---|
165 | #ifdef __i386__
|
---|
166 | #define BITMAP_SCANLINE_UNIT 8
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | #endif /* ibm */
|
---|
170 |
|
---|
171 | #if (defined(mips) || defined(__mips))
|
---|
172 |
|
---|
173 | #if defined(MIPSEL) || defined(__MIPSEL__)
|
---|
174 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
|
---|
175 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
176 | # define GLYPHPADBYTES 4
|
---|
177 | #else
|
---|
178 | # define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
|
---|
179 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
180 | # define GLYPHPADBYTES 4
|
---|
181 | #endif
|
---|
182 |
|
---|
183 | #endif /* mips */
|
---|
184 |
|
---|
185 | #if defined(__alpha) || defined(__alpha__)
|
---|
186 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */
|
---|
187 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
188 | # define GLYPHPADBYTES 4
|
---|
189 |
|
---|
190 | #endif /* alpha */
|
---|
191 |
|
---|
192 | #if defined (linux) && defined (__s390__)
|
---|
193 |
|
---|
194 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
195 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
196 | #define GLYPHPADBYTES 4
|
---|
197 |
|
---|
198 | #define BITMAP_SCANLINE_UNIT 8
|
---|
199 | #define FAST_UNALIGNED_READ
|
---|
200 |
|
---|
201 | #endif /* linux/s390 */
|
---|
202 |
|
---|
203 | #if defined (linux) && defined (__s390x__)
|
---|
204 |
|
---|
205 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
206 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
207 | #define GLYPHPADBYTES 4
|
---|
208 |
|
---|
209 | #define BITMAP_SCANLINE_UNIT 8
|
---|
210 | #define FAST_UNALIGNED_READ
|
---|
211 |
|
---|
212 | #endif /* linux/s390x */
|
---|
213 |
|
---|
214 |
|
---|
215 | #if defined(__ia64__) || defined(ia64)
|
---|
216 |
|
---|
217 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
218 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
219 | # define GLYPHPADBYTES 4
|
---|
220 |
|
---|
221 | #endif /* ia64 */
|
---|
222 |
|
---|
223 | #if defined(__amd64__) || defined(amd64) || defined(__amd64)
|
---|
224 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
225 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
226 | # define GLYPHPADBYTES 4
|
---|
227 | /* ???? */
|
---|
228 | #endif /* AMD64 */
|
---|
229 |
|
---|
230 | #if defined(SVR4) && (defined(__i386__) || defined(__i386) ) || \
|
---|
231 | defined(__alpha__) || defined(__alpha) || \
|
---|
232 | defined(__i386__) || \
|
---|
233 | defined(__s390x__) || defined(__s390__)
|
---|
234 |
|
---|
235 | #ifndef IMAGE_BYTE_ORDER
|
---|
236 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
237 | #endif
|
---|
238 |
|
---|
239 | #ifndef BITMAP_BIT_ORDER
|
---|
240 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
241 | #endif
|
---|
242 |
|
---|
243 | #ifndef GLYPHPADBYTES
|
---|
244 | #define GLYPHPADBYTES 4
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | #endif /* SVR4 / BSD / i386 */
|
---|
248 |
|
---|
249 | #if defined (linux) && defined (__mc68000__)
|
---|
250 |
|
---|
251 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
252 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
253 | #define GLYPHPADBYTES 4
|
---|
254 |
|
---|
255 | #endif /* linux/m68k */
|
---|
256 |
|
---|
257 |
|
---|
258 | /* linux on ARM */
|
---|
259 | #if defined(linux) && defined(__arm__)
|
---|
260 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
261 | #define BITMAP_BIT_ORDER LSBFirst
|
---|
262 | #define GLYPHPADBYTES 4
|
---|
263 | #endif
|
---|
264 |
|
---|
265 | /* linux on IBM S/390 */
|
---|
266 | #if defined (linux) && defined (__s390__)
|
---|
267 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
268 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
269 | #define GLYPHPADBYTES 4
|
---|
270 | #endif /* linux/s390 */
|
---|
271 |
|
---|
272 | /* size of buffer to use with GetImage, measured in bytes. There's obviously
|
---|
273 | * a trade-off between the amount of heap used and the number of times the
|
---|
274 | * ddx routine has to be called.
|
---|
275 | */
|
---|
276 | #ifndef IMAGE_BUFSIZE
|
---|
277 | #define IMAGE_BUFSIZE (64*1024)
|
---|
278 | #endif
|
---|
279 |
|
---|
280 | /* pad scanline to a longword */
|
---|
281 | #ifndef BITMAP_SCANLINE_UNIT
|
---|
282 | #define BITMAP_SCANLINE_UNIT 32
|
---|
283 | #endif
|
---|
284 |
|
---|
285 | #ifndef BITMAP_SCANLINE_PAD
|
---|
286 | #define BITMAP_SCANLINE_PAD 32
|
---|
287 | #define LOG2_BITMAP_PAD 5
|
---|
288 | #define LOG2_BYTES_PER_SCANLINE_PAD 2
|
---|
289 | #endif
|
---|
290 |
|
---|
291 | /*
|
---|
292 | * This returns the number of padding units, for depth d and width w.
|
---|
293 | * For bitmaps this can be calculated with the macros above.
|
---|
294 | * Other depths require either grovelling over the formats field of the
|
---|
295 | * screenInfo or hardwired constants.
|
---|
296 | */
|
---|
297 |
|
---|
298 | typedef struct _PaddingInfo {
|
---|
299 | int padRoundUp; /* pixels per pad unit - 1 */
|
---|
300 | int padPixelsLog2; /* log 2 (pixels per pad unit) */
|
---|
301 | int padBytesLog2; /* log 2 (bytes per pad unit) */
|
---|
302 | int notPower2; /* bitsPerPixel not a power of 2 */
|
---|
303 | int bytesPerPixel; /* only set when notPower2 is TRUE */
|
---|
304 | int bitsPerPixel; /* bits per pixel */
|
---|
305 | } PaddingInfo;
|
---|
306 | extern PaddingInfo PixmapWidthPaddingInfo[];
|
---|
307 |
|
---|
308 | /* The only portable way to get the bpp from the depth is to look it up */
|
---|
309 | #define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
|
---|
310 |
|
---|
311 | #define PixmapWidthInPadUnits(w, d) \
|
---|
312 | (PixmapWidthPaddingInfo[d].notPower2 ? \
|
---|
313 | (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
|
---|
314 | PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
|
---|
315 | PixmapWidthPaddingInfo[d].padBytesLog2) : \
|
---|
316 | ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
|
---|
317 | PixmapWidthPaddingInfo[d].padPixelsLog2))
|
---|
318 |
|
---|
319 | /*
|
---|
320 | * Return the number of bytes to which a scanline of the given
|
---|
321 | * depth and width will be padded.
|
---|
322 | */
|
---|
323 | #define PixmapBytePad(w, d) \
|
---|
324 | (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
|
---|
325 |
|
---|
326 | #define BitmapBytePad(w) \
|
---|
327 | (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
|
---|
328 |
|
---|
329 | #define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d)
|
---|
330 | #define PixmapBytePadProto(w, d) PixmapBytePad(w, d)
|
---|
331 | #define BitmapBytePadProto(w) BitmapBytePad(w)
|
---|
332 |
|
---|
333 | #endif /* SERVERMD_H */
|
---|