1 /***********************************************************
2 
3 Copyright (c) 1987  X Consortium
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11 
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14 
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
25 
26 
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
28 
29                         All Rights Reserved
30 
31 Permission to use, copy, modify, and distribute this software and its
32 documentation for any purpose and without fee is hereby granted,
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.
38 
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
45 SOFTWARE.
46 
47 ******************************************************************/
48 #ifndef SERVERMD_H
49 #define SERVERMD_H 1
50 /* $XConsortium: servermd.h /main/58 1996/12/02 10:22:09 lehors $ */
51 /* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.19.2.3 1997/07/28 14:17:34 dawes Exp $ */
52 
53 /*
54  * Machine dependent values:
55  * GLYPHPADBYTES should be chosen with consideration for the space-time
56  * trade-off.  Padding to 0 bytes means that there is no wasted space
57  * in the font bitmaps (both on disk and in memory), but that access of
58  * the bitmaps will cause odd-address memory references.  Padding to
59  * 2 bytes would ensure even address memory references and would
60  * be suitable for a 68010-class machine, but at the expense of wasted
61  * space in the font bitmaps.  Padding to 4 bytes would be good
62  * for real 32 bit machines, etc.  Be sure that you tell the font
63  * compiler what kind of padding you want because its defines are
64  * kept separate from this.  See server/include/font.h for how
65  * GLYPHPADBYTES is used.
66  *
67  * Along with this, you should choose an appropriate value for
68  * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
69  * constant choses what kind of memory references are guarenteed during
70  * font access; either 1, 2 or 4, for byte, word or longword access,
71  * respectively.  For instance, if you have decided to to have
72  * GLYPHPADBYTES == 4, then it is pointless for you to have a
73  * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
74  * guarenteed you that your fonts are longword aligned.  On the other
75  * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
76  * also decide that the computing involved in aligning the pointer is more
77  * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
78  *
79  * Next, choose the tuning parameters which are appropriate for your
80  * hardware; these modify the behaviour of the raw frame buffer code
81  * in ddx/mfb and ddx/cfb.  Defining these incorrectly will not cause
82  * the server to run incorrectly, but defining these correctly will
83  * cause some noticeable speed improvements:
84  *
85  *  AVOID_MEMORY_READ - (8-bit cfb only)
86  *	When stippling pixels on the screen (polytext and pushpixels),
87  *	don't read long words from the display and mask in the
88  *	appropriate values.  Rather, perform multiple byte/short/long
89  *	writes as appropriate.  This option uses many more instructions
90  *	but runs much faster when the destination is much slower than
91  *	the CPU and at least 1 level of write buffer is availible (2
92  *	is much better).  Defined currently for SPARC and MIPS.
93  *
94  *  FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
95  *	This define is used on machines which have no auto-increment
96  *	addressing mode, but do have an effectively free constant-offset
97  *	addressing mode.  Currently defined for MIPS and SPARC, even though
98  *	I remember the cg6 as performing better without it (cg3 definitely
99  *	performs better with it).
100  *
101  *  LARGE_INSTRUCTION_CACHE -
102  *	This define increases the number of times some loops are
103  *	unrolled.  On 68020 machines (with 256 bytes of i-cache),
104  *	this define will slow execution down as instructions miss
105  *	the cache frequently.  On machines with real i-caches, this
106  *	reduces loop overhead, causing a slight performance improvement.
107  *	Currently defined for MIPS and SPARC
108  *
109  *  FAST_UNALIGNED_READS -
110  *	For machines with more memory bandwidth than CPU, this
111  *	define uses unaligned reads for 8-bit BitBLT instead of doing
112  *	aligned reads and combining the results with shifts and
113  *	logical-ors.  Currently defined for 68020 and vax.
114  *  PLENTIFUL_REGISTERS -
115  *	For machines with > 20 registers.  Currently used for
116  *	unrolling the text painting code a bit more.  Currently
117  *	defined for MIPS.
118  *  SHARED_IDCACHE -
119  *	For non-Harvard RISC machines, those which share the same
120  *	CPU memory bus for instructions and data.  This unrolls some
121  *	solid fill loops which are otherwise best left rolled up.
122  *	Currently defined for SPARC.
123  */
124 
125 #ifdef vax
126 
127 #define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the VAX only */
128 #define BITMAP_BIT_ORDER	LSBFirst
129 #define	GLYPHPADBYTES		1
130 #define GETLEFTBITS_ALIGNMENT	4
131 #define FAST_UNALIGNED_READS
132 
133 #endif /* vax */
134 
135 #if (defined(Lynx) && defined(__powerpc__))
136 
137 /* For now this is for Xvfb only */
138 #define IMAGE_BYTE_ORDER        MSBFirst
139 #define BITMAP_BIT_ORDER        MSBFirst
140 #define GLYPHPADBYTES           4
141 #define GETLEFTBITS_ALIGNMENT   1
142 
143 #define LARGE_INSTRUCTION_CACHE
144 #define FAST_CONSTANT_OFFSET_MODE
145 #define PLENTIFUL_REGISTERS
146 #define AVOID_MEMORY_READ
147 
148 #define FAST_MEMCPY
149 
150 #endif /* LynxOS PowerPC */
151 
152 #if (defined(sun) && !(defined(i386) && defined(SVR4))) || \
153     (defined(AMOEBA) && (defined(sparc) || defined(mc68000))) || \
154     (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \
155     (defined(Lynx) && defined(__sparc__)) || \
156     ((defined(__NetBSD__) || defined(__OpenBSD__)) && \
157      (defined(__sparc__) || defined(__mc68000__)))
158 
159 #if defined(sun386) || defined(sun5)
160 # define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the SUN only */
161 # define BITMAP_BIT_ORDER	LSBFirst
162 #else
163 # define IMAGE_BYTE_ORDER	MSBFirst        /* Values for the SUN only */
164 # define BITMAP_BIT_ORDER	MSBFirst
165 #endif
166 
167 #ifdef sparc
168 # define AVOID_MEMORY_READ
169 # define LARGE_INSTRUCTION_CACHE
170 # define FAST_CONSTANT_OFFSET_MODE
171 # define SHARED_IDCACHE
172 #endif
173 
174 #ifdef mc68020
175 #define FAST_UNALIGNED_READS
176 #endif
177 
178 #define	GLYPHPADBYTES		4
179 #define GETLEFTBITS_ALIGNMENT	1
180 
181 #endif /* sun && !(i386 && SVR4) */
182 
183 
184 #if defined(AIXV3)
185 
186 #define IMAGE_BYTE_ORDER        MSBFirst        /* Values for the RISC/6000 */
187 #define BITMAP_BIT_ORDER        MSBFirst
188 #define GLYPHPADBYTES           4
189 #define GETLEFTBITS_ALIGNMENT   1
190 
191 #define LARGE_INSTRUCTION_CACHE
192 #define FAST_CONSTANT_OFFSET_MODE
193 #define PLENTIFUL_REGISTERS
194 #define AVOID_MEMORY_READ
195 
196 #define FAST_MEMCPY
197 #endif /* AIXV3 */
198 
199 #if defined(ibm032) || defined (ibm)
200 
201 #ifdef i386
202 # define IMAGE_BYTE_ORDER	LSBFirst	/* Value for PS/2 only */
203 #else
204 # define IMAGE_BYTE_ORDER	MSBFirst        /* Values for the RT only*/
205 #endif
206 #define BITMAP_BIT_ORDER	MSBFirst
207 #define	GLYPHPADBYTES		1
208 #define GETLEFTBITS_ALIGNMENT	4
209 /* ibm pcc doesn't understand pragmas. */
210 
211 #ifdef i386
212 #define BITMAP_SCANLINE_UNIT	8
213 #endif
214 
215 #endif /* ibm */
216 
217 #ifdef hpux
218 
219 #define IMAGE_BYTE_ORDER	MSBFirst        /* Values for the HP only */
220 #define BITMAP_BIT_ORDER	MSBFirst
221 #define	GLYPHPADBYTES		2		/* to match product server */
222 #define	GETLEFTBITS_ALIGNMENT	4		/* PA forces longs to 4 */
223 						/* byte boundries */
224 #define AVOID_MEMORY_READ
225 #define FAST_CONSTANT_OFFSET_MODE
226 #define LARGE_INSTRUCTION_CACHE
227 #define PLENTIFUL_REGISTERS
228 
229 #endif /* hpux */
230 
231 #if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
232 
233 #define IMAGE_BYTE_ORDER	MSBFirst        /* Values for Pegasus only */
234 #define BITMAP_BIT_ORDER	MSBFirst
235 #define GLYPHPADBYTES		4
236 #define GETLEFTBITS_ALIGNMENT	1
237 
238 #define FAST_UNALIGNED_READS
239 
240 #endif /* tektronix */
241 
242 #ifdef macII
243 
244 #define IMAGE_BYTE_ORDER      	MSBFirst        /* Values for the MacII only */
245 #define BITMAP_BIT_ORDER      	MSBFirst
246 #define GLYPHPADBYTES         	4
247 #define GETLEFTBITS_ALIGNMENT 	1
248 
249 /* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */
250 
251 #endif /* macII */
252 
253 #if (defined(mips) || defined(__mips)) && !defined(sgi)
254 
255 #if defined(MIPSEL) || defined(__MIPSEL__)
256 # define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the PMAX only */
257 # define BITMAP_BIT_ORDER	LSBFirst
258 # define GLYPHPADBYTES		4
259 # define GETLEFTBITS_ALIGNMENT	1
260 #else
261 # define IMAGE_BYTE_ORDER	MSBFirst        /* Values for the MIPS only */
262 # define BITMAP_BIT_ORDER	MSBFirst
263 # define GLYPHPADBYTES		4
264 # define GETLEFTBITS_ALIGNMENT	1
265 #endif
266 
267 #define AVOID_MEMORY_READ
268 #define FAST_CONSTANT_OFFSET_MODE
269 #define LARGE_INSTRUCTION_CACHE
270 #define PLENTIFUL_REGISTERS
271 
272 #endif /* mips */
273 
274 #if defined(__alpha) || defined(__alpha__) || defined(__alphaCross)
275 # define IMAGE_BYTE_ORDER	LSBFirst	/* Values for the Alpha only */
276 
277 # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
278 #  define BITMAP_BIT_ORDER      MSBFirst
279 # else
280 #  define BITMAP_BIT_ORDER      LSBFirst
281 # endif
282 
283 # if defined(XF86MONOVGA) || defined(XF86VGA16)
284 #  define BITMAP_SCANLINE_UNIT  8
285 # else
286    /* pad scanline to a longword */
287 #  define BITMAP_SCANLINE_UNIT			64
288 # endif
289 
290 # define BITMAP_SCANLINE_PAD 			64
291 # define LOG2_BITMAP_PAD			6
292 # define LOG2_BYTES_PER_SCANLINE_PAD		3
293 # define GLYPHPADBYTES		4
294 # define GETLEFTBITS_ALIGNMENT	1
295 # define FAST_CONSTANT_OFFSET_MODE
296 # define LARGE_INSTRUCTION_CACHE
297 # define PLENTIFUL_REGISTERS
298 
299 /* Add for handling protocol XPutImage and XGetImage; see comment below */
300 #define INTERNAL_VS_EXTERNAL_PADDING
301 #define BITMAP_SCANLINE_UNIT_PROTO		32
302 
303 #define BITMAP_SCANLINE_PAD_PROTO 	 	32
304 #define LOG2_BITMAP_PAD_PROTO			5
305 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO	2
306 
307 #endif /* alpha */
308 
309 #ifdef stellar
310 
311 #define IMAGE_BYTE_ORDER	MSBFirst       /* Values for the stellar only*/
312 #define BITMAP_BIT_ORDER	MSBFirst
313 #define	GLYPHPADBYTES		4
314 #define GETLEFTBITS_ALIGNMENT	4
315 #define IMAGE_BUFSIZE		(64*1024)
316 /*
317  * Use SysV random number generator.
318  */
319 #define random rand
320 
321 #endif /* stellar */
322 
323 #ifdef luna
324 
325 #define IMAGE_BYTE_ORDER        MSBFirst   	/* Values for the OMRON only*/
326 #define BITMAP_BIT_ORDER	MSBFirst
327 #define	GLYPHPADBYTES		4
328 #define GETLEFTBITS_ALIGNMENT	1
329 
330 #ifndef mc68000
331 #define FAST_CONSTANT_OFFSET_MODE
332 #define AVOID_MEMORY_READ
333 #define LARGE_INSTRUCTION_CACHE
334 #define PLENTIFUL_REGISTERS
335 #endif
336 
337 #endif /* luna */
338 
339 #if ((defined(__s390__) || defined(__s390x__)) && defined(linux))
340 #define IMAGE_BYTE_ORDER   MSBFirst
341 #define BITMAP_BIT_ORDER   MSBFirst
342 #endif /* (__s390__ || __s390x__) && linux */
343 
344 #if (defined(i386) && (defined(SVR4) || defined(SYSV) || (defined(sun) && defined(SVR4))) || defined(__bsdi__) || (defined(__NetBSD__) && defined(__i386__)) || (defined(__OpenBSD__) && defined(__i386__)) || defined(__FreeBSD__) || defined(MACH386) || (defined(linux) && !defined(__mc68000__)) || (defined(AMOEBA) && defined(i80386)) || defined(MINIX) || defined(__EMX__) || (defined(Lynx) && defined(__i386__)))
345 
346 #ifndef IMAGE_BYTE_ORDER
347 #define IMAGE_BYTE_ORDER	LSBFirst
348 #endif
349 
350 #ifndef BITMAP_BIT_ORDER
351 # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
352 #  define BITMAP_BIT_ORDER      MSBFirst
353 # else
354 #  define BITMAP_BIT_ORDER      LSBFirst
355 # endif
356 #endif
357 
358 #ifndef BITMAP_SCANLINE_UNIT
359 # if defined(XF86MONOVGA) || defined(XF86VGA16)
360 #  define BITMAP_SCANLINE_UNIT  8
361 # endif
362 #endif
363 
364 #ifndef GLYPHPADBYTES
365 #define GLYPHPADBYTES           4
366 #endif
367 
368 #define GETLEFTBITS_ALIGNMENT	1
369 #define AVOID_MEMORY_READ
370 #ifdef XSVGA
371 #define AVOID_GLYPHBLT
372 #define FAST_CONSTANT_OFFSET_MODE
373 #define FAST_MEMCPY
374 #define NO_ONE_RECT
375 #endif
376 
377 /* Values for AMD Opteron and Intel 64 bit extensions. Copied from Alpha.
378  */
379 #ifdef __x86_64__
380 #  define BITMAP_SCANLINE_UNIT			64
381 # define BITMAP_SCANLINE_PAD 			64
382 # define LOG2_BITMAP_PAD			6
383 # define LOG2_BYTES_PER_SCANLINE_PAD		3
384 
385 /* Add for handling protocol XPutImage and XGetImage; see comment in
386  * Alpha section.
387  */
388 #define INTERNAL_VS_EXTERNAL_PADDING
389 #define BITMAP_SCANLINE_UNIT_PROTO		32
390 
391 #define BITMAP_SCANLINE_PAD_PROTO 	 	32
392 #define LOG2_BITMAP_PAD_PROTO			5
393 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO	2
394 #endif
395 
396 #endif /* SVR4 / BSD / i386 */
397 
398 #if defined (linux) && defined (__mc68000__)
399 
400 #define IMAGE_BYTE_ORDER       MSBFirst
401 #define BITMAP_BIT_ORDER       MSBFirst
402 #define FAST_UNALIGNED_READS
403 #define GLYPHPADBYTES          4
404 #define GETLEFTBITS_ALIGNMENT  1
405 
406 #endif /* linux/m68k */
407 
408 #if defined (linux) && defined(__powerpc__)
409 
410 #define IMAGE_BYTE_ORDER       MSBFirst
411 #define BITMAP_BIT_ORDER       MSBFirst
412 #define GLYPHPADBYTES          4
413 #define GETLEFTBITS_ALIGNMENT  1
414 
415 #define LARGE_INSTRUCTION_CACHE
416 #define FAST_CONSTANT_OFFSET_MODE
417 #define PLENTIFUL_REGISTERS
418 #define AVOID_MEMORY_READ
419 
420 #define FAST_MEMCPY
421 
422 #endif /* Linux/PPC */
423 
424 #if defined(__MACH__) && defined(__POWERPC__)
425 
426 #define IMAGE_BYTE_ORDER       MSBFirst
427 #define BITMAP_BIT_ORDER       MSBFirst
428 #define GLYPHPADBYTES          4
429 #define GETLEFTBITS_ALIGNMENT  1
430 
431 #define LARGE_INSTRUCTION_CACHE
432 #define FAST_CONSTANT_OFFSET_MODE
433 #define PLENTIFUL_REGISTERS
434 #define AVOID_MEMORY_READ
435 
436 #define FAST_MEMCPY
437 
438 #endif /* MACH/PPC */
439 
440 #ifdef sgi
441 
442 #define IMAGE_BYTE_ORDER	MSBFirst
443 #define BITMAP_BIT_ORDER	MSBFirst
444 
445 #if (_MIPS_SZLONG == 64)
446 
447 # define GLYPHPADBYTES		4
448 # define GETLEFTBITS_ALIGNMENT	1
449 
450 /* pad scanline to a longword */
451 #define BITMAP_SCANLINE_UNIT			64
452 
453 #define BITMAP_SCANLINE_PAD 			64
454 #define LOG2_BITMAP_PAD				6
455 #define LOG2_BYTES_PER_SCANLINE_PAD		3
456 
457 /* Add for handling protocol XPutImage and XGetImage; see comment below */
458 #define INTERNAL_VS_EXTERNAL_PADDING
459 #define BITMAP_SCANLINE_UNIT_PROTO		32
460 
461 #define BITMAP_SCANLINE_PAD_PROTO 	 	32
462 #define LOG2_BITMAP_PAD_PROTO			5
463 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO	2
464 
465 #else
466 
467 #define GLYPHPADBYTES		2
468 #define GETLEFTBITS_ALIGNMENT	4
469 
470 #endif
471 
472 #define AVOID_MEMORY_READ
473 #define FAST_CONSTANT_OFFSET_MODE
474 #define LARGE_INSTRUCTION_CACHE
475 #define PLENTIFUL_REGISTERS
476 
477 #endif
478 
479 /* size of buffer to use with GetImage, measured in bytes. There's obviously
480  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
481  * you) used and the number of times the ddx routine has to be called.
482  *
483  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get
484  * 8192/4 words per buffer
485  * (1024/32) = 32 words per scanline
486  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
487  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
488  */
489 #ifndef IMAGE_BUFSIZE
490 #define IMAGE_BUFSIZE		8192
491 #endif
492 
493 /* pad scanline to a longword */
494 #ifndef BITMAP_SCANLINE_UNIT
495 #define BITMAP_SCANLINE_UNIT	32
496 #endif
497 
498 #ifndef BITMAP_SCANLINE_PAD
499 #define BITMAP_SCANLINE_PAD  32
500 #define LOG2_BITMAP_PAD		5
501 #define LOG2_BYTES_PER_SCANLINE_PAD	2
502 #endif
503 
504 /*
505  *   This returns the number of padding units, for depth d and width w.
506  * For bitmaps this can be calculated with the macros above.
507  * Other depths require either grovelling over the formats field of the
508  * screenInfo or hardwired constants.
509  */
510 
511 typedef struct _PaddingInfo {
512 	int     padRoundUp;	/* pixels per pad unit - 1 */
513 	int	padPixelsLog2;	/* log 2 (pixels per pad unit) */
514 	int     padBytesLog2;	/* log 2 (bytes per pad unit) */
515 	int	notPower2;	/* bitsPerPixel not a power of 2 */
516 	int	bytesPerPixel;	/* only set when notPower2 is TRUE */
517 } PaddingInfo;
518 extern PaddingInfo PixmapWidthPaddingInfo[];
519 
520 #define PixmapWidthInPadUnits(w, d) \
521     (PixmapWidthPaddingInfo[d].notPower2 ? \
522     (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel +  \
523 	         PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
524 	PixmapWidthPaddingInfo[d].padBytesLog2) : \
525     ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
526 	PixmapWidthPaddingInfo[d].padPixelsLog2))
527 
528 /*
529  *	Return the number of bytes to which a scanline of the given
530  * depth and width will be padded.
531  */
532 #define PixmapBytePad(w, d) \
533     (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
534 
535 #define BitmapBytePad(w) \
536     (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
537 
538 #ifdef INTERNAL_VS_EXTERNAL_PADDING
539 
540 /*  This is defined if the server's internal padding is different from the padding
541  *  advertised in the protocol.  The protocol does not allow for padding to
542  *  64 bits, for example, so if the server wants to use 64 bit padding internally,
543  *  it has to advertise 32 bit padding and do padding fixups whenever images
544  *  cross the wire.  (See ProcGetImage and ProcPutImage.)
545  *
546  *  The macros and constants that end in Proto or PROTO refer to the advertised
547  *  padding, and the ones without Proto are for internal padding.
548  */
549 
550 extern PaddingInfo PixmapWidthPaddingInfoProto[];
551 
552 #define PixmapWidthInPadUnitsProto(w, d) \
553     (PixmapWidthPaddingInfoProto[d].notPower2 ? \
554     (((int)(w) * PixmapWidthPaddingInfoProto[d].bytesPerPixel +  \
555 	         PixmapWidthPaddingInfoProto[d].bytesPerPixel) >> \
556 	PixmapWidthPaddingInfoProto[d].padBytesLog2) : \
557     ((int)((w) + PixmapWidthPaddingInfoProto[d].padRoundUp) >> \
558 	PixmapWidthPaddingInfoProto[d].padPixelsLog2))
559 
560 #define PixmapBytePadProto(w, d) \
561     (PixmapWidthInPadUnitsProto(w, d) << \
562     PixmapWidthPaddingInfoProto[d].padBytesLog2)
563 
564 #define BitmapBytePadProto(w) \
565     ((((w) + BITMAP_SCANLINE_PAD_PROTO - 1) >> LOG2_BITMAP_PAD_PROTO) \
566     << LOG2_BYTES_PER_SCANLINE_PAD_PROTO)
567 
568 #else /* protocol and internal padding is the same */
569 
570 #define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d)
571 #define PixmapBytePadProto(w, d) PixmapBytePad(w, d)
572 #define BitmapBytePadProto(w) BitmapBytePad(w)
573 
574 #endif /* protocol vs. internal padding  */
575 
576 #endif /* SERVERMD_H */
577