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__)
54typedef uint64_t memType;
55#else
56typedef uintptr_t memType;
57#endif
58
59/* Video mode flags */
60
61typedef 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
78typedef enum {
79    INTERLACE_HALVE_V = 0x0001  /* Halve V values for interlacing */
80} CrtcAdjustFlags;
81
82/* Flags passed to ChipValidMode() */
83typedef 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
108typedef struct {
109    float hi, lo;
110} range;
111
112typedef struct {
113    CARD32 red, green, blue;
114} rgb;
115
116typedef 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
125typedef 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 */
145typedef 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 */
163typedef struct _ScrnInfoRec *ScrnInfoPtr;
164
165/* do not change order */
166typedef 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
174typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
175
176/* RR_GET_INFO, RR_SET_CONFIG */
177typedef struct {
178    int rotation;
179    int rate;
180    int width;
181    int height;
182} xorgRRConfig;
183
184typedef union {
185    short RRRotations;
186    xorgRRConfig RRConfig;
187} xorgRRRotation, *xorgRRRotationPtr;
188
189/* RR_GET_MODE_MM */
190typedef 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
204typedef 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 */
210struct _DriverRec;
211
212struct _SymTabRec;
213struct _PciChipsets;
214
215struct pci_device;
216struct xf86_platform_device;
217
218typedef 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__)
253#undef BUS_NONE
254#undef BUS_PCI
255#undef BUS_SBUS
256#undef BUS_PLATFORM
257#undef BUS_USB
258#undef BUS_last
259#endif
260
261typedef enum {
262    BUS_NONE,
263    BUS_PCI,
264    BUS_SBUS,
265    BUS_ISA,
266    BUS_PLATFORM,
267    BUS_USB,
268    BUS_last                    /* Keep last */
269} BusType;
270
271typedef struct {
272    int fbNum;
273} SbusBusId;
274
275typedef struct _bus {
276    BusType type;
277    union {
278        struct pci_device *pci;
279        SbusBusId sbus;
280        struct xf86_platform_device *plat;
281    } id;
282} BusRec, *BusPtr;
283
284typedef enum {
285    DAC_BPP8 = 0,
286    DAC_BPP16,
287    DAC_BPP24,
288    DAC_BPP32,
289    MAXDACSPEEDS
290} DacSpeedIndex;
291
292typedef struct {
293    const char *identifier;
294    const char *vendor;
295    const char *board;
296    const char *chipset;
297    const char *ramdac;
298    const char *driver;
299    struct _confscreenrec *myScreenSection;
300    Bool claimed;
301    int dacSpeeds[MAXDACSPEEDS];
302    int numclocks;
303    int clock[MAXCLOCKS];
304    const char *clockchip;
305    const char *busID;
306    Bool active;
307    Bool inUse;
308    int videoRam;
309    unsigned long MemBase;      /* Frame buffer base address */
310    unsigned long IOBase;
311    int chipID;
312    int chipRev;
313    void *options;
314    int irq;
315    int screen;                 /* For multi-CRTC cards */
316} GDevRec, *GDevPtr;
317
318typedef struct {
319    int frameX0;
320    int frameY0;
321    int virtualX;
322    int virtualY;
323    int depth;
324    int fbbpp;
325    rgb weight;
326    rgb blackColour;
327    rgb whiteColour;
328    int defaultVisual;
329    const char **modes;
330    void *options;
331} DispRec, *DispPtr;
332
333typedef struct _confxvportrec {
334    const char *identifier;
335    void *options;
336} confXvPortRec, *confXvPortPtr;
337
338typedef struct _confxvadaptrec {
339    const char *identifier;
340    int numports;
341    confXvPortPtr ports;
342    void *options;
343} confXvAdaptorRec, *confXvAdaptorPtr;
344
345#define MAX_GPUDEVICES 4
346typedef struct _confscreenrec {
347    const char *id;
348    int screennum;
349    int defaultdepth;
350    int defaultbpp;
351    int defaultfbbpp;
352    MonPtr monitor;
353    GDevPtr device;
354    int numdisplays;
355    DispPtr *displays;
356    int numxvadaptors;
357    confXvAdaptorPtr xvadaptors;
358    void *options;
359
360    int num_gpu_devices;
361    GDevPtr gpu_devices[MAX_GPUDEVICES];
362} confScreenRec, *confScreenPtr;
363
364typedef enum {
365    PosObsolete = -1,
366    PosAbsolute = 0,
367    PosRightOf,
368    PosLeftOf,
369    PosAbove,
370    PosBelow,
371    PosRelative
372} PositionType;
373
374typedef struct _screenlayoutrec {
375    confScreenPtr screen;
376    const char *topname;
377    confScreenPtr top;
378    const char *bottomname;
379    confScreenPtr bottom;
380    const char *leftname;
381    confScreenPtr left;
382    const char *rightname;
383    confScreenPtr right;
384    PositionType where;
385    int x;
386    int y;
387    const char *refname;
388    confScreenPtr refscreen;
389} screenLayoutRec, *screenLayoutPtr;
390
391typedef struct _InputInfoRec InputInfoRec;
392
393typedef struct _serverlayoutrec {
394    const char *id;
395    screenLayoutPtr screens;
396    GDevPtr inactives;
397    InputInfoRec **inputs;      /* NULL terminated */
398    void *options;
399} serverLayoutRec, *serverLayoutPtr;
400
401typedef struct _confdribufferrec {
402    int count;
403    int size;
404    enum {
405        XF86DRI_WC_HINT = 0x0001        /* Placeholder: not implemented */
406    } flags;
407} confDRIBufferRec, *confDRIBufferPtr;
408
409typedef struct _confdrirec {
410    int group;
411    int mode;
412    int bufs_count;
413    confDRIBufferRec *bufs;
414} confDRIRec, *confDRIPtr;
415
416#define NUM_RESERVED_INTS		4
417#define NUM_RESERVED_POINTERS		4
418#define NUM_RESERVED_FUNCS		4
419
420/* let clients know they can use this */
421#define XF86_SCRN_HAS_PREFER_CLONE 1
422
423typedef void *(*funcPointer) (void);
424
425/* Power management events: so far we only support APM */
426
427typedef enum {
428    XF86_APM_UNKNOWN = -1,
429    XF86_APM_SYS_STANDBY,
430    XF86_APM_SYS_SUSPEND,
431    XF86_APM_CRITICAL_SUSPEND,
432    XF86_APM_USER_STANDBY,
433    XF86_APM_USER_SUSPEND,
434    XF86_APM_STANDBY_RESUME,
435    XF86_APM_NORMAL_RESUME,
436    XF86_APM_CRITICAL_RESUME,
437    XF86_APM_LOW_BATTERY,
438    XF86_APM_POWER_STATUS_CHANGE,
439    XF86_APM_UPDATE_TIME,
440    XF86_APM_CAPABILITY_CHANGED,
441    XF86_APM_STANDBY_FAILED,
442    XF86_APM_SUSPEND_FAILED
443} pmEvent;
444
445typedef enum {
446    PM_WAIT,
447    PM_CONTINUE,
448    PM_FAILED,
449    PM_NONE
450} pmWait;
451
452typedef struct _PciChipsets {
453    /**
454     * Key used to match this device with its name in an array of
455     * \c SymTabRec.
456     */
457    int numChipset;
458
459    /**
460     * This value is quirky.  Depending on the driver, it can take on one of
461     * three meanings.  In drivers that have exactly one vendor ID (e.g.,
462     * radeon, mga, i810) the low 16-bits are the device ID.
463     *
464     * In drivers that can have multiple vendor IDs (e.g., the glint driver
465     * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
466     * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
467     * the high 16-bits are the vendor ID.
468     *
469     * In drivers that don't have a specific vendor (e.g., vga) contains the
470     * device ID for either the generic VGA or generic 8514 devices.  This
471     * turns out to be the same as the subclass and programming interface
472     * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
473     * 0x000101) and for 8514 is 0x030001).
474     */
475    int PCIid;
476
477/* dummy place holders for drivers to build against old/new servers */
478#define RES_UNDEFINED NULL
479#define RES_EXCLUSIVE_VGA NULL
480#define RES_SHARED_VGA NULL
481    void *dummy;
482} PciChipsets;
483
484/* Entity properties */
485typedef void (*EntityProc) (int entityIndex, void *private);
486
487typedef struct _entityInfo {
488    int index;
489    BusRec location;
490    int chipset;
491    Bool active;
492    GDevPtr device;
493    DriverPtr driver;
494} EntityInfoRec, *EntityInfoPtr;
495
496/* DGA */
497
498typedef struct {
499    int num;                    /* A unique identifier for the mode (num > 0) */
500    DisplayModePtr mode;
501    int flags;                  /* DGA_CONCURRENT_ACCESS, etc... */
502    int imageWidth;             /* linear accessible portion (pixels) */
503    int imageHeight;
504    int pixmapWidth;            /* Xlib accessible portion (pixels) */
505    int pixmapHeight;           /* both fields ignored if no concurrent access */
506    int bytesPerScanline;
507    int byteOrder;              /* MSBFirst, LSBFirst */
508    int depth;
509    int bitsPerPixel;
510    unsigned long red_mask;
511    unsigned long green_mask;
512    unsigned long blue_mask;
513    short visualClass;
514    int viewportWidth;
515    int viewportHeight;
516    int xViewportStep;          /* viewport position granularity */
517    int yViewportStep;
518    int maxViewportX;           /* max viewport origin */
519    int maxViewportY;
520    int viewportFlags;          /* types of page flipping possible */
521    int offset;                 /* offset into physical memory */
522    unsigned char *address;     /* server's mapped framebuffer */
523    int reserved1;
524    int reserved2;
525} DGAModeRec, *DGAModePtr;
526
527typedef struct {
528    DGAModePtr mode;
529    PixmapPtr pPix;
530} DGADeviceRec, *DGADevicePtr;
531
532/*
533 * Flags for driver Probe() functions.
534 */
535#define PROBE_DEFAULT	  0x00
536#define PROBE_DETECT	  0x01
537#define PROBE_TRYHARD	  0x02
538
539/*
540 * Driver entry point types
541 */
542
543typedef Bool xf86ProbeProc(DriverPtr, int);
544typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
545typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
546typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr);
547typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int);
548typedef Bool xf86EnterVTProc(ScrnInfoPtr);
549typedef void xf86LeaveVTProc(ScrnInfoPtr);
550typedef void xf86FreeScreenProc(ScrnInfoPtr);
551typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
552typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
553typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
554typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
555typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int);
556typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool);
557typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
558typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
559typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
560typedef void xf86ModeSetProc(ScrnInfoPtr);
561
562/*
563 * ScrnInfoRec
564 *
565 * There is one of these for each screen, and it holds all the screen-specific
566 * information.  Note: No fields are to be dependent on compile-time defines.
567 */
568
569typedef struct _ScrnInfoRec {
570    int driverVersion;
571    const char *driverName;     /* canonical name used in */
572    /* the config file */
573    ScreenPtr pScreen;          /* Pointer to the ScreenRec */
574    int scrnIndex;              /* Number of this screen */
575    Bool configured;            /* Is this screen valid */
576    int origIndex;              /* initial number assigned to
577                                 * this screen before
578                                 * finalising the number of
579                                 * available screens */
580
581    /* Display-wide screenInfo values needed by this screen */
582    int imageByteOrder;
583    int bitmapScanlineUnit;
584    int bitmapScanlinePad;
585    int bitmapBitOrder;
586    int numFormats;
587    PixmapFormatRec formats[MAXFORMATS];
588    PixmapFormatRec fbFormat;
589
590    int bitsPerPixel;           /* fb bpp */
591    int depth;                  /* depth of default visual */
592    MessageType depthFrom;      /* set from config? */
593    MessageType bitsPerPixelFrom;       /* set from config? */
594    rgb weight;                 /* r/g/b weights */
595    rgb mask;                   /* rgb masks */
596    rgb offset;                 /* rgb offsets */
597    int rgbBits;                /* Number of bits in r/g/b */
598    Gamma gamma;                /* Gamma of the monitor */
599    int defaultVisual;          /* default visual class */
600    int virtualX;               /* Virtual width */
601    int virtualY;               /* Virtual height */
602    int xInc;                   /* Horizontal timing increment */
603    int displayWidth;           /* memory pitch */
604    int frameX0;                /* viewport position */
605    int frameY0;
606    int frameX1;
607    int frameY1;
608    int zoomLocked;             /* Disallow mode changes */
609    DisplayModePtr modePool;    /* list of compatible modes */
610    DisplayModePtr modes;       /* list of actual modes */
611    DisplayModePtr currentMode; /* current mode
612                                 * This was previously
613                                 * overloaded with the modes
614                                 * field, which is a pointer
615                                 * into a circular list */
616    confScreenPtr confScreen;   /* Screen config info */
617    MonPtr monitor;             /* Monitor information */
618    DispPtr display;            /* Display information */
619    int *entityList;            /* List of device entities */
620    int numEntities;
621    int widthmm;                /* physical display dimensions
622                                 * in mm */
623    int heightmm;
624    int xDpi;                   /* width DPI */
625    int yDpi;                   /* height DPI */
626    const char *name;           /* Name to prefix messages */
627    void *driverPrivate;        /* Driver private area */
628    DevUnion *privates;         /* Other privates can hook in
629                                 * here */
630    DriverPtr drv;              /* xf86DriverList[] entry */
631    void *module;               /* Pointer to module head */
632    int colorKey;
633    int overlayFlags;
634
635    /* Some of these may be moved out of here into the driver private area */
636
637    const char *chipset;        /* chipset name */
638    const char *ramdac;         /* ramdac name */
639    const char *clockchip;      /* clock name */
640    Bool progClock;             /* clock is programmable */
641    int numClocks;              /* number of clocks */
642    int clock[MAXCLOCKS];       /* list of clock frequencies */
643    int videoRam;               /* amount of video ram (kb) */
644    unsigned long memPhysBase;  /* Physical address of FB */
645    unsigned long fbOffset;     /* Offset of FB in the above */
646    void *options;
647
648    /* Allow screens to be enabled/disabled individually */
649    Bool vtSema;
650
651    /* hw cursor moves from input thread */
652    Bool silkenMouse;
653
654    /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
655    ClockRangePtr clockRanges;
656    int adjustFlags;
657
658    /* initial rightof support disable */
659    int                 preferClone;
660
661    Bool is_gpu;
662    uint32_t capabilities;
663
664    int *entityInstanceList;
665    struct pci_device *vgaDev;
666
667    /*
668     * Driver entry points.
669     *
670     */
671
672    xf86ProbeProc *Probe;
673    xf86PreInitProc *PreInit;
674    xf86ScreenInitProc *ScreenInit;
675    xf86SwitchModeProc *SwitchMode;
676    xf86AdjustFrameProc *AdjustFrame;
677    xf86EnterVTProc *EnterVT;
678    xf86LeaveVTProc *LeaveVT;
679    xf86FreeScreenProc *FreeScreen;
680    xf86ValidModeProc *ValidMode;
681    xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
682    xf86SetDGAModeProc *SetDGAMode;
683    xf86ChangeGammaProc *ChangeGamma;
684    xf86PointerMovedProc *PointerMoved;
685    xf86PMEventProc *PMEvent;
686    xf86DPMSSetProc *DPMSSet;
687    xf86LoadPaletteProc *LoadPalette;
688    xf86SetOverscanProc *SetOverscan;
689    xorgDriverFuncProc *DriverFunc;
690    xf86ModeSetProc *ModeSet;
691
692    int reservedInt[NUM_RESERVED_INTS];
693    void *reservedPtr[NUM_RESERVED_POINTERS];
694    funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
695} ScrnInfoRec;
696
697typedef struct {
698    Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,
699                             char **name,
700                             unsigned char **mem,
701                             int *size, int *offset, int *extra);
702    void (*CloseFramebuffer) (ScrnInfoPtr pScrn);
703    Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode);
704    void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags);
705    int (*GetViewport) (ScrnInfoPtr pScrn);
706    void (*Sync) (ScrnInfoPtr);
707    void (*FillRect) (ScrnInfoPtr pScrn,
708                      int x, int y, int w, int h, unsigned long color);
709    void (*BlitRect) (ScrnInfoPtr pScrn,
710                      int srcx, int srcy, int w, int h, int dstx, int dsty);
711    void (*BlitTransRect) (ScrnInfoPtr pScrn,
712                           int srcx, int srcy,
713                           int w, int h,
714                           int dstx, int dsty, unsigned long color);
715} DGAFunctionRec, *DGAFunctionPtr;
716
717typedef struct _SymTabRec {
718    int token;                  /* id of the token */
719    const char *name;           /* token name */
720} SymTabRec, *SymTabPtr;
721
722/* flags for xf86LookupMode */
723typedef enum {
724    LOOKUP_DEFAULT = 0,         /* Use default mode lookup method */
725    LOOKUP_BEST_REFRESH,        /* Pick modes with best refresh */
726    LOOKUP_CLOSEST_CLOCK,       /* Pick modes with the closest clock */
727    LOOKUP_LIST_ORDER,          /* Pick first useful mode in list */
728    LOOKUP_CLKDIV2 = 0x0100,    /* Allow half clocks */
729    LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
730} LookupModeFlags;
731
732#define NoDepth24Support	0x00
733#define Support24bppFb		0x01    /* 24bpp framebuffer supported */
734#define Support32bppFb		0x02    /* 32bpp framebuffer supported */
735#define SupportConvert24to32	0x04    /* Can convert 24bpp pixmap to 32bpp */
736#define SupportConvert32to24	0x08    /* Can convert 32bpp pixmap to 24bpp */
737#define PreferConvert24to32	0x10    /* prefer 24bpp pixmap to 32bpp conv */
738#define PreferConvert32to24	0x20    /* prefer 32bpp pixmap to 24bpp conv */
739
740/* For DPMS */
741typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
742
743/* Input handler proc */
744typedef void (*InputHandlerProc) (int fd, void *data);
745
746/* These are used by xf86GetClocks */
747#define CLK_REG_SAVE		-1
748#define CLK_REG_RESTORE		-2
749
750/*
751 * misc constants
752 */
753#define INTERLACE_REFRESH_WEIGHT	1.5
754#define SYNC_TOLERANCE		0.01    /* 1 percent */
755#define CLOCK_TOLERANCE		2000    /* Clock matching tolerance (2MHz) */
756
757#define OVERLAY_8_32_DUALFB	0x00000001
758#define OVERLAY_8_24_DUALFB	0x00000002
759#define OVERLAY_8_16_DUALFB	0x00000004
760#define OVERLAY_8_32_PLANAR	0x00000008
761
762/* Values of xf86Info.mouseFlags */
763#define MF_CLEAR_DTR       1
764#define MF_CLEAR_RTS       2
765
766/* Action Events */
767typedef enum {
768    ACTION_TERMINATE = 0,       /* Terminate Server */
769    ACTION_NEXT_MODE = 10,      /* Switch to next video mode */
770    ACTION_PREV_MODE,
771    ACTION_SWITCHSCREEN = 100,  /* VT switch */
772    ACTION_SWITCHSCREEN_NEXT,
773    ACTION_SWITCHSCREEN_PREV,
774} ActionEvent;
775
776#endif                          /* _XF86STR_H */
777