(file) Return to xf86str.h CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / hw / xfree86 / common

File: [XFree86 CVS] / xc / programs / Xserver / hw / xfree86 / common / xf86str.h (download)
Revision: 1.1.2.35, Sat Apr 18 10:38:43 1998 UTC (15 years, 2 months ago) by dawes
Branch: xf-3_9j-branch
CVS Tags: xf-3_9ji, xf-3_9jh, xf-3_9jg, xf-3_9jf
Changes since 1.1.2.34: +11 -2 lines
Most recent set of changes from Marc, including the mibank code.

/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.1.2.34 1998/02/01 10:49:38 dawes Exp $ */

/*
 * Copyright (c) 1997 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 "xf86Option.h"
#include "xf86Module.h"


/* 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_HSKEW	= 0x0200,	/* hskew provided */
    V_PIXMUX	= 0x1000,
    V_DBLCLK	= 0x2000,
    V_CLKDIV2	= 0x4000
} ModeFlags;

typedef enum {
    INTERLACE_HALVE_V	= 0x0001	/* Halve V values for interlacing */
} CrtcAdjustFlags;


/* 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_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,		/* unspecified reason */
    MODE_ERROR	= -1	/* error condition */
} ModeStatus;

/* Video mode */

typedef struct _DisplayModeRec {
    struct _DisplayModeRec *	prev;
    struct _DisplayModeRec *	next;
    char *			name;		/* identifier for the mode */
    ModeStatus			status;

    /* These are the values that the user sees/provides */
    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				Flags;

  /* These are the values the hardware uses */
    int				ClockIndex;
    int				SynthClock;	/* Actual clock freq to
					  	 * be programmed */
    int				CrtcHDisplay;
    int				CrtcHSyncStart;
    int				CrtcHSyncEnd;
    int				CrtcHTotal;
    int				CrtcHSkew;
    int				CrtcVDisplay;
    int				CrtcVSyncStart;
    int				CrtcVSyncEnd;
    int				CrtcVTotal;
    Bool			CrtcHAdjusted;
    Bool			CrtcVAdjusted;
    int				PrivSize;
    INT32 *			Private;
} DisplayModeRec, *DisplayModePtr;

/* The monitor description */

#define MAX_HSYNC 8
#define MAX_VREFRESH 8

typedef struct { float hi, lo; } range;

typedef struct { CARD32 red, green, blue; } rgb;

typedef struct { float red, green, blue; } Gamma;

typedef struct {
    char *		id;
    char *		vendor;
    char *		model;
    int			dpmsSupport;
    int			nHsync;
    range		hsync[MAX_HSYNC];       
    int			nVrefresh;                  
    range		vrefresh[MAX_VREFRESH];
    DisplayModePtr	Modes;		/* Start of the monitor's mode list */
    DisplayModePtr	Last;		/* End of the monitor's mode list */
    Gamma		gamma;
} MonRec, *MonPtr;

/* the list of clock ranges */
typedef struct x_ClockRange {
    struct x_ClockRange *next;
    int			minClock;
    int			maxClock;
    int			clockIndex;	/* -1 for programmable clocks */
    Bool		interlaceAllowed;
    Bool		doubleScanAllowed;
} ClockRange, *ClockRangePtr;

/* Public bus-related types */

/* A crude attempt to characterise ISA/VLB types */
typedef enum {
    ISA_COLOR,
    ISA_MONO,
    ISA_OTHER
} IsaBusType;

/* Differnet PCI video cards */
typedef enum {
    PCI_ONLY,
    PCI_VGA,
    PCI_SHARED_VGA
} PciBusType;


#define MAXCLOCKS   128
typedef enum {
    DAC_BPP8 = 0,
    DAC_BPP16,
    DAC_BPP24,
    DAC_BPP32,
    MAXDACSPEEDS
} DacSpeedIndex;
 
