1 dawes 1.1.2.45 /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.1.2.44 1998/06/21 15:38:17 dawes Exp $ */
|
2 dawes 1.1.2.1
3 /*
4 * Copyright (c) 1997 by The XFree86 Project, Inc.
5 */
6
7 /*
8 * This file contains definitions of the public XFree86 data structures/types.
9 * Any data structures that video drivers need to access should go here.
10 */
11
12 #ifndef _XF86STR_H
13 #define _XF86STR_H
14
15 #include "misc.h"
16 #include "input.h"
17 #include "scrnintstr.h"
|
18 dawes 1.1.2.10 #include "xf86Module.h"
|
19 dawes 1.1.2.45 #include "xf86fbman.h"
|
20 dawes 1.1.2.1
21
22 /* Video mode flags */
23
24 typedef enum {
25 V_PHSYNC = 0x0001,
26 V_NHSYNC = 0x0002,
27 V_PVSYNC = 0x0004,
28 V_NVSYNC = 0x0008,
29 V_INTERLACE = 0x0010,
30 V_DBLSCAN = 0x0020,
31 V_CSYNC = 0x0040,
32 V_PCSYNC = 0x0080,
33 V_NCSYNC = 0x0100,
34 V_HSKEW = 0x0200, /* hskew provided */
35 V_PIXMUX = 0x1000,
36 V_DBLCLK = 0x2000,
37 V_CLKDIV2 = 0x4000
38 } ModeFlags;
39
|
40 dawes 1.1.2.30 typedef enum {
41 INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
42 } CrtcAdjustFlags;
43
44
|
45 dawes 1.1.2.13 /* These are possible return values for xf86CheckMode() and ValidMode() */
46 typedef enum {
47 MODE_OK = 0, /* Mode OK */
48 MODE_HSYNC, /* hsync out of range */
49 MODE_VSYNC, /* vsync out of range */
|
50 dawes 1.1.2.16 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
51 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
|
52 dawes 1.1.2.13 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
|
53 dawes 1.1.2.14 MODE_NOMODE, /* no mode with a maching name */
|
54 dawes 1.1.2.13 MODE_NO_INTERLACE, /* interlaced mode not supported */
55 MODE_NO_DBLESCAN, /* doublescan mode not supported */
56 MODE_MEM, /* insufficient video memory */
|
57 dawes 1.1.2.16 MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
58 MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
59 MODE_MEM_VIRT, /* insufficient video memory given virtual size */
|
60 dawes 1.1.2.13 MODE_NOCLOCK, /* no fixed clock available */
61 MODE_CLOCK_HIGH, /* clock required is too high */
62 MODE_CLOCK_LOW, /* clock required is too low */
|
63 dawes 1.1.2.14 MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
64 MODE_BAD_HVALUE, /* horizontal timing was out of range */
65 MODE_BAD_VVALUE, /* vertical timing was out of range */
66 MODE_BAD, /* unspecified reason */
67 MODE_ERROR = -1 /* error condition */
|
68 dawes 1.1.2.13 } ModeStatus;
69
|
70 dawes 1.1.2.1 /* Video mode */
71
72 typedef struct _DisplayModeRec {
73 struct _DisplayModeRec * prev;
74 struct _DisplayModeRec * next;
75 char * name; /* identifier for the mode */
|
76 dawes 1.1.2.13 ModeStatus status;
|
77 dawes 1.1.2.1
78 /* These are the values that the user sees/provides */
79 int Clock; /* pixel clock freq */
80 int HDisplay; /* horizontal timing */
81 int HSyncStart;
82 int HSyncEnd;
83 int HTotal;
84 int HSkew;
85 int VDisplay; /* vertical timing */
86 int VSyncStart;
87 int VSyncEnd;
88 int VTotal;
|
89 dawes 1.1.2.14 int Flags;
|
90 dawes 1.1.2.1
91 /* These are the values the hardware uses */
92 int ClockIndex;
93 int SynthClock; /* Actual clock freq to
94 * be programmed */
95 int CrtcHDisplay;
96 int CrtcHSyncStart;
97 int CrtcHSyncEnd;
98 int CrtcHTotal;
99 int CrtcHSkew;
100 int CrtcVDisplay;
101 int CrtcVSyncStart;
102 int CrtcVSyncEnd;
103 int CrtcVTotal;
104 Bool CrtcHAdjusted;
105 Bool CrtcVAdjusted;
106 int PrivSize;
107 INT32 * Private;
108 } DisplayModeRec, *DisplayModePtr;
109
110 /* The monitor description */
111 dawes 1.1.2.1
112 #define MAX_HSYNC 8
113 #define MAX_VREFRESH 8
114
115 typedef struct { float hi, lo; } range;
116
|
117 dawes 1.1.2.31 typedef struct { CARD32 red, green, blue; } rgb;
|
118 dawes 1.1.2.17
|
119 dawes 1.1.2.32 typedef struct { float red, green, blue; } Gamma;
120
|
121 dawes 1.1.2.1 typedef struct {
122 char * id;
123 char * vendor;
124 char * model;
|
125 dawes 1.1.2.22 int dpmsSupport;
|
126 dawes 1.1.2.16 int nHsync;
|
127 dawes 1.1.2.1 range hsync[MAX_HSYNC];
|
128 dawes 1.1.2.16 int nVrefresh;
|
129 dawes 1.1.2.1 range vrefresh[MAX_VREFRESH];
130 DisplayModePtr Modes; /* Start of the monitor's mode list */
131 DisplayModePtr Last; /* End of the monitor's mode list */
|
132 dawes 1.1.2.32 Gamma gamma;
|
133 dawes 1.1.2.36 pointer options;
|
134 dawes 1.1.2.1 } MonRec, *MonPtr;
135
136 /* the list of clock ranges */
137 typedef struct x_ClockRange {
138 struct x_ClockRange *next;
139 int minClock;
140 int maxClock;
|
141 dawes 1.1.2.13 int clockIndex; /* -1 for programmable clocks */
|
142 dawes 1.1.2.1 Bool interlaceAllowed;
143 Bool doubleScanAllowed;
144 } ClockRange, *ClockRangePtr;
145
|
146 dawes 1.1.2.3 /* Public bus-related types */
|
147 dawes 1.1.2.2
148 /* A crude attempt to characterise ISA/VLB types */
149 typedef enum {
150 ISA_COLOR,
151 ISA_MONO,
152 ISA_OTHER
|
153 dawes 1.1.2.3 } IsaBusType;
|
154 dawes 1.1.2.2
|
155 dawes 1.1.2.40 /* Different PCI video cards */
|
156 dawes 1.1.2.2 typedef enum {
157 PCI_ONLY,
158 PCI_VGA,
159 PCI_SHARED_VGA
|
160 dawes 1.1.2.3 } PciBusType;
|
161 dawes 1.1.2.2
162
|
163 dawes 1.1.2.1 #define MAXCLOCKS 128
|
164 dawes 1.1.2.26 typedef enum {
165 DAC_BPP8 = 0,
166 DAC_BPP16,
167 DAC_BPP24,
168 DAC_BPP32,
169 MAXDACSPEEDS
170 } DacSpeedIndex;
171
|
172 dawes 1.1.2.9 typedef struct {
|
173 dawes 1.1.2.36 char * identifier;
174 char * vendor;
175 char * board;
176 char * chipset;
177 char * ramdac;
178 char * driver;
179 struct _confscreenrec * myScreenSection;
180 Bool claimed;
181 int dacSpeeds[MAXDACSPEEDS];
182 int numclocks;
183 int clock[MAXCLOCKS];
184 char * clockchip;
185 char * busID;
186 int videoRam;
|
187 dawes 1.1.2.45 int textClockFreq;
|
188 dawes 1.1.2.36 int BiosBase; /* Base address of video BIOS */
189 unsigned long MemBase; /* Frame buffer base address */
190 unsigned long IOBase;
191 int chipID;
192 int chipRev;
193 int MemClk; /* General flag used for
194 memory clocking */
195 pointer options;
|
196 dawes 1.1.2.9 } GDevRec, *GDevPtr;
197
198 typedef struct {
199 int vendor;
200 int chipType;
201 int chipRev;
202 int bus;
203 int device;
204 int func;
|
205 dawes 1.1.2.45 int class;
206 int subclass;
207 int interface;
|
208 dawes 1.1.2.9 unsigned long memBase[6];
209 unsigned long ioBase[6];
210 unsigned long biosBase;
211 pointer thisCard;
212 } pciVideoRec, *pciVideoPtr;
|
213 hohndel 1.1.2.18
214 typedef struct {
|
215 dawes 1.1.2.36 int frameX0;
216 int frameY0;
217 int virtualX;
218 int virtualY;
219 int depth;
220 int bpp;
221 rgb weight;
222 int defaultVisual;
223 char ** modes;
224 pointer options;
|
225 hohndel 1.1.2.18 } DispRec, *DispPtr;
226
|
227 hohndel 1.1.2.21 typedef struct _confscreenrec {
|
228 dawes 1.1.2.36 char * id;
|
229 dawes 1.1.2.42 int defaultdepth;
230 int defaultbpp;
231 int defaultfbbpp;
|
232 dawes 1.1.2.36 MonPtr monitor;
233 GDevPtr device;
234 int numdisplays;
235 DispPtr displays;
236 pointer options;
|
237 hohndel 1.1.2.18 } confScreenRec, *confScreenPtr;
238
|
239 hohndel 1.1.2.21 typedef struct _screenlayoutrec {
|
240 dawes 1.1.2.36 confScreenPtr screen;
241 confScreenPtr top;
242 confScreenPtr bottom;
243 confScreenPtr left;
244 confScreenPtr right;
|
245 hohndel 1.1.2.18 } screenLayoutRec, *screenLayoutPtr;
|
246 dawes 1.1.2.9
|
247 dawes 1.1.2.1 /* These values should be adjusted when new fields are added to ScrnInfoRec */
248 #define NUM_RESERVED_INTS 16
249 #define NUM_RESERVED_POINTERS 16
250 #define NUM_RESERVED_FUNCS 16
251
252 typedef pointer (*funcPointer)(void);
253
|
254 dawes 1.1.2.31 /* Flags for driver messages */
255 typedef enum {
256 X_PROBED, /* Value was probed */
257 X_CONFIG, /* Value was given in the config file */
258 X_DEFAULT, /* Value is a default */
259 X_CMDLINE, /* Value was given on the command line */
260 X_NOTICE, /* Notice */
261 X_ERROR, /* Error message */
262 X_WARNING, /* Warning message */
263 X_INFO, /* Informational message */
264 X_NONE /* No prefix */
265 } MessageType;
266
|
267 dawes 1.1.2.1 /*
268 * ScrnInfoRec
269 *
270 * There is one of these for each screen, and it holds all the screen-specific
271 * information.
272 *
273 * Note: the size and layout must be kept the same across versions. New
274 * fields are to be added in place of the "reserved*" fields. No fields
275 * are to be dependent on complie-time defines.
276 */
277
278 typedef struct _ScrnInfoRec {
279 int driverVersion;
|
280 hohndel 1.1.2.21 char * driverName; /* canonical name used in */
281 /* the config file */
|
282 dawes 1.1.2.1 ScreenPtr pScreen; /* Pointer to the ScreenRec */
283 int scrnIndex; /* Number of this screen */
284 Bool configured; /* Is this screen valid */
|
285 dawes 1.1.2.32 int origIndex; /* initial number assigned to
|
286 dawes 1.1.2.1 * this screen before
287 * finalising the number of
|
288 dawes 1.1.2.13 * available screens */
|
289 dawes 1.1.2.35
290 /* Display-wide screenInfo values needed by this screen */
291 int imageByteOrder;
292 int bitmapScanlineUnit;
293 int bitmapScanlinePad;
294 int bitmapBitOrder;
295 int numFormats;
296 PixmapFormatRec formats[MAXFORMATS];
|
297 dawes 1.1.2.42 PixmapFormatRec fbFormat;
|
298 dawes 1.1.2.35
|
299 dawes 1.1.2.42 int bitsPerPixel; /* fb bpp */
300 int pixmapBPP; /* bpp of default visual */
|
301 dawes 1.1.2.1 int depth; /* depth of default visual */
|
302 dawes 1.1.2.42 MessageType depthFrom; /* set from config? */
303 MessageType bitsPerPixelFrom; /* set from config? */
304 MessageType pixmapBPPFrom; /* set from config? */
|
305 dawes 1.1.2.17 rgb weight; /* r/g/b weights */
306 rgb mask; /* rgb masks */
|
307 dawes 1.1.2.31 rgb offset; /* rgb offsets */
|
308 dawes 1.1.2.13 int rgbBits; /* Number of bits in r/g/b */
|
309 dawes 1.1.2.32 Gamma gamma; /* Gamma correction */
|
310 dawes 1.1.2.1 int defaultVisual; /* default visual class */
|
311 dawes 1.1.2.14 int maxHValue; /* max horizontal timing */
312 int maxVValue; /* max vertical timing value */
|
313 dawes 1.1.2.1 int virtualX; /* Virtual width */
314 int virtualY; /* Virtual height */
|
315 dawes 1.1.2.31 MessageType virtualFrom; /* set from config? */
|
316 dawes 1.1.2.1 int displayWidth; /* memory pitch */
317 int frameX0; /* viewport position */
318 int frameY0;
319 int frameX1;
320 int frameY1;
|
321 dawes 1.1.2.6 int zoomLocked; /* Disallow mode changes */
|
322 dawes 1.1.2.14 DisplayModePtr modePool; /* list of compatible modes */
323 DisplayModePtr modes; /* list of actual modes */
|
324 dawes 1.1.2.1 DisplayModePtr currentMode; /* current mode
|
325 dawes 1.1.2.10 * This was previously
|
326 dawes 1.1.2.1 * overloaded with the modes
327 * field, which is a pointer
328 * into a circular list */
|
329 dawes 1.1.2.28 confScreenPtr confScreen; /* Screen config info */
|
330 dawes 1.1.2.1 MonPtr monitor; /* Monitor information */
331 GDevPtr device; /* device information */
|
332 dawes 1.1.2.27 DispPtr display; /* Display information */
|
333 dawes 1.1.2.31 int widthmm; /* physical display dimensions
|
334 dawes 1.1.2.1 * in mm */
|
335 dawes 1.1.2.31 int heightmm;
|
336 dawes 1.1.2.1 char * name; /* Name to prefix messages */
337 pointer driverPrivate; /* Driver private area */
338 int numPrivates; /* Number of privates */
339 DevUnion * privates; /* Other privates can hook in
|
340 dawes 1.1.2.10 * here */
|
341 dawes 1.1.2.1
|
342 dawes 1.1.2.2 char ** requiredModules; /* List of modules needed */
|
343 dawes 1.1.2.1
344 /* Some of these may be moved out of here into the driver private area */
345
346 char * chipset; /* chipset name */
347 char * ramdac; /* ramdac name */
|
348 dawes 1.1.2.13 char * clockchip; /* clock name */
349 Bool progClock; /* clock is programmable */
|
350 dawes 1.1.2.1 int dacSpeeds[MAXDACSPEEDS];/* list of clock limits */
351 int numClocks; /* number of clocks */
352 int clock[MAXCLOCKS]; /* list of clock frequencies */
353 int videoRam; /* amount of video ram (kb) */
354 unsigned long biosBase; /* Base address of video BIOS */
355 unsigned long memBase; /* Frame buffer base address */
|
356 dawes 1.1.2.45 unsigned long ioBase; /* I/O or MMIO base adderss */
|
357 dawes 1.1.2.1 int memClk; /* memory clock */
|
358 dawes 1.1.2.13 int textClockFreq; /* clock of text mode */
|
359 dawes 1.1.2.37 Bool flipPixels; /* swap default black/white */
|
360 dawes 1.1.2.36 pointer options;
|
361 dawes 1.1.2.1
362 int chipID;
363 int chipRev;
|
364 dawes 1.1.2.6
|
365 dawes 1.1.2.37 /* Allow screens to be enabled/disabled individually */
|
366 dawes 1.1.2.7 Bool vtSema;
|
367 dawes 1.1.2.43
|
368 dawes 1.1.2.45 AllocateOffscreenAreaProcPtr AllocateOffscreenArea;
369 FreeOffscreenAreaProcPtr FreeOffscreenArea;
|
370 dawes 1.1.2.7
|
371 dawes 1.1.2.37 /*
372 * These can be used when the minor ABI version is incremented.
373 * The NUM_* parameters must be reduced appropriately to keep the
374 * structure size and alignment unchanged.
375 */
|
376 dawes 1.1.2.1 int reservedInt[NUM_RESERVED_INTS];
377 pointer reservedPtr[NUM_RESERVED_POINTERS];
378
|
379 dawes 1.1.2.5 /*
380 * Driver entry points.
381 *
382 */
|
383 dawes 1.1.2.1
384 Bool (*Probe)(int flags);
385 Bool (*PreInit)(struct _ScrnInfoRec *pScrn, int flags);
386 Bool (*ScreenInit)(int scrnIndex, ScreenPtr pScreen,
387 int argc, char **argv);
388 Bool (*SwitchMode)(int scrnIndex, DisplayModePtr mode,
389 int flags);
390 void (*AdjustFrame)(int scrnIndex, int x, int y, int flags);
391 void (*EnterVT)(int scrnIndex, int flags);
392 void (*LeaveVT)(int scrnIndex, int flags);
|
393 dawes 1.1.2.2 void (*FreeScreen)(int scrnIndex, int flags);
|
394 dawes 1.1.2.1 int (*ValidMode)(int scrnIndex, DisplayModePtr mode,
395 Bool verbose, int flags);
|
396 dawes 1.1.2.37 /*
397 * This can be used when the minor ABI version is incremented.
398 * The NUM_* parameter must be reduced appropriately to keep the
399 * structure size and alignment unchanged.
400 */
|
401 dawes 1.1.2.1 funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
402
403 } ScrnInfoRec, *ScrnInfoPtr;
|
404 dawes 1.1.2.2
405 /*
406 * The driver list struct. This contains the information required for each
407 * driver before a ScrnInfoRec has been allocated.
408 */
409 typedef struct {
410 int driverVersion;
411 char * driverName;
|
412 dawes 1.1.2.34 void (*Identify)(int flags);
|
413 dawes 1.1.2.2 Bool (*Probe)(int flags);
414 } DriverRec, *DriverPtr;
|
415 dawes 1.1.2.36
416
417 typedef struct {
418 int token; /* id of the token */
419 const char * name; /* token name */
420 } SymTabRec, *SymTabPtr;
|
421 dawes 1.1.2.2
|
422 dawes 1.1.2.1
423 /* These are the possible flags for ValidMode */
424 typedef enum {
425 MODE_USED, /* this mode is really being used in the */
426 /* modes line of the Display Subsection */
427 MODE_SUGGESTED, /* this mode is included in the available*/
428 /* modes in the Monitor Section */
429 MODE_VID /* this is called from the VidMode extension */
430 } ValidModeFlags;
|
431 dawes 1.1.2.9
432 /* flags for xf86SaveRestoreImage */
433 typedef enum {
434 SaveImage,
435 RestoreImage,
436 FreeImage
437 } SaveRestoreFlags;
|
438 dawes 1.1.2.1
439 /* flags for xf86LookupMode */
440 typedef enum {
441 LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
|
442 dawes 1.1.2.14 LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
443 LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
|
444 dawes 1.1.2.16 LOOKUP_LIST_ORDER /* Pick first useful mode in list */
|
445 dawes 1.1.2.1 } LookupModeFlags;
|
446 dawes 1.1.2.42
447 /* flags for indicating depth 24 support */
448 typedef enum {
449 NoDepth24Support = 0x00,
450 Support24bppFb = 0x01, /* 24bpp framebuffer supported */
451 Support32bppFb = 0x02, /* 32bpp framebuffer supported */
452 SupportConvert24to32 = 0x04, /* Can convert 24bpp pixmap to 32bpp */
453 SupportConvert32to24 = 0x08, /* Can convert 32bpp pixmap to 24bpp */
454 ForceConvert24to32 = 0x10, /* Force 24bpp pixmap to 32bpp conv */
455 ForceConvert32to24 = 0x20 /* Force 32bpp pixmap to 24bpp conv */
456 } Depth24Flags;
|
457 dawes 1.1.2.1
|
458 hohndel 1.1.2.15 /*
459 * mouse protocol types
460 */
|
461 dawes 1.1.2.19 typedef enum {
462 PROT_MS = 0, /* Microsoft */
463 PROT_MSC, /* Mouse Systems Corp */
464 PROT_MM, /* MMseries */
465 PROT_LOGI, /* Logitech */
466 PROT_BM, /* BusMouse ??? */
467 PROT_LOGIMAN, /* MouseMan / TrackMan */
468 PROT_PS2, /* PS/2 mouse */
469 PROT_MMHIT, /* MM_HitTab */
470 PROT_GLIDEPOINT, /* ALPS GlidePoint */
471 PROT_MSINTELLIMOUSE, /* Microsoft IntelliMouse */
472 NUM_PROTOCOLS /* MUST BE LAST */
473 } MouseProtocol;
|
474 hohndel 1.1.2.15
475 /*
|
476 dawes 1.1.2.19 * keyboard specialKeyMap paramters
|
477 hohndel 1.1.2.15 */
|
478 dawes 1.1.2.19 typedef enum {
479 K_INDEX_LEFTALT = 0,
480 K_INDEX_RIGHTALT,
481 K_INDEX_SCROLLLOCK,
482 K_INDEX_RIGHTCTL,
483 NUM_KEYMAP_TYPES
484 } KeymapIndex;
485
486 typedef enum {
487 KM_META = 0,
488 KM_COMPOSE,
489 KM_MODESHIFT,
490 KM_MODELOCK,
491 KM_SCROLLLOCK,
492 KM_CONTROL
493 } KeymapKey;
|
494 dawes 1.1.2.34
|
495 dawes 1.1.2.41
496 /* For DPMS */
497 typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
498
499 /* For DGA */
500 typedef Bool (*DGAGetParamsProcPtr)(int, unsigned long *, int *, int *);
501 typedef Bool (*DGASetDirectProcPtr)(int, Bool);
502 typedef Bool (*DGASetBankProcPtr)(int, int, int);
503 typedef Bool (*DGASetViewportProcPtr)(int, int, int, int);
504 typedef Bool (*DGAViewportChangedProcPtr)(int, int, int);
505 typedef struct {
506 DGAGetParamsProcPtr GetParams;
507 DGASetDirectProcPtr SetDirectMode;
508 DGASetBankProcPtr SetBank;
509 DGASetViewportProcPtr SetViewport;
510 DGAViewportChangedProcPtr ViewportChanged;
511 /* Future entries must be added at the end */
512 } DGAInfoRec, *DGAInfoPtr;
513
514 /* These are used by xf86GetClocks */
515 #define CLK_REG_SAVE -1
516 dawes 1.1.2.41 #define CLK_REG_RESTORE -2
|
517 hohndel 1.1.2.15
518 /*
519 * misc constants
520 */
|
521 dawes 1.1.2.1 #define INTERLACE_REFRESH_WEIGHT 1.5
|
522 dawes 1.1.2.16 #define SYNC_TOLERANCE 0.01 /* 1 percent */
523 #define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
|
524 dawes 1.1.2.1
|
525 dawes 1.1.2.37 #if 0
|
526 dawes 1.1.2.1 #define LD_RESOLV_IFDONE 0 /* only check if no more
527 delays pending */
528 #define LD_RESOLV_NOW 1 /* finish one delay step */
529 #define LD_RESOLV_FORCE 2 /* force checking... */
|
530 dawes 1.1.2.37 #endif
|
531 dawes 1.1.2.1
532 #endif /* _XF86STR_H */
|