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(__nds32__)
|
---|
88 |
|
---|
89 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
90 |
|
---|
91 | #if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
|
---|
92 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
93 | #else
|
---|
94 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
95 | #endif
|
---|
96 |
|
---|
97 | #if defined(XF86MONOVGA) || defined(XF86VGA16)
|
---|
98 | # define BITMAP_SCANLINE_UNIT 8
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | #define GLYPHPADBYTES 4
|
---|
102 | #define GETLEFTBITS_ALIGNMENT 1
|
---|
103 | #define LARGE_INSTRUCTION_CACHE
|
---|
104 | #define AVOID_MEMORY_READ
|
---|
105 |
|
---|
106 | #endif /* __nds32__ */
|
---|
107 |
|
---|
108 | #if defined __hppa__
|
---|
109 |
|
---|
110 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
111 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
112 | #define GLYPHPADBYTES 4 /* to make fb work */
|
---|
113 | /* byte boundries */
|
---|
114 | #endif /* hpux || __hppa__ */
|
---|
115 |
|
---|
116 | #if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
|
---|
117 |
|
---|
118 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
119 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
120 | #define GLYPHPADBYTES 4
|
---|
121 |
|
---|
122 | #endif /* PowerPC */
|
---|
123 |
|
---|
124 | #if defined(__sh__)
|
---|
125 |
|
---|
126 | #if defined(__BIG_ENDIAN__)
|
---|
127 | # define IMAGE_BYTE_ORDER MSBFirst
|
---|
128 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
129 | # define GLYPHPADBYTES 4
|
---|
130 | #else
|
---|
131 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
132 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
133 | # define GLYPHPADBYTES 4
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | #endif /* SuperH */
|
---|
137 |
|
---|
138 | #if defined(__m32r__)
|
---|
139 |
|
---|
140 | #if defined(__BIG_ENDIAN__)
|
---|
141 | # define IMAGE_BYTE_ORDER MSBFirst
|
---|
142 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
143 | # define GLYPHPADBYTES 4
|
---|
144 | #else
|
---|
145 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
146 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
147 | # define GLYPHPADBYTES 4
|
---|
148 | #endif
|
---|
149 |
|
---|
150 | #endif /* __m32r__ */
|
---|
151 |
|
---|
152 | #if (defined(sun) && (defined(__sparc) || defined(sparc))) || \
|
---|
153 | (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \
|
---|
154 | defined(__sparc__) || defined(__mc68000__)
|
---|
155 |
|
---|
156 | #if defined(__sparc) || defined(__sparc__)
|
---|
157 | # if !defined(sparc)
|
---|
158 | # define sparc 1
|
---|
159 | # endif
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | #if defined(sun386) || defined(sun5)
|
---|
163 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
|
---|
164 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
165 | #else
|
---|
166 | # define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */
|
---|
167 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
168 | #endif
|
---|
169 |
|
---|
170 | #define GLYPHPADBYTES 4
|
---|
171 |
|
---|
172 | #endif /* sun && !(i386 && SVR4) */
|
---|
173 |
|
---|
174 |
|
---|
175 | #if defined(ibm032) || defined (ibm)
|
---|
176 |
|
---|
177 | #ifdef __i386__
|
---|
178 | # define IMAGE_BYTE_ORDER LSBFirst /* Value for PS/2 only */
|
---|
179 | #else
|
---|
180 | # define IMAGE_BYTE_ORDER MSBFirst /* Values for the RT only*/
|
---|
181 | #endif
|
---|
182 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
183 | #define GLYPHPADBYTES 1
|
---|
184 | /* ibm pcc doesn't understand pragmas. */
|
---|
185 |
|
---|
186 | #ifdef __i386__
|
---|
187 | #define BITMAP_SCANLINE_UNIT 8
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | #endif /* ibm */
|
---|
191 |
|
---|
192 | #if (defined(mips) || defined(__mips))
|
---|
193 |
|
---|
194 | #if defined(MIPSEL) || defined(__MIPSEL__)
|
---|
195 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
|
---|
196 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
197 | # define GLYPHPADBYTES 4
|
---|
198 | #else
|
---|
199 | # define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
|
---|
200 | # define BITMAP_BIT_ORDER MSBFirst
|
---|
201 | # define GLYPHPADBYTES 4
|
---|
202 | #endif
|
---|
203 |
|
---|
204 | #endif /* mips */
|
---|
205 |
|
---|
206 | #if defined(__alpha) || defined(__alpha__)
|
---|
207 | # define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */
|
---|
208 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
209 | # define GLYPHPADBYTES 4
|
---|
210 |
|
---|
211 | #endif /* alpha */
|
---|
212 |
|
---|
213 | #if defined (linux) && defined (__s390__)
|
---|
214 |
|
---|
215 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
216 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
217 | #define GLYPHPADBYTES 4
|
---|
218 |
|
---|
219 | #define BITMAP_SCANLINE_UNIT 8
|
---|
220 | #define FAST_UNALIGNED_READ
|
---|
221 |
|
---|
222 | #endif /* linux/s390 */
|
---|
223 |
|
---|
224 | #if defined (linux) && defined (__s390x__)
|
---|
225 |
|
---|
226 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
227 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
228 | #define GLYPHPADBYTES 4
|
---|
229 |
|
---|
230 | #define BITMAP_SCANLINE_UNIT 8
|
---|
231 | #define FAST_UNALIGNED_READ
|
---|
232 |
|
---|
233 | #endif /* linux/s390x */
|
---|
234 |
|
---|
235 |
|
---|
236 | #if defined(__ia64__) || defined(ia64)
|
---|
237 |
|
---|
238 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
239 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
240 | # define GLYPHPADBYTES 4
|
---|
241 |
|
---|
242 | #endif /* ia64 */
|
---|
243 |
|
---|
244 | #if defined(__amd64__) || defined(amd64) || defined(__amd64)
|
---|
245 | # define IMAGE_BYTE_ORDER LSBFirst
|
---|
246 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
247 | # define GLYPHPADBYTES 4
|
---|
248 | /* ???? */
|
---|
249 | #endif /* AMD64 */
|
---|
250 |
|
---|
251 | #if defined(SVR4) && (defined(__i386__) || defined(__i386) ) || \
|
---|
252 | defined(__alpha__) || defined(__alpha) || \
|
---|
253 | defined(__i386__) || \
|
---|
254 | defined(__s390x__) || defined(__s390__)
|
---|
255 |
|
---|
256 | #ifndef IMAGE_BYTE_ORDER
|
---|
257 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
258 | #endif
|
---|
259 |
|
---|
260 | #ifndef BITMAP_BIT_ORDER
|
---|
261 | # define BITMAP_BIT_ORDER LSBFirst
|
---|
262 | #endif
|
---|
263 |
|
---|
264 | #ifndef GLYPHPADBYTES
|
---|
265 | #define GLYPHPADBYTES 4
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #endif /* SVR4 / BSD / i386 */
|
---|
269 |
|
---|
270 | #if defined (linux) && defined (__mc68000__)
|
---|
271 |
|
---|
272 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
273 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
274 | #define GLYPHPADBYTES 4
|
---|
275 |
|
---|
276 | #endif /* linux/m68k */
|
---|
277 |
|
---|
278 |
|
---|
279 | /* linux on ARM */
|
---|
280 | #if defined(linux) && defined(__arm__)
|
---|
281 | #define IMAGE_BYTE_ORDER LSBFirst
|
---|
282 | #define BITMAP_BIT_ORDER LSBFirst
|
---|
283 | #define GLYPHPADBYTES 4
|
---|
284 | #endif
|
---|
285 |
|
---|
286 | /* linux on IBM S/390 */
|
---|
287 | #if defined (linux) && defined (__s390__)
|
---|
288 | #define IMAGE_BYTE_ORDER MSBFirst
|
---|
289 | #define BITMAP_BIT_ORDER MSBFirst
|
---|
290 | #define GLYPHPADBYTES 4
|
---|
291 | #endif /* linux/s390 */
|
---|
292 |
|
---|
293 | /* size of buffer to use with GetImage, measured in bytes. There's obviously
|
---|
294 | * a trade-off between the amount of heap used and the number of times the
|
---|
295 | * ddx routine has to be called.
|
---|
296 | */
|
---|
297 | #ifndef IMAGE_BUFSIZE
|
---|
298 | #define IMAGE_BUFSIZE (64*1024)
|
---|
299 | #endif
|
---|
300 |
|
---|
301 | /* pad scanline to a longword */
|
---|
302 | #ifndef BITMAP_SCANLINE_UNIT
|
---|
303 | #define BITMAP_SCANLINE_UNIT 32
|
---|
304 | #endif
|
---|
305 |
|
---|
306 | #ifndef BITMAP_SCANLINE_PAD
|
---|
307 | #define BITMAP_SCANLINE_PAD 32
|
---|
308 | #define LOG2_BITMAP_PAD 5
|
---|
309 | #define LOG2_BYTES_PER_SCANLINE_PAD 2
|
---|
310 | #endif
|
---|
311 |
|
---|
312 | #include <X11/Xfuncproto.h>
|
---|
313 | /*
|
---|
314 | * This returns the number of padding units, for depth d and width w.
|
---|
315 | * For bitmaps this can be calculated with the macros above.
|
---|
316 | * Other depths require either grovelling over the formats field of the
|
---|
317 | * screenInfo or hardwired constants.
|
---|
318 | */
|
---|
319 |
|
---|
320 | typedef struct _PaddingInfo {
|
---|
321 | int padRoundUp; /* pixels per pad unit - 1 */
|
---|
322 | int padPixelsLog2; /* log 2 (pixels per pad unit) */
|
---|
323 | int padBytesLog2; /* log 2 (bytes per pad unit) */
|
---|
324 | int notPower2; /* bitsPerPixel not a power of 2 */
|
---|
325 | int bytesPerPixel; /* only set when notPower2 is TRUE */
|
---|
326 | int bitsPerPixel; /* bits per pixel */
|
---|
327 | } PaddingInfo;
|
---|
328 | extern _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[];
|
---|
329 |
|
---|
330 | /* The only portable way to get the bpp from the depth is to look it up */
|
---|
331 | #define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
|
---|
332 |
|
---|
333 | #define PixmapWidthInPadUnits(w, d) \
|
---|
334 | (PixmapWidthPaddingInfo[d].notPower2 ? \
|
---|
335 | (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
|
---|
336 | PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
|
---|
337 | PixmapWidthPaddingInfo[d].padBytesLog2) : \
|
---|
338 | ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
|
---|
339 | PixmapWidthPaddingInfo[d].padPixelsLog2))
|
---|
340 |
|
---|
341 | /*
|
---|
342 | * Return the number of bytes to which a scanline of the given
|
---|
343 | * depth and width will be padded.
|
---|
344 | */
|
---|
345 | #define PixmapBytePad(w, d) \
|
---|
346 | (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
|
---|
347 |
|
---|
348 | #define BitmapBytePad(w) \
|
---|
349 | (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
|
---|
350 |
|
---|
351 | #define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d)
|
---|
352 | #define PixmapBytePadProto(w, d) PixmapBytePad(w, d)
|
---|
353 | #define BitmapBytePadProto(w) BitmapBytePad(w)
|
---|
354 |
|
---|
355 | #endif /* SERVERMD_H */
|
---|