typedef struct {
   char *identifier;
   char *vendor;
   char *board;
   char *chipset;
   char *ramdac;
   char *driver;
   struct _confscreenrec *myScreenSection;
   Bool claimed;
   int dacSpeeds[MAXDACSPEEDS];
   int numclocks;
   int clock[MAXCLOCKS];
   char *clockchip;
   char *busID;
   OFlagSet options;
   OFlagSet clockOptions;
   OFlagSet xconfigFlag;
   int videoRam;
#if 0
   unsigned long speedup;
#endif
#if 0
   char *clockprog;
#endif
   int textClockValue;
   int BiosBase;                 /* Base address of video BIOS */
   unsigned long MemBase;        /* Frame buffer base address */
   unsigned long IOBase;
#if 0
   unsigned int  DACBase;
   unsigned long COPBase;
   unsigned int  POSBase;
   int instance;
   int s3Madjust;
   int s3Nadjust;
   int s3MClk;
#endif
   int chipID;
   int chipRev;
   unsigned long VGABase;      /* VGA ot XGA 64K aperture base address */
#if 0
   int s3RefClk;
   int s3BlankDelay;
   char *DCConfig;
   char *DCOptions;
#endif
   int MemClk;                 /* General flag used for memory clocking */
} GDevRec, *GDevPtr;

typedef struct {
    int			vendor;
    int			chipType;
    int			chipRev;
    int			bus;
    int			device;
    int			func;
    unsigned long	memBase[6];
    unsigned long	ioBase[6];
    unsigned long	biosBase;
    pointer		thisCard;
} pciVideoRec, *pciVideoPtr;

typedef struct {
    int                  frameX0;
    int                  frameY0;
    int                  virtualX;
    int                  virtualY;
    int                  depth;
    int                  bpp;
    rgb                  weight;
    int                  defaultVisual;
    char **              modes;
} DispRec, *DispPtr;

typedef struct _confscreenrec {
    char *               id;
    int                  colordepth;
    MonPtr               monitor;
    GDevPtr              device;
    int                  numdisplays;
    DispPtr              displays;
} confScreenRec, *confScreenPtr;

typedef struct _screenlayoutrec {
    confScreenPtr        screen;
    confScreenPtr        top;
    confScreenPtr        bottom;
    confScreenPtr        left;
    confScreenPtr        right;
} screenLayoutRec, *screenLayoutPtr;

/* These values should be adjusted when new fields are added to ScrnInfoRec */
#define NUM_RESERVED_INTS		16
#define NUM_RESERVED_POINTERS		16
#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 */
} MessageType;

/*
 * 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 complie-time defines.
 */

