1 
2 /*
3  * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is 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
18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * Except as contained in this notice, the name of the copyright holder(s)
24  * and author(s) shall not be used in advertising or otherwise to promote
25  * the sale, use or other dealings in this Software without prior written
26  * authorization from the copyright holder(s) and author(s).
27  */
28 
29 /*
30  * This file contains definitions of the public XFree86 data structures/types.
31  * Any data structures that video drivers need to access should go here.
32  */
33 
34 #ifndef _XF86STR_H
35 #define _XF86STR_H
36 
37 #include "misc.h"
38 #include "input.h"
39 #include "scrnintstr.h"
40 #include "pixmapstr.h"
41 #include "colormapst.h"
42 #include "xf86Module.h"
43 #include "xf86Opt.h"
44 #include "displaymode.h"
45 
46 /**
47  * Integer type that is of the size of the addressable memory (machine size).
48  * On most platforms \c uintptr_t will suffice.  However, on some mixed
49  * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
50  * must be 64-bits.
51  */
52 #include <inttypes.h>
53 #if defined(__powerpc__)
54 typedef uint64_t memType;
55 #else
56 typedef uintptr_t memType;
57 #endif
58 
59 /* Video mode flags */
60 
61 typedef enum {
62     V_PHSYNC = 0x0001,
63     V_NHSYNC = 0x0002,
64     V_PVSYNC = 0x0004,
65     V_NVSYNC = 0x0008,
66     V_INTERLACE = 0x0010,
67     V_DBLSCAN = 0x0020,
68     V_CSYNC = 0x0040,
69     V_PCSYNC = 0x0080,
70     V_NCSYNC = 0x0100,
71     V_HSKEW = 0x0200,           /* hskew provided */
72     V_BCAST = 0x0400,
73     V_PIXMUX = 0x1000,
74     V_DBLCLK = 0x2000,
75     V_CLKDIV2 = 0x4000
76 } ModeFlags;
77 
78 typedef enum {
79     INTERLACE_HALVE_V = 0x0001  /* Halve V values for interlacing */
80 } CrtcAdjustFlags;
81 
82 /* Flags passed to ChipValidMode() */
83 typedef enum {
84     MODECHECK_INITIAL = 0,
85     MODECHECK_FINAL = 1
86 } ModeCheckFlags;
87 
88 /*
89  * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
90  * Preferred will bubble a mode to the top within a set.
91  */
92 #define M_T_BUILTIN 0x01        /* built-in mode */
93 #define M_T_CLOCK_C (0x02 | M_T_BUILTIN)        /* built-in mode - configure clock */
94 #define M_T_CRTC_C  (0x04 | M_T_BUILTIN)        /* built-in mode - configure CRTC  */
95 #define M_T_CLOCK_CRTC_C  (M_T_CLOCK_C | M_T_CRTC_C)
96                                /* built-in mode - configure CRTC and clock */
97 #define M_T_PREFERRED 0x08      /* preferred mode within a set */
98 #define M_T_DEFAULT 0x10        /* (VESA) default modes */
99 #define M_T_USERDEF 0x20        /* One of the modes from the config file */
100 #define M_T_DRIVER  0x40        /* Supplied by the driver (EDID, etc) */
101 #define M_T_USERPREF 0x80       /* mode preferred by the user config */
102 
103 /* The monitor description */
104 
105 #define MAX_HSYNC 8
106 #define MAX_VREFRESH 8
107 
108 typedef struct {
109     float hi, lo;
110 } range;
111 
112 typedef struct {
113     CARD32 red, green, blue;
114 } rgb;
115 
116 typedef struct {
117     float red, green, blue;
118 } Gamma;
119 
120 /* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
121 #define GAMMA_MAX	10.0
122 #define GAMMA_MIN	(1.0 / GAMMA_MAX)
123 #define GAMMA_ZERO	(GAMMA_MIN / 100.0)
124 
125 typedef struct {
126     const char *id;
127     const char *vendor;
128     const char *model;
129     int nHsync;
130     range hsync[MAX_HSYNC];
131     int nVrefresh;
132     range vrefresh[MAX_VREFRESH];
133     DisplayModePtr Modes;       /* Start of the monitor's mode list */
134     DisplayModePtr Last;        /* End of the monitor's mode list */
135     Gamma gamma;                /* Gamma of the monitor */
136     int widthmm;
137     int heightmm;
138     void *options;
139     void *DDC;
140     Bool reducedblanking;       /* Allow CVT reduced blanking modes? */
141     int maxPixClock;            /* in kHz, like mode->Clock */
142 } MonRec, *MonPtr;
143 
144 /* the list of clock ranges */
145 typedef struct x_ClockRange {
146     struct x_ClockRange *next;
147     int minClock;               /* (kHz) */
148     int maxClock;               /* (kHz) */
149     int clockIndex;             /* -1 for programmable clocks */
150     Bool interlaceAllowed;
151     Bool doubleScanAllowed;
152     int ClockMulFactor;
153     int ClockDivFactor;
154     int PrivFlags;
155 } ClockRange, *ClockRangePtr;
156 
157 /*
158  * The driverFunc. xorgDriverFuncOp specifies the action driver should
159  * perform. If requested option is not supported function should return
160  * FALSE. pointer can be used to pass arguments to the function or
161  * to return data to the caller.
162  */
163 typedef struct _ScrnInfoRec *ScrnInfoPtr;
164 
165 /* do not change order */
166 typedef enum {
167     RR_GET_INFO,
168     RR_SET_CONFIG,
169     RR_GET_MODE_MM,
170     GET_REQUIRED_HW_INTERFACES = 10,
171     SUPPORTS_SERVER_FDS = 11,
172 } xorgDriverFuncOp;
173 
174 typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
175 
176 /* RR_GET_INFO, RR_SET_CONFIG */
177 typedef struct {
178     int rotation;
179     int rate;
180     int width;
181     int height;
182 } xorgRRConfig;
183 
184 typedef union {
185     short RRRotations;
186     xorgRRConfig RRConfig;
187 } xorgRRRotation, *xorgRRRotationPtr;
188 
189 /* RR_GET_MODE_MM */
190 typedef struct {
191     DisplayModePtr mode;
192     int virtX;
193     int virtY;
194     int mmWidth;
195     int mmHeight;
196 } xorgRRModeMM, *xorgRRModeMMPtr;
197 
198 /* GET_REQUIRED_HW_INTERFACES */
199 #define HW_IO 1
200 #define HW_MMIO 2
201 #define HW_SKIP_CONSOLE 4
202 #define NEED_IO_ENABLED(x) (x & HW_IO)
203 
204 typedef CARD32 xorgHWFlags;
205 
206 /*
207  * The driver list struct.  This contains the information required for each
208  * driver before a ScrnInfoRec has been allocated.
209  */
210 struct _DriverRec;
211 
212 struct _SymTabRec;
213 struct _PciChipsets;
214 
215 struct pci_device;
216 struct xf86_platform_device;
217 
218 typedef struct _DriverRec {
219     int driverVersion;
220     const char *driverName;
221     void (*Identify) (int flags);
222     Bool (*Probe) (struct _DriverRec * drv, int flags);
223     const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
224     void *module;
225     int refCount;
226     xorgDriverFuncProc *driverFunc;
227 
228     const struct pci_id_match *supported_devices;
229     Bool (*PciProbe) (struct _DriverRec * drv, int entity_num,
230                       struct pci_device * dev, intptr_t match_data);
231     Bool (*platformProbe) (struct _DriverRec * drv, int entity_num, int flags,
232                            struct xf86_platform_device * dev, intptr_t match_data);
233 } DriverRec, *DriverPtr;
234 
235 /*
236  * platform probe flags
237  */
238 #define PLATFORM_PROBE_GPU_SCREEN 1
239 
240 /*
241  *  AddDriver flags
242  */
243 #define HaveDriverFuncs 1
244 
245 /*
246  * These are the private bus types.  New types can be added here.  Types
247  * required for the public interface should be added to xf86str.h, with
248  * function prototypes added to xf86.h.
249  */
250 
251 /* Tolerate prior #include <linux/input.h> */
252 #if defined(__linux__) || defined(__FreeBSD__)
253 #undef BUS_NONE
254 #undef BUS_PCI
255 #undef BUS_SBUS
256 #undef BUS_PLATFORM
257 #undef BUS_last
258 #endif
259 
260 typedef enum {
261     BUS_NONE,
262     BUS_PCI,
263     BUS_SBUS,
264     BUS_PLATFORM,
265     BUS_last                    /* Keep last */
266 } BusType;
267 
268 typedef struct {
269     int fbNum;
270 } SbusBusId;
271 
272 typedef struct _bus {
273     BusType type;
274     union {
275         struct pci_device *pci;
276         SbusBusId sbus;
277         struct xf86_platform_device *plat;
278     } id;
279 } BusRec, *BusPtr;
280 
281 typedef enum {
282     DAC_BPP8 = 0,
283     DAC_BPP16,
284     DAC_BPP24,
285     DAC_BPP32,
286     MAXDACSPEEDS
287 } DacSpeedIndex;
288 
289 typedef struct {
290     const char *identifier;
291     const char *vendor;
292     const char *board;
293     const char *chipset;
294     const char *ramdac;
295     const char *driver;
296     struct _confscreenrec *myScreenSection;
297     Bool claimed;
298     int dacSpeeds[MAXDACSPEEDS];
299     int numclocks;
300     int clock[MAXCLOCKS];
301     const char *clockchip;
302     const char *busID;
303     Bool active;
304     Bool inUse;
305     int videoRam;
306     unsigned long MemBase;      /* Frame buffer base address */
307     unsigned long IOBase;
308     int chipID;
309     int chipRev;
310     void *options;
311     int irq;
312     int screen;                 /* For multi-CRTC cards */
313 } GDevRec, *GDevPtr;
314 
315 typedef struct {
316     int frameX0;
317     int frameY0;
318     int virtualX;
319     int virtualY;
320     int depth;
321     int fbbpp;
322     rgb weight;
323     rgb blackColour;
324     rgb whiteColour;
325     int defaultVisual;
326     const char **modes;
327     void *options;
328 } DispRec, *DispPtr;
329 
330 typedef struct _confxvportrec {
331     const char *identifier;
332     void *options;
333 } confXvPortRec, *confXvPortPtr;
334 
335 typedef struct _confxvadaptrec {
336     const char *identifier;
337     int numports;
338     confXvPortPtr ports;
339     void *options;
340 } confXvAdaptorRec, *confXvAdaptorPtr;
341 
342 #define MAX_GPUDEVICES 4
343 typedef struct _confscreenrec {
344     const char *id;
345     int screennum;
346     int defaultdepth;
347     int defaultbpp;
348     int defaultfbbpp;
349     MonPtr monitor;
350     GDevPtr device;
351     int numdisplays;
352     DispPtr *displays;
353     int numxvadaptors;
354     confXvAdaptorPtr xvadaptors;
355     void *options;
356 
357     int num_gpu_devices;
358     GDevPtr gpu_devices[MAX_GPUDEVICES];
359 } confScreenRec, *confScreenPtr;
360 
361 typedef enum {
362     PosObsolete = -1,
363     PosAbsolute = 0,
364     PosRightOf,
365     PosLeftOf,
366     PosAbove,
367     PosBelow,
368     PosRelative
369 } PositionType;
370 
371 typedef struct _screenlayoutrec {
372     confScreenPtr screen;
373     const char *topname;
374     confScreenPtr top;
375     const char *bottomname;
376     confScreenPtr bottom;
377     const char *leftname;
378     confScreenPtr left;
379     const char *rightname;
380     confScreenPtr right;
381     PositionType where;
382     int x;
383     int y;
384     const char *refname;
385     confScreenPtr refscreen;
386 } screenLayoutRec, *screenLayoutPtr;
387 
388 typedef struct _InputInfoRec InputInfoRec;
389 
390 typedef struct _serverlayoutrec {
391     const char *id;
392     screenLayoutPtr screens;
393     GDevPtr inactives;
394     InputInfoRec **inputs;      /* NULL terminated */
395     void *options;
396 } serverLayoutRec, *serverLayoutPtr;
397 
398 typedef struct _confdribufferrec {
399     int count;
400     int size;
401     enum {
402         XF86DRI_WC_HINT = 0x0001        /* Placeholder: not implemented */
403     } flags;
404 } confDRIBufferRec, *confDRIBufferPtr;
405 
406 typedef struct _confdrirec {
407     int group;
408     int mode;
409     int bufs_count;
410     confDRIBufferRec *bufs;
411 } confDRIRec, *confDRIPtr;
412 
413 #define NUM_RESERVED_INTS		4
414 #define NUM_RESERVED_POINTERS		4
415 #define NUM_RESERVED_FUNCS		4
416 
417 /* let clients know they can use this */
418 #define XF86_SCRN_HAS_PREFER_CLONE 1
419 
420 typedef void *(*funcPointer) (void);
421 
422 /* Power management events: so far we only support APM */
423 
424 typedef enum {
425     XF86_APM_UNKNOWN = -1,
426     XF86_APM_SYS_STANDBY,
427     XF86_APM_SYS_SUSPEND,
428     XF86_APM_CRITICAL_SUSPEND,
429     XF86_APM_USER_STANDBY,
430     XF86_APM_USER_SUSPEND,
431     XF86_APM_STANDBY_RESUME,
432     XF86_APM_NORMAL_RESUME,
433     XF86_APM_CRITICAL_RESUME,
434     XF86_APM_LOW_BATTERY,
435     XF86_APM_POWER_STATUS_CHANGE,
436     XF86_APM_UPDATE_TIME,
437     XF86_APM_CAPABILITY_CHANGED,
438     XF86_APM_STANDBY_FAILED,
439     XF86_APM_SUSPEND_FAILED
440 } pmEvent;
441 
442 typedef enum {
443     PM_WAIT,
444     PM_CONTINUE,
445     PM_FAILED,
446     PM_NONE
447 } pmWait;
448 
449 typedef struct _PciChipsets {
450     /**
451      * Key used to match this device with its name in an array of
452      * \c SymTabRec.
453      */
454     int numChipset;
455 
456     /**
457      * This value is quirky.  Depending on the driver, it can take on one of
458      * three meanings.  In drivers that have exactly one vendor ID (e.g.,
459      * radeon, mga, i810) the low 16-bits are the device ID.
460      *
461      * In drivers that can have multiple vendor IDs (e.g., the glint driver
462      * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
463      * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
464      * the high 16-bits are the vendor ID.
465      *
466      * In drivers that don't have a specific vendor (e.g., vga) contains the
467      * device ID for either the generic VGA or generic 8514 devices.  This
468      * turns out to be the same as the subclass and programming interface
469      * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
470      * 0x000101) and for 8514 is 0x030001).
471      */
472     int PCIid;
473 
474 /* dummy place holders for drivers to build against old/new servers */
475 #define RES_UNDEFINED NULL
476 #define RES_EXCLUSIVE_VGA NULL
477 #define RES_SHARED_VGA NULL
478     void *dummy;
479 } PciChipsets;
480 
481 /* Entity properties */
482 typedef void (*EntityProc) (int entityIndex, void *private);
483 
484 typedef struct _entityInfo {
485     int index;
486     BusRec location;
487     int chipset;
488     Bool active;
489     GDevPtr device;
490     DriverPtr driver;
491 } EntityInfoRec, *EntityInfoPtr;
492 
493 /* DGA */
494 
495 typedef struct {
496     int num;                    /* A unique identifier for the mode (num > 0) */
497     DisplayModePtr mode;
498     int flags;                  /* DGA_CONCURRENT_ACCESS, etc... */
499     int imageWidth;             /* linear accessible portion (pixels) */
500     int imageHeight;
501     int pixmapWidth;            /* Xlib accessible portion (pixels) */
502     int pixmapHeight;           /* both fields ignored if no concurrent access */
503     int bytesPerScanline;
504     int byteOrder;              /* MSBFirst, LSBFirst */
505     int depth;
506     int bitsPerPixel;
507     unsigned long red_mask;
508     unsigned long green_mask;
509     unsigned long blue_mask;
510     short visualClass;
511     int viewportWidth;
512     int viewportHeight;
513     int xViewportStep;          /* viewport position granularity */
514     int yViewportStep;
515     int maxViewportX;           /* max viewport origin */
516     int maxViewportY;
517     int viewportFlags;          /* types of page flipping possible */
518     int offset;                 /* offset into physical memory */
519     unsigned char *address;     /* server's mapped framebuffer */
520     int reserved1;
521     int reserved2;
522 } DGAModeRec, *DGAModePtr;
523 
524 typedef struct {
525     DGAModePtr mode;
526     PixmapPtr pPix;
527 } DGADeviceRec, *DGADevicePtr;
528 
529 /*
530  * Flags for driver Probe() functions.
531  */
532 #define PROBE_DEFAULT	  0x00
533 #define PROBE_DETECT	  0x01
534 #define PROBE_TRYHARD	  0x02
535 
536 /*
537  * Driver entry point types
538  */
539 
540 typedef Bool xf86ProbeProc(DriverPtr, int);
541 typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
542 typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
543 typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr);
544 typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int);
545 typedef Bool xf86EnterVTProc(ScrnInfoPtr);
546 typedef void xf86LeaveVTProc(ScrnInfoPtr);
547 typedef void xf86FreeScreenProc(ScrnInfoPtr);
548 typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
549 typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
550 typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
551 typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
552 typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int);
553 typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool);
554 typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
555 typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
556 typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
557 typedef void xf86ModeSetProc(ScrnInfoPtr);
558 
559 /*
560  * ScrnInfoRec
561  *
562  * There is one of these for each screen, and it holds all the screen-specific
563  * information.  Note: No fields are to be dependent on compile-time defines.
564  */
565 
566 typedef struct _ScrnInfoRec {
567     int driverVersion;
568     const char *driverName;     /* canonical name used in */
569     /* the config file */
570     ScreenPtr pScreen;          /* Pointer to the ScreenRec */
571     int scrnIndex;              /* Number of this screen */
572     Bool configured;            /* Is this screen valid */
573     int origIndex;              /* initial number assigned to
574                                  * this screen before
575                                  * finalising the number of
576                                  * available screens */
577 
578     /* Display-wide screenInfo values needed by this screen */
579     int imageByteOrder;
580     int bitmapScanlineUnit;
581     int bitmapScanlinePad;
582     int bitmapBitOrder;
583     int numFormats;
584     PixmapFormatRec formats[MAXFORMATS];
585     PixmapFormatRec fbFormat;
586 
587     int bitsPerPixel;           /* fb bpp */
588     int depth;                  /* depth of default visual */
589     MessageType depthFrom;      /* set from config? */
590     MessageType bitsPerPixelFrom;       /* set from config? */
591     rgb weight;                 /* r/g/b weights */
592     rgb mask;                   /* rgb masks */
593     rgb offset;                 /* rgb offsets */
594     int rgbBits;                /* Number of bits in r/g/b */
595     Gamma gamma;                /* Gamma of the monitor */
596     int defaultVisual;          /* default visual class */
597     int virtualX;               /* Virtual width */
598     int virtualY;               /* Virtual height */
599     int xInc;                   /* Horizontal timing increment */
600     int displayWidth;           /* memory pitch */
601     int frameX0;                /* viewport position */
602     int frameY0;
603     int frameX1;
604     int frameY1;
605     int zoomLocked;             /* Disallow mode changes */
606     DisplayModePtr modePool;    /* list of compatible modes */
607     DisplayModePtr modes;       /* list of actual modes */
608     DisplayModePtr currentMode; /* current mode
609                                  * This was previously
610                                  * overloaded with the modes
611                                  * field, which is a pointer
612                                  * into a circular list */
613     confScreenPtr confScreen;   /* Screen config info */
614     MonPtr monitor;             /* Monitor information */
615     DispPtr display;            /* Display information */
616     int *entityList;            /* List of device entities */
617     int numEntities;
618     int widthmm;                /* physical display dimensions
619                                  * in mm */
620     int heightmm;
621     int xDpi;                   /* width DPI */
622     int yDpi;                   /* height DPI */
623     const char *name;           /* Name to prefix messages */
624     void *driverPrivate;        /* Driver private area */
625     DevUnion *privates;         /* Other privates can hook in
626                                  * here */
627     DriverPtr drv;              /* xf86DriverList[] entry */
628     void *module;               /* Pointer to module head */
629     int colorKey;
630     int overlayFlags;
631 
632     /* Some of these may be moved out of here into the driver private area */
633 
634     const char *chipset;        /* chipset name */
635     const char *ramdac;         /* ramdac name */
636     const char *clockchip;      /* clock name */
637     Bool progClock;             /* clock is programmable */
638     int numClocks;              /* number of clocks */
639     int clock[MAXCLOCKS];       /* list of clock frequencies */
640     int videoRam;               /* amount of video ram (kb) */
641     unsigned long memPhysBase;  /* Physical address of FB */
642     unsigned long fbOffset;     /* Offset of FB in the above */
643     Bool flipPixels;            /* swap default black/white */
644     void *options;
645 
646     /* Allow screens to be enabled/disabled individually */
647     Bool vtSema;
648 
649     /* hw cursor moves from input thread */
650     Bool silkenMouse;
651 
652     /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
653     ClockRangePtr clockRanges;
654     int adjustFlags;
655 
656     /* initial rightof support disable */
657     int                 preferClone;
658 
659     Bool is_gpu;
660     uint32_t capabilities;
661 
662     int *entityInstanceList;
663     struct pci_device *vgaDev;
664 
665     /*
666      * Driver entry points.
667      *
668      */
669 
670     xf86ProbeProc *Probe;
671     xf86PreInitProc *PreInit;
672     xf86ScreenInitProc *ScreenInit;
673     xf86SwitchModeProc *SwitchMode;
674     xf86AdjustFrameProc *AdjustFrame;
675     xf86EnterVTProc *EnterVT;
676     xf86LeaveVTProc *LeaveVT;
677     xf86FreeScreenProc *FreeScreen;
678     xf86ValidModeProc *ValidMode;
679     xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
680     xf86SetDGAModeProc *SetDGAMode;
681     xf86ChangeGammaProc *ChangeGamma;
682     xf86PointerMovedProc *PointerMoved;
683     xf86PMEventProc *PMEvent;
684     xf86DPMSSetProc *DPMSSet;
685     xf86LoadPaletteProc *LoadPalette;
686     xf86SetOverscanProc *SetOverscan;
687     xorgDriverFuncProc *DriverFunc;
688     xf86ModeSetProc *ModeSet;
689 
690     int reservedInt[NUM_RESERVED_INTS];
691     void *reservedPtr[NUM_RESERVED_POINTERS];
692     funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
693 } ScrnInfoRec;
694 
695 typedef struct {
696     Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,
697                              char **name,
698                              unsigned char **mem,
699                              int *size, int *offset, int *extra);
700     void (*CloseFramebuffer) (ScrnInfoPtr pScrn);
701     Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode);
702     void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags);
703     int (*GetViewport) (ScrnInfoPtr pScrn);
704     void (*Sync) (ScrnInfoPtr);
705     void (*FillRect) (ScrnInfoPtr pScrn,
706                       int x, int y, int w, int h, unsigned long color);
707     void (*BlitRect) (ScrnInfoPtr pScrn,
708                       int srcx, int srcy, int w, int h, int dstx, int dsty);
709     void (*BlitTransRect) (ScrnInfoPtr pScrn,
710                            int srcx, int srcy,
711                            int w, int h,
712                            int dstx, int dsty, unsigned long color);
713 } DGAFunctionRec, *DGAFunctionPtr;
714 
715 typedef struct _SymTabRec {
716     int token;                  /* id of the token */
717     const char *name;           /* token name */
718 } SymTabRec, *SymTabPtr;
719 
720 /* flags for xf86LookupMode */
721 typedef enum {
722     LOOKUP_DEFAULT = 0,         /* Use default mode lookup method */
723     LOOKUP_BEST_REFRESH,        /* Pick modes with best refresh */
724     LOOKUP_CLOSEST_CLOCK,       /* Pick modes with the closest clock */
725     LOOKUP_LIST_ORDER,          /* Pick first useful mode in list */
726     LOOKUP_CLKDIV2 = 0x0100,    /* Allow half clocks */
727     LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
728 } LookupModeFlags;
729 
730 #define NoDepth24Support	0x00
731 #define Support24bppFb		0x01    /* 24bpp framebuffer supported */
732 #define Support32bppFb		0x02    /* 32bpp framebuffer supported */
733 #define SupportConvert24to32	0x04    /* Can convert 24bpp pixmap to 32bpp */
734 #define SupportConvert32to24	0x08    /* Can convert 32bpp pixmap to 24bpp */
735 #define PreferConvert24to32	0x10    /* prefer 24bpp pixmap to 32bpp conv */
736 #define PreferConvert32to24	0x20    /* prefer 32bpp pixmap to 24bpp conv */
737 
738 /* For DPMS */
739 typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
740 
741 /* Input handler proc */
742 typedef void (*InputHandlerProc) (int fd, void *data);
743 
744 /* These are used by xf86GetClocks */
745 #define CLK_REG_SAVE		-1
746 #define CLK_REG_RESTORE		-2
747 
748 /*
749  * misc constants
750  */
751 #define INTERLACE_REFRESH_WEIGHT	1.5
752 #define SYNC_TOLERANCE		0.01    /* 1 percent */
753 #define CLOCK_TOLERANCE		2000    /* Clock matching tolerance (2MHz) */
754 
755 #define OVERLAY_8_32_DUALFB	0x00000001
756 #define OVERLAY_8_24_DUALFB	0x00000002
757 #define OVERLAY_8_16_DUALFB	0x00000004
758 #define OVERLAY_8_32_PLANAR	0x00000008
759 
760 /* Values of xf86Info.mouseFlags */
761 #define MF_CLEAR_DTR       1
762 #define MF_CLEAR_RTS       2
763 
764 /* Action Events */
765 typedef enum {
766     ACTION_TERMINATE = 0,       /* Terminate Server */
767     ACTION_NEXT_MODE = 10,      /* Switch to next video mode */
768     ACTION_PREV_MODE,
769     ACTION_SWITCHSCREEN = 100,  /* VT switch */
770     ACTION_SWITCHSCREEN_NEXT,
771     ACTION_SWITCHSCREEN_PREV,
772 } ActionEvent;
773 
774 #endif                          /* _XF86STR_H */
775