1
/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.56tsi Exp $ */
2
/***********************************************************
4
Copyright 1987, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
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
OPEN GROUP 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.
22
Except as contained in this notice, the name of The Open Group 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 Open Group.
27
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
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.
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
47
******************************************************************/
48
/* $Xorg: servermd.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
49
/* $XdotOrg: xserver/xorg/include/servermd.h,v 1.9 2005/11/15 00:29:23 ajax Exp $ */
55
* Machine dependent values:
56
* GLYPHPADBYTES should be chosen with consideration for the space-time
57
* trade-off. Padding to 0 bytes means that there is no wasted space
58
* in the font bitmaps (both on disk and in memory), but that access of
59
* the bitmaps will cause odd-address memory references. Padding to
60
* 2 bytes would ensure even address memory references and would
61
* be suitable for a 68010-class machine, but at the expense of wasted
62
* space in the font bitmaps. Padding to 4 bytes would be good
63
* for real 32 bit machines, etc. Be sure that you tell the font
64
* compiler what kind of padding you want because its defines are
65
* kept separate from this. See server/include/font.h for how
66
* GLYPHPADBYTES is used.
68
* Along with this, you should choose an appropriate value for
69
* GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h. This
70
* constant choses what kind of memory references are guarenteed during
71
* font access; either 1, 2 or 4, for byte, word or longword access,
72
* respectively. For instance, if you have decided to to have
73
* GLYPHPADBYTES == 4, then it is pointless for you to have a
74
* GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
75
* guarenteed you that your fonts are longword aligned. On the other
76
* hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
77
* also decide that the computing involved in aligning the pointer is more
78
* costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
80
* Next, choose the tuning parameters which are appropriate for your
81
* hardware; these modify the behaviour of the raw frame buffer code
82
* in ddx/mfb and ddx/cfb. Defining these incorrectly will not cause
83
* the server to run incorrectly, but defining these correctly will
84
* cause some noticeable speed improvements:
86
* AVOID_MEMORY_READ - (8-bit cfb only)
87
* When stippling pixels on the screen (polytext and pushpixels),
88
* don't read long words from the display and mask in the
89
* appropriate values. Rather, perform multiple byte/short/long
90
* writes as appropriate. This option uses many more instructions
91
* but runs much faster when the destination is much slower than
92
* the CPU and at least 1 level of write buffer is availible (2
93
* is much better). Defined currently for SPARC and MIPS.
95
* FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
96
* This define is used on machines which have no auto-increment
97
* addressing mode, but do have an effectively free constant-offset
98
* addressing mode. Currently defined for MIPS and SPARC, even though
99
* I remember the cg6 as performing better without it (cg3 definitely
100
* performs better with it).
102
* LARGE_INSTRUCTION_CACHE -
103
* This define increases the number of times some loops are
104
* unrolled. On 68020 machines (with 256 bytes of i-cache),
105
* this define will slow execution down as instructions miss
106
* the cache frequently. On machines with real i-caches, this
107
* reduces loop overhead, causing a slight performance improvement.
108
* Currently defined for MIPS and SPARC
110
* FAST_UNALIGNED_READS -
111
* For machines with more memory bandwidth than CPU, this
112
* define uses unaligned reads for 8-bit BitBLT instead of doing
113
* aligned reads and combining the results with shifts and
114
* logical-ors. Currently defined for 68020 and vax.
115
* PLENTIFUL_REGISTERS -
116
* For machines with > 20 registers. Currently used for
117
* unrolling the text painting code a bit more. Currently
120
* For non-Harvard RISC machines, those which share the same
121
* CPU memory bus for instructions and data. This unrolls some
122
* solid fill loops which are otherwise best left rolled up.
123
* Currently defined for SPARC.
128
#define IMAGE_BYTE_ORDER LSBFirst /* Values for the VAX only */
129
#define BITMAP_BIT_ORDER LSBFirst
130
#define GLYPHPADBYTES 1
131
#define GETLEFTBITS_ALIGNMENT 4
132
#define FAST_UNALIGNED_READS
138
#define IMAGE_BYTE_ORDER LSBFirst
140
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
141
# define BITMAP_BIT_ORDER MSBFirst
143
# define BITMAP_BIT_ORDER LSBFirst
146
# if defined(XF86MONOVGA) || defined(XF86VGA16)
147
# define BITMAP_SCANLINE_UNIT 8
150
#define GLYPHPADBYTES 4
151
#define GETLEFTBITS_ALIGNMENT 1
152
#define LARGE_INSTRUCTION_CACHE
153
#define AVOID_MEMORY_READ
155
#endif /* __arm32__ */
157
#if defined (hpux) || defined __hppa__
159
#define IMAGE_BYTE_ORDER MSBFirst
160
#define BITMAP_BIT_ORDER MSBFirst
161
#define GLYPHPADBYTES 4 /* to make fb work */
162
#define GETLEFTBITS_ALIGNMENT 1 /* PA forces longs to 4 */
164
#define AVOID_MEMORY_READ
165
#define FAST_CONSTANT_OFFSET_MODE
166
#define LARGE_INSTRUCTION_CACHE
167
#define PLENTIFUL_REGISTERS
169
#endif /* hpux || __hppa__ */
171
#if defined(__powerpc__) || defined(__ppc__)
173
#define IMAGE_BYTE_ORDER MSBFirst
174
#define BITMAP_BIT_ORDER MSBFirst
175
#define GLYPHPADBYTES 4
176
#define GETLEFTBITS_ALIGNMENT 1
178
/* XXX Should this be for Lynx only? */
180
#define BITMAP_SCANLINE_UNIT 8
183
#define LARGE_INSTRUCTION_CACHE
184
#define FAST_CONSTANT_OFFSET_MODE
185
#define PLENTIFUL_REGISTERS
186
#define AVOID_MEMORY_READ
194
#if defined(__BIG_ENDIAN__)
195
# define IMAGE_BYTE_ORDER MSBFirst
196
# define BITMAP_BIT_ORDER MSBFirst
197
# define GLYPHPADBYTES 4
198
# define GETLEFTBITS_ALIGNMENT 1
200
# define IMAGE_BYTE_ORDER LSBFirst
201
# define BITMAP_BIT_ORDER LSBFirst
202
# define GLYPHPADBYTES 4
203
# define GETLEFTBITS_ALIGNMENT 1
206
#define AVOID_MEMORY_READ
207
#define FAST_CONSTANT_OFFSET_MODE
208
#define LARGE_INSTRUCTION_CACHE
209
#define PLENTIFUL_REGISTERS
214
#if (defined(sun) && (defined(__sparc) || defined(sparc))) || \
215
(defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \
216
defined(__sparc__) || defined(__mc68000__)
218
#if defined(__sparc) || defined(__sparc__)
224
#if defined(sun386) || defined(sun5)
225
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */
226
# define BITMAP_BIT_ORDER LSBFirst
228
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */
229
# define BITMAP_BIT_ORDER MSBFirst
233
# define AVOID_MEMORY_READ
234
# define LARGE_INSTRUCTION_CACHE
235
# define FAST_CONSTANT_OFFSET_MODE
236
# define SHARED_IDCACHE
240
#define FAST_UNALIGNED_READS
243
#define GLYPHPADBYTES 4
244
#define GETLEFTBITS_ALIGNMENT 1
246
#endif /* sun && !(i386 && SVR4) */
251
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the RISC/6000 */
252
#define BITMAP_BIT_ORDER MSBFirst
253
#define GLYPHPADBYTES 4
254
#define GETLEFTBITS_ALIGNMENT 1
256
#define LARGE_INSTRUCTION_CACHE
257
#define FAST_CONSTANT_OFFSET_MODE
258
#define PLENTIFUL_REGISTERS
259
#define AVOID_MEMORY_READ
264
#if defined(ibm032) || defined (ibm)
267
# define IMAGE_BYTE_ORDER LSBFirst /* Value for PS/2 only */
269
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the RT only*/
271
#define BITMAP_BIT_ORDER MSBFirst
272
#define GLYPHPADBYTES 1
273
#define GETLEFTBITS_ALIGNMENT 4
274
/* ibm pcc doesn't understand pragmas. */
277
#define BITMAP_SCANLINE_UNIT 8
282
#if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
284
#define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */
285
#define BITMAP_BIT_ORDER MSBFirst
286
#define GLYPHPADBYTES 4
287
#define GETLEFTBITS_ALIGNMENT 1
289
#define FAST_UNALIGNED_READS
291
#endif /* tektronix */
295
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the MacII only */
296
#define BITMAP_BIT_ORDER MSBFirst
297
#define GLYPHPADBYTES 4
298
#define GETLEFTBITS_ALIGNMENT 1
300
/* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */
304
#if (defined(mips) || defined(__mips)) && !defined(sgi)
306
#if defined(MIPSEL) || defined(__MIPSEL__)
307
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */
308
# define BITMAP_BIT_ORDER LSBFirst
309
# define GLYPHPADBYTES 4
310
# define GETLEFTBITS_ALIGNMENT 1
312
# define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */
313
# define BITMAP_BIT_ORDER MSBFirst
314
# define GLYPHPADBYTES 4
315
# define GETLEFTBITS_ALIGNMENT 1
318
#define AVOID_MEMORY_READ
319
#define FAST_CONSTANT_OFFSET_MODE
320
#define LARGE_INSTRUCTION_CACHE
321
#define PLENTIFUL_REGISTERS
325
#if defined(__alpha) || defined(__alpha__) || defined(__alphaCross)
326
# define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */
328
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
329
# define BITMAP_BIT_ORDER MSBFirst
331
# define BITMAP_BIT_ORDER LSBFirst
334
# if defined(XF86MONOVGA) || defined(XF86VGA16)
335
# define BITMAP_SCANLINE_UNIT 8
338
# define GLYPHPADBYTES 4
339
# define GETLEFTBITS_ALIGNMENT 1
340
# define FAST_CONSTANT_OFFSET_MODE
341
# define LARGE_INSTRUCTION_CACHE
342
# define PLENTIFUL_REGISTERS
346
#if defined (linux) && defined (__s390__)
348
#define IMAGE_BYTE_ORDER MSBFirst
349
#define BITMAP_BIT_ORDER MSBFirst
350
#define GLYPHPADBYTES 4
351
#define GETLEFTBITS_ALIGNMENT 1
353
#define BITMAP_SCANLINE_UNIT 8
354
#define LARGE_INSTRUCTION_CACHE
355
#define FAST_CONSTANT_OFFSET_MODE
356
#define FAST_UNALIGNED_READ
360
#endif /* linux/s390 */
362
#if defined (linux) && defined (__s390x__)
364
#define IMAGE_BYTE_ORDER MSBFirst
365
#define BITMAP_BIT_ORDER MSBFirst
366
#define GLYPHPADBYTES 4
367
#define GETLEFTBITS_ALIGNMENT 1
369
#define BITMAP_SCANLINE_UNIT 8
370
#define LARGE_INSTRUCTION_CACHE
371
#define FAST_CONSTANT_OFFSET_MODE
372
#define FAST_UNALIGNED_READ
375
#endif /* linux/s390x */
378
#if defined(__ia64__) || defined(ia64)
379
# define IMAGE_BYTE_ORDER LSBFirst
381
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
382
# define BITMAP_BIT_ORDER MSBFirst
384
# define BITMAP_BIT_ORDER LSBFirst
387
# if defined(XF86MONOVGA) || defined(XF86VGA16)
388
# define BITMAP_SCANLINE_UNIT 8
391
# define GLYPHPADBYTES 4
392
# define GETLEFTBITS_ALIGNMENT 1
393
# define FAST_CONSTANT_OFFSET_MODE
394
# define LARGE_INSTRUCTION_CACHE
395
# define PLENTIFUL_REGISTERS
399
#if defined(__amd64__) || defined(amd64) || defined(__amd64)
400
# define IMAGE_BYTE_ORDER LSBFirst
402
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
403
# define BITMAP_BIT_ORDER MSBFirst
405
# define BITMAP_BIT_ORDER LSBFirst
408
# if defined(XF86MONOVGA) || defined(XF86VGA16)
409
# define BITMAP_SCANLINE_UNIT 8
412
# define GLYPHPADBYTES 4
413
# define GETLEFTBITS_ALIGNMENT 1
414
# define LARGE_INSTRUCTION_CACHE
415
# define FAST_CONSTANT_OFFSET_MODE
417
# define FAST_UNALIGNED_READS
422
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/
423
#define BITMAP_BIT_ORDER MSBFirst
424
#define GLYPHPADBYTES 4
425
#define GETLEFTBITS_ALIGNMENT 4
426
#define IMAGE_BUFSIZE (64*1024)
428
* Use SysV random number generator.
436
#define IMAGE_BYTE_ORDER MSBFirst /* Values for the OMRON only*/
437
#define BITMAP_BIT_ORDER MSBFirst
438
#define GLYPHPADBYTES 4
439
#define GETLEFTBITS_ALIGNMENT 1
442
#define FAST_CONSTANT_OFFSET_MODE
443
#define AVOID_MEMORY_READ
444
#define LARGE_INSTRUCTION_CACHE
445
#define PLENTIFUL_REGISTERS
450
#if (defined(SVR4) && defined(i386)) || \
451
defined(__alpha__) || defined(__alpha) || \
452
defined(__i386__) || defined(__i386) || \
453
defined(__UNIXOS2__) || \
454
defined(__OS2ELF__) || \
455
defined(__QNX__) || \
456
defined(__s390x__) || defined(__s390__)
458
#ifndef IMAGE_BYTE_ORDER
459
#define IMAGE_BYTE_ORDER LSBFirst
462
#ifndef BITMAP_BIT_ORDER
463
# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
464
# define BITMAP_BIT_ORDER MSBFirst
466
# define BITMAP_BIT_ORDER LSBFirst
470
#ifndef BITMAP_SCANLINE_UNIT
471
# if defined(XF86MONOVGA) || defined(XF86VGA16)
472
# define BITMAP_SCANLINE_UNIT 8
476
#ifndef GLYPHPADBYTES
477
#define GLYPHPADBYTES 4
480
#define GETLEFTBITS_ALIGNMENT 1
481
#define AVOID_MEMORY_READ
483
#define AVOID_GLYPHBLT
484
#define FAST_CONSTANT_OFFSET_MODE
489
#endif /* SVR4 / BSD / i386 */
491
#if defined (linux) && defined (__mc68000__)
493
#define IMAGE_BYTE_ORDER MSBFirst
494
#define BITMAP_BIT_ORDER MSBFirst
495
#define FAST_UNALIGNED_READS
496
#define GLYPHPADBYTES 4
497
#define GETLEFTBITS_ALIGNMENT 1
499
#endif /* linux/m68k */
503
#define IMAGE_BYTE_ORDER MSBFirst
504
#define BITMAP_BIT_ORDER MSBFirst
505
#define GLYPHPADBYTES 4
506
#define GETLEFTBITS_ALIGNMENT 1
507
#define AVOID_MEMORY_READ
508
#define FAST_CONSTANT_OFFSET_MODE
509
#define LARGE_INSTRUCTION_CACHE
510
#define PLENTIFUL_REGISTERS
514
/* linux on the Compaq Itsy */
515
#if defined(linux) && defined(__arm__)
516
#define IMAGE_BYTE_ORDER LSBFirst
517
#define BITMAP_BIT_ORDER LSBFirst
518
#define GLYPHPADBYTES 4
519
#define GETLEFTBITS_ALIGNMENT 1
522
/* size of buffer to use with GetImage, measured in bytes. There's obviously
523
* a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
524
* you) used and the number of times the ddx routine has to be called.
526
#ifndef IMAGE_BUFSIZE
527
#define IMAGE_BUFSIZE (64*1024)
530
/* pad scanline to a longword */
531
#ifndef BITMAP_SCANLINE_UNIT
532
#define BITMAP_SCANLINE_UNIT 32
535
#ifndef BITMAP_SCANLINE_PAD
536
#define BITMAP_SCANLINE_PAD 32
537
#define LOG2_BITMAP_PAD 5
538
#define LOG2_BYTES_PER_SCANLINE_PAD 2
542
* This returns the number of padding units, for depth d and width w.
543
* For bitmaps this can be calculated with the macros above.
544
* Other depths require either grovelling over the formats field of the
545
* screenInfo or hardwired constants.
548
typedef struct _PaddingInfo {
549
int padRoundUp; /* pixels per pad unit - 1 */
550
int padPixelsLog2; /* log 2 (pixels per pad unit) */
551
int padBytesLog2; /* log 2 (bytes per pad unit) */
552
int notPower2; /* bitsPerPixel not a power of 2 */
553
int bytesPerPixel; /* only set when notPower2 is TRUE */
554
int bitsPerPixel; /* bits per pixel */
556
extern PaddingInfo PixmapWidthPaddingInfo[];
558
/* The only portable way to get the bpp from the depth is to look it up */
559
#define BitsPerPixel(d) (PixmapWidthPaddingInfo[d].bitsPerPixel)
561
#define PixmapWidthInPadUnits(w, d) \
562
(PixmapWidthPaddingInfo[d].notPower2 ? \
563
(((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \
564
PixmapWidthPaddingInfo[d].bytesPerPixel) >> \
565
PixmapWidthPaddingInfo[d].padBytesLog2) : \
566
((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
567
PixmapWidthPaddingInfo[d].padPixelsLog2))
570
* Return the number of bytes to which a scanline of the given
571
* depth and width will be padded.
573
#define PixmapBytePad(w, d) \
574
(PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
576
#define BitmapBytePad(w) \
577
(((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD)
579
#define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d)
580
#define PixmapBytePadProto(w, d) PixmapBytePad(w, d)
581
#define BitmapBytePadProto(w) BitmapBytePad(w)
583
#endif /* SERVERMD_H */