typedef struct _ScrnInfoRec {
    int			driverVersion;
    char *              driverName;             /* canonical name used in */
                                                /* the config file */   
    ScreenPtr		pScreen;		/* Pointer to the ScreenRec */
    int			scrnIndex;		/* Number of this screen */
    Bool		configured;		/* Is this screen valid */ 
    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;
    PixmapFormatRec	formats[MAXFORMATS];

    int			bitsPerPixel;		/* bpp for default visual */
    int			depth;			/* depth of default visual */
    rgb			weight;			/* r/g/b weights */
    rgb			mask;			/* rgb masks */
    rgb			offset;			/* rgb offsets */
    int			rgbBits;		/* Number of bits in r/g/b */
    Gamma		gamma;			/* Gamma correction */
    int			defaultVisual;		/* default visual class */
    int			maxHValue;		/* max horizontal timing */
    int			maxVValue;		/* max vertical timing  value */
    int			virtualX;		/* Virtual width */
    int			virtualY; 		/* Virtual height */
    MessageType		virtualFrom;		/* set from config? */
    int			displayWidth;		/* memory pitch */
    int			frameX0;		/* viewport position */
    int			frameY0;
    int			frameX1;
    int			frameY1;
    int			zoomLocked;		/* Disallow mode changes */
    DisplayModePtr	modePool;		/* list of compatible modes */
    DisplayModePtr	modes;			/* list of actual modes */
    DisplayModePtr	currentMode;		/* current mode
						 * This was previously
						 * overloaded with the modes
						 * field, which is a pointer
						 * into a circular list */
    confScreenPtr	confScreen;		/* Screen config info */
    MonPtr		monitor;		/* Monitor information */
    GDevPtr		device;			/* device information */
    DispPtr		display;		/* Display information */
    int			widthmm;		/* physical display dimensions
						 * in mm */
    int			heightmm;
    char *		name;			/* Name to prefix messages */
    pointer		driverPrivate;		/* Driver private area */
    int			numPrivates;		/* Number of privates */
    DevUnion *		privates;		/* Other privates can hook in
						 * here */

    char **		requiredModules;	/* List of modules needed */

    /* Some of these may be moved out of here into the driver private area */

    OFlagSet		options;		/* Option flags */
    char *		chipset;		/* chipset name */
    char *		ramdac;			/* ramdac name */
    char *		clockchip;		/* clock name */
    Bool		progClock;		/* clock is programmable */
    int			dacSpeeds[MAXDACSPEEDS];/* list of clock limits */
    int			numClocks;		/* number of clocks */
    int			clock[MAXCLOCKS];	/* list of clock frequencies */
    int			minClock;		/* min clock frequency */
    int			maxClock;		/* max clock frequency */
    ClockRangePtr	clockRanges;		/* clock ranges */
    int			videoRam;		/* amount of video ram (kb) */
    unsigned long	biosBase;		/* Base address of video BIOS */
    unsigned long	memBase;		/* Frame buffer base address */
#if 0 /* This should go */
    unsigned long	speedup;		/* Use SpeedUp code */
#endif
    int			memClk;			/* memory clock */
    int			textClockFreq;		/* clock of text mode */

    Bool		bankedMono;
    rgb			blackColour;
    rgb			whiteColour;

#if 0 /* Out of date (obsoleted with the new parser code) */
    int *		validTokens;
#endif

    int			chipID;
    int			chipRev;

    /* This is here to allow for DGA to be enabled on a single screen. */
    Bool		vtSema;

    /* Keep track of the DGA state */
    Bool		DGAActive;
    int			DGAFlags;

#if 0
    /* These definitely belong in the driver private area */
    unsigned int	IObase;	   /* AGX - video card I/O reg base        */
    unsigned int	DACbase;   /* AGX - dac I/O reg base               */
    unsigned long	COPbase;   /* AGX - coprocessor memory base        */
    unsigned int	POSbase;   /* AGX - I/O address of POS regs        */
    int			instance;  /* AGX - XGA video card instance number */
    unsigned long	VGAbase;   /* AGX - 64K aperture memory address    */
    int			s3Madjust;
    int			s3Nadjust;
    int			s3MClk;
    int			s3RefClk;
    int			s3BlankDelay;
#endif

    int			reservedInt[NUM_RESERVED_INTS];
    pointer		reservedPtr[NUM_RESERVED_POINTERS];

    /*
     * Driver entry points.
     *
     * All of the mandatory entry points are here, even though some don't
     * need to be accessed through this structure (for example if they
     * are registered directly through pScreen).
     *
     * The mandatory ones are: Probe, PreInit, ScreenInit, EnterVT,
     * LeaveVT, CloseScreen, SaveScreen.
     */

    Bool		(*ParseConfig)(/* undecided */);
    Bool		(*Probe)(int flags);
    Bool		(*PreInit)(struct _ScrnInfoRec *pScrn, int flags);
    Bool		(*ScreenInit)(int scrnIndex, ScreenPtr pScreen,
				      int argc, char **argv);
    Bool		(*SwitchMode)(int scrnIndex, DisplayModePtr mode,
				      int flags);
    void		(*AdjustFrame)(int scrnIndex, int x, int y, int flags);
    void		(*EnterVT)(int scrnIndex, int flags);
    void		(*LeaveVT)(int scrnIndex, int flags);
    CloseScreenProcPtr	CloseScreen;
    void		(*FreeScreen)(int scrnIndex, int flags);
    int			(*ValidMode)(int scrnIndex, DisplayModePtr mode,
				     Bool verbose, int flags);
    SaveScreenProcPtr	SaveScreen;

    /* For DPMS */
    void		(*DPMSSet)(int scrnIndex, int level, int flags);

    /* For DGA */
    Bool                (*GetDGAParameters)(int scrnIndex,
					    unsigned long *physBase,
					    int *physSize, int *memSize);
    Bool		(*DGASetDirectMode)(int scrnIndex, Bool on);
    void		(*DGASetBank)(int scrnIndex, int bank, int flags);

    funcPointer		reservedFuncs[NUM_RESERVED_FUNCS];

} ScrnInfoRec, *ScrnInfoPtr;

