xf86str.h revision a2760a4d593af57a19ec32cdfd1723b68495df8c
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.83 2001/11/30 12:11:55 eich Exp $ */
/*
* Copyright (c) 1997-2000 by The XFree86 Project, Inc.
*/
/*
* This file contains definitions of the public XFree86 data structures/types.
* Any data structures that video drivers need to access should go here.
*/
#ifndef _XF86STR_H
#define _XF86STR_H
#include "misc.h"
#include "input.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "xf86Module.h"
#include "xf86Opt.h"
/*
* memType is of the size of the addressable memory (machine size)
* usually unsigned long.
*/
typedef unsigned long memType;
/* Video mode flags */
typedef enum {
V_PHSYNC = 0x0001,
V_NHSYNC = 0x0002,
V_PVSYNC = 0x0004,
V_NVSYNC = 0x0008,
V_INTERLACE = 0x0010,
V_DBLSCAN = 0x0020,
V_CSYNC = 0x0040,
V_PCSYNC = 0x0080,
V_NCSYNC = 0x0100,
V_BCAST = 0x0400,
V_PIXMUX = 0x1000,
V_DBLCLK = 0x2000,
V_CLKDIV2 = 0x4000
} ModeFlags;
typedef enum {
/* Flags passed to ChipValidMode() */
typedef enum {
MODECHECK_INITIAL = 0,
MODECHECK_FINAL = 1
/* These are possible return values for xf86CheckMode() and ValidMode() */
typedef enum {
MODE_OK = 0, /* Mode OK */
MODE_HSYNC, /* hsync out of range */
MODE_VSYNC, /* vsync out of range */
MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
MODE_BAD_WIDTH, /* requires an unsupported linepitch */
MODE_NOMODE, /* no mode with a maching name */
MODE_NO_INTERLACE, /* interlaced mode not supported */
MODE_NO_DBLESCAN, /* doublescan mode not supported */
MODE_NO_VSCAN, /* multiscan mode not supported */
MODE_MEM, /* insufficient video memory */
MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
MODE_MEM_VIRT, /* insufficient video memory given virtual size */
MODE_NOCLOCK, /* no fixed clock available */
MODE_CLOCK_HIGH, /* clock required is too high */
MODE_CLOCK_LOW, /* clock required is too low */
MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
MODE_BAD_HVALUE, /* horizontal timing was out of range */
MODE_BAD_VVALUE, /* vertical timing was out of range */
MODE_BAD_VSCAN, /* VScan value out of range */
MODE_HSYNC_NARROW, /* horizontal sync too narrow */
MODE_HSYNC_WIDE, /* horizontal sync too wide */
MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
MODE_HBLANK_WIDE, /* horizontal blanking too wide */
MODE_VSYNC_NARROW, /* vertical sync too narrow */
MODE_VSYNC_WIDE, /* vertical sync too wide */
MODE_VBLANK_NARROW, /* vertical blanking too narrow */
MODE_VBLANK_WIDE, /* vertical blanking too wide */
MODE_PANEL, /* exceeds panel dimensions */
MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
MODE_ONE_WIDTH, /* only one width is supported */
MODE_ONE_HEIGHT, /* only one height is supported */
MODE_ONE_SIZE, /* only one resolution is supported */
} ModeStatus;
/* built-in mode - configure CRTC and clock */
/* Video mode */
typedef struct _DisplayModeRec {
struct _DisplayModeRec * prev;
struct _DisplayModeRec * next;
char * name; /* identifier for the mode */
int type;
int Clock; /* pixel clock freq */
int HDisplay; /* horizontal timing */
int HSyncStart;
int HSyncEnd;
int HTotal;
int HSkew;
int VDisplay; /* vertical timing */
int VSyncStart;
int VSyncEnd;
int VTotal;
int VScan;
int Flags;
/* These are the values the hardware uses */
int ClockIndex;
int SynthClock; /* Actual clock freq to
* be programmed */
int CrtcHDisplay;
int CrtcHBlankStart;
int CrtcHSyncStart;
int CrtcHSyncEnd;
int CrtcHBlankEnd;
int CrtcHTotal;
int CrtcHSkew;
int CrtcVDisplay;
int CrtcVBlankStart;
int CrtcVSyncStart;
int CrtcVSyncEnd;
int CrtcVBlankEnd;
int CrtcVTotal;
int PrivSize;
int PrivFlags;
/* The monitor description */
#define MAX_HSYNC 8
#define MAX_VREFRESH 8
/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
#define GAMMA_MAX 10.0
typedef struct {
char * id;
char * vendor;
char * model;
int nHsync;
int nVrefresh;
int widthmm;
int heightmm;
/* the list of clock ranges */
typedef struct x_ClockRange {
struct x_ClockRange *next;
int minClock;
int maxClock;
int clockIndex; /* -1 for programmable clocks */
int ClockMulFactor;
int ClockDivFactor;
int PrivFlags;
} ClockRange, *ClockRangePtr;
/* Need to store the strategy with clockRange for VidMode extension */
typedef struct x_ClockRanges {
struct x_ClockRanges *next;
int minClock;
int maxClock;
int clockIndex; /* -1 for programmable clocks */
int ClockMulFactor;
int ClockDivFactor;
int PrivFlags;
int strategy;
/*
* The driver list struct. This contains the information required for each
* driver before a ScrnInfoRec has been allocated.
*/
typedef struct _DriverRec {
int driverVersion;
char * driverName;
int refCount;
#ifdef XFree86LOADER
/*
* The optional module list struct. This allows modules exporting helping
* functions to configuration tools, the Xserver, or any other
* application/module interested in such information.
*/
typedef struct _ModuleInfoRec {
int moduleVersion;
char * moduleName;
int refCount;
#endif
/*
* These are the private bus types. New types can be added here. Types
* required for the public interface should be added to xf86str.h, with
* function prototypes added to xf86.h.
*/
typedef enum {
BUS_last /* Keep last */
} BusType;
typedef struct {
int bus;
int device;
int func;
} PciBusId;
typedef struct {
unsigned int dummy;
} IsaBusId;
typedef struct {
int fbNum;
} SbusBusId;
typedef struct _bus {
union {
} id;
#define MAXCLOCKS 128
typedef enum {
DAC_BPP8 = 0,
typedef struct {
char * identifier;
char * vendor;
char * board;
char * chipset;
char * ramdac;
char * driver;
struct _confscreenrec * myScreenSection;
int dacSpeeds[MAXDACSPEEDS];
int numclocks;
char * clockchip;
char * busID;
int videoRam;
int textClockFreq;
unsigned long BiosBase; /* Base address of video BIOS */
unsigned long MemBase; /* Frame buffer base address */
unsigned long IOBase;
int chipID;
int chipRev;
int irq;
int screen; /* For multi-CRTC cards */
typedef struct {
char * identifier;
char * driver;
typedef struct {
int vendor;
int chipType;
int chipRev;
int subsysVendor;
int subsysCard;
int bus;
int device;
int func;
int class;
int subclass;
int interface;
int size[6];
unsigned char type[6];
int biosSize;
} pciVideoRec, *pciVideoPtr;
typedef struct {
int frameX0;
int frameY0;
int virtualX;
int virtualY;
int depth;
int fbbpp;
int defaultVisual;
char ** modes;
typedef struct _confxvportrec {
char * identifier;
typedef struct _confxvadaptrec {
char * identifier;
int numports;
typedef struct _confscreenrec {
char * id;
int screennum;
int defaultdepth;
int defaultbpp;
int defaultfbbpp;
int numdisplays;
int numxvadaptors;
typedef enum {
PosObsolete = -1,
PosAbsolute = 0,
} PositionType;
typedef struct _screenlayoutrec {
char * topname;
char * bottomname;
char * leftname;
char * rightname;
int x;
int y;
char * refname;
typedef struct _serverlayoutrec {
char * id;
typedef struct _confdribufferrec {
int count;
int size;
enum {
} flags;
typedef struct _confdrirec {
int group;
int mode;
int bufs_count;
} confDRIRec, *confDRIPtr;
/* These values should be adjusted when new fields are added to ScrnInfoRec */
#define NUM_RESERVED_INTS 16
#define NUM_RESERVED_POINTERS 15
#define NUM_RESERVED_FUNCS 16
typedef pointer (*funcPointer)(void);
/* Flags for driver messages */
typedef enum {
X_PROBED, /* Value was probed */
X_CONFIG, /* Value was given in the config file */
X_DEFAULT, /* Value is a default */
X_CMDLINE, /* Value was given on the command line */
X_NOTICE, /* Notice */
X_ERROR, /* Error message */
X_WARNING, /* Warning message */
X_INFO, /* Informational message */
X_NONE, /* No prefix */
X_NOT_IMPLEMENTED /* Not implemented */
} MessageType;
/* flags for depth 24 pixmap options */
typedef enum {
Pix24DontCare = 0,
} Pix24Flags;
/* Power management events: so far we only support APM */
typedef enum {
XF86_APM_UNKNOWN = -1,
} pmEvent;
typedef enum {
} pmWait;
/*
* The IO access enabler struct. This contains the address for
* with a pointer to data needed by them
*/
typedef struct _AccessRec {
void (*AccessDisable)(void *arg);
void (*AccessEnable)(void *arg);
void *arg;
typedef struct {
/* bus-access-related types */
typedef enum {
NONE,
IO,
} resType;
typedef struct _EntityAccessRec {
struct _EntityAccessRec *next;
typedef struct _CurrAccRec {
/* new RAC */
/* Resource Type values */
#define ResNone ((unsigned long)(-1))
#define ResMem 0x0001
#define ResIo 0x0002
#define ResIrq 0x0003
#define ResDma 0x0004
#define ResPhysMask 0x000F
#define ResExclusive 0x0010
#define ResShared 0x0020
#define ResAny 0x0040
#define ResAccMask 0x0070
#define ResUnused 0x0080
#define ResUnusedOpr 0x0100
#define ResDisableOpr 0x0200
#define ResOprMask 0x0300
#define ResBlock 0x0400
#define ResSparse 0x0800
#define ResExtMask 0x0C00
#define ResEstimated 0x1000
#define ResInit 0x2000
#define ResBios 0x4000
#define ResMiscMask 0xF000
#define ResBus 0x10000
#define ResDomain 0xff000000ul
typedef struct {
unsigned long type; /* shared, exclusive, unused etc. */
memType a;
memType b;
#define RANGE(r,u,v,t) {\
(r).a = (u);\
(r).b = (v);\
(r).type = (t);\
}
#define rBase a
#define rMask b
#define rBegin a
#define rEnd b
/* resource record */
typedef struct _resRec {
int entityIndex; /* who owns the resource */
} resRec;
typedef struct {
int numChipset;
} IsaChipsets;
typedef struct {
int numChipset;
int PCIid;
} PciChipsets;
/* Entity properties */
typedef struct _entityInfo {
int index;
int chipset;
/* server states */
typedef enum {
} xf86State;
typedef enum {
/* DGA */
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int offset; /* offset into physical memory */
unsigned char *address; /* server's mapped framebuffer */
int reserved1;
int reserved2;
} DGAModeRec, *DGAModePtr;
typedef struct {
} DGADeviceRec, *DGADevicePtr;
/*
* Flags for driver Probe() functions.
*/
#define PROBE_DEFAULT 0x00
#define PROBE_DETECT 0x01
#define PROBE_TRYHARD 0x02
/*
* Driver entry point types
*/
typedef struct _ScrnInfoRec *ScrnInfoPtr;
typedef void xf86AdjustFrameProc (int, int, int, int);
typedef Bool xf86EnterVTProc (int, int);
typedef void xf86LeaveVTProc (int, int);
typedef void xf86FreeScreenProc (int, int);
typedef void xf86EnableDisableFBAccessProc(int, Bool);
typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
typedef int xf86ChangeGammaProc (int, Gamma);
typedef void xf86PointerMovedProc (int, int, int);
/*
* ScrnInfoRec
*
* There is one of these for each screen, and it holds all the screen-specific
* information.
*
* Note: the size and layout must be kept the same across versions. New
* fields are to be added in place of the "reserved*" fields. No fields
* are to be dependent on compile-time defines.
*/
typedef struct _ScrnInfoRec {
int driverVersion;
char * driverName; /* canonical name used in */
/* the config file */
int scrnIndex; /* Number of this screen */
int origIndex; /* initial number assigned to
* this screen before
* finalising the number of
* available screens */
/* Display-wide screenInfo values needed by this screen */
int imageByteOrder;
int bitmapScanlineUnit;
int bitmapScanlinePad;
int bitmapBitOrder;
int numFormats;
int bitsPerPixel; /* fb bpp */
int depth; /* depth of default visual */
int rgbBits; /* Number of bits in r/g/b */
int defaultVisual; /* default visual class */
int maxHValue; /* max horizontal timing */
int maxVValue; /* max vertical timing value */
int virtualX; /* Virtual width */
int virtualY; /* Virtual height */
int xInc; /* Horizontal timing increment */
int displayWidth; /* memory pitch */
int frameX0; /* viewport position */
int frameY0;
int frameX1;
int frameY1;
int zoomLocked; /* Disallow mode changes */
* This was previously
* overloaded with the modes
* field, which is a pointer
* into a circular list */
int * entityList; /* List of device entities */
int numEntities;
int widthmm; /* physical display dimensions
* in mm */
int heightmm;
int xDpi; /* width DPI */
int yDpi; /* height DPI */
char * name; /* Name to prefix messages */
* here */
int colorKey;
int overlayFlags;
/* Some of these may be moved out of here into the driver private area */
char * chipset; /* chipset name */
char * ramdac; /* ramdac name */
char * clockchip; /* clock name */
int numClocks; /* number of clocks */
int videoRam; /* amount of video ram (kb) */
unsigned long biosBase; /* Base address of video BIOS */
unsigned long memPhysBase; /* Physical address of FB */
unsigned long fbOffset; /* Offset of FB in the above */
unsigned long ioBase; /* I/O or MMIO base adderss */
int memClk; /* memory clock */
int textClockFreq; /* clock of text mode */
int chipID;
int chipRev;
int racMemFlags;
int racIoFlags;
/* hw cursor moves at SIGIO time */
/* Storage for clockRanges and adjustFlags for use with the VidMode ext */
int adjustFlags;
/*
* These can be used when the minor ABI version is incremented.
* The NUM_* parameters must be reduced appropriately to keep the
* structure size and alignment unchanged.
*/
int reservedInt[NUM_RESERVED_INTS];
int * entityInstanceList;
/*
* Driver entry points.
*
*/
/*
* This can be used when the minor ABI version is incremented.
* The NUM_* parameter must be reduced appropriately to keep the
* structure size and alignment unchanged.
*/
} ScrnInfoRec;
typedef struct {
Bool (*OpenFramebuffer)(
char **name,
unsigned char **mem,
int *size,
int *offset,
int *extra
);
void (*Sync)(ScrnInfoPtr);
void (*FillRect)(
int x, int y, int w, int h,
unsigned long color
);
void (*BlitRect)(
int w, int h,
);
void (*BlitTransRect)(
int w, int h,
unsigned long color
);
typedef struct {
int token; /* id of the token */
const char * name; /* token name */
/* flags for xf86LookupMode */
typedef enum {
LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
#define NoDepth24Support 0x00
/* For DPMS */
typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
/* Input handler proc */
/* These are used by xf86GetClocks */
#define CLK_REG_SAVE -1
#define CLK_REG_RESTORE -2
/* xf86Debug.c */
#ifdef BUILDDEBUG
typedef struct {
long sec;
long usec;
#endif
/*
* misc constants
*/
#define INTERLACE_REFRESH_WEIGHT 1.5
#define OVERLAY_8_32_DUALFB 0x00000001
#define OVERLAY_8_24_DUALFB 0x00000002
#define OVERLAY_8_16_DUALFB 0x00000004
#define OVERLAY_8_32_PLANAR 0x00000008
#if 0
#define LD_RESOLV_IFDONE 0 /* only check if no more
delays pending */
#endif
#endif /* _XF86STR_H */