xserver

xserver with xephyr scale patch
git clone https://git.neptards.moe/u3shit/xserver.git
Log | Files | Refs | README | LICENSE

xf86str.h (23784B)


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