/*
 * The driver list struct.  This contains the information required for each
 * driver before a ScrnInfoRec has been allocated.
 */
typedef struct {
    int			driverVersion;
    char *		driverName;
    void		(*Identify)(int flags);
    Bool		(*ParseConfig)(/*ParseInfoPtr raw*/);
    Bool		(*Probe)(int flags);
    pointer		parseInfo;	/* Driver-specific parsed info */
} DriverRec, *DriverPtr;


/* These are the possible flags for ValidMode */
typedef enum {
    MODE_USED,		/* this mode is really being used in the */
			/* modes line of the Display Subsection  */
    MODE_SUGGESTED,	/* this mode is included in the available*/
			/* modes in the Monitor Section */
    MODE_VID		/* this is called from the VidMode extension */
} ValidModeFlags;

/* flags for xf86SaveRestoreImage */
typedef enum {
    SaveImage,
    RestoreImage,
    FreeImage
} SaveRestoreFlags;

/* 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 */
} LookupModeFlags;

/*
 * mouse protocol types
 */
typedef enum {
    PROT_MS			= 0,	/* Microsoft */
    PROT_MSC,				/* Mouse Systems Corp */
    PROT_MM,				/* MMseries */
    PROT_LOGI,				/* Logitech */
    PROT_BM,				/* BusMouse ??? */
    PROT_LOGIMAN,			/* MouseMan / TrackMan */
    PROT_PS2,				/* PS/2 mouse */
    PROT_MMHIT,				/* MM_HitTab */
    PROT_GLIDEPOINT,			/* ALPS GlidePoint */
    PROT_MSINTELLIMOUSE,		/* Microsoft IntelliMouse */
    NUM_PROTOCOLS			/* MUST BE LAST */
} MouseProtocol;

/*
 * keyboard specialKeyMap paramters
 */
typedef enum {
    K_INDEX_LEFTALT	= 0,
    K_INDEX_RIGHTALT,
    K_INDEX_SCROLLLOCK,
    K_INDEX_RIGHTCTL,
    NUM_KEYMAP_TYPES
} KeymapIndex;

typedef enum {
    KM_META		= 0,
    KM_COMPOSE,
    KM_MODESHIFT,
    KM_MODELOCK,
    KM_SCROLLLOCK,
    KM_CONTROL
} KeymapKey;


/*
 * misc constants
 */
#define INTERLACE_REFRESH_WEIGHT	1.5
#define SYNC_TOLERANCE		0.01	/* 1 percent */
#define CLOCK_TOLERANCE		2000	/* Clock matching tolerance (2MHz) */

#define LD_RESOLV_IFDONE		0	/* only check if no more 
						   delays pending */
#define LD_RESOLV_NOW			1	/* finish one delay step */
#define LD_RESOLV_FORCE			2	/* force checking... */

#endif /* _XF86STR_H */

Powered by
ViewCVS 0.9.2