(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.39, Mon Jun 8 14:13:02 1998 UTC (15 years ago) by dawes
Branch: xf-3_9j-branch
Changes since 1.1.2.38: +1 -9 lines
Marc's recent patches, and a few other minor things.

/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.1.2.38 1998/06/03 15:49:58 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 "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;
    pointer		options;
} 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;
   int				videoRam;
#if 0	/* To be decided */
   int				textClockValue;
#endif
   int				BiosBase;	/* Base address of video BIOS */
   unsigned long		MemBase;	/* Frame buffer base address */
   unsigned long		IOBase;
   int				chipID;
   int				chipRev;
   unsigned long		VGABase;	/* VGA 64K aperture base */
   int				MemClk;		/* General flag used for
						   memory clocking */
   pointer			options;
} 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;
    pointer		options;
} DispRec, *DispPtr;

typedef struct _confscreenrec {
    char *		id;
    int			colordepth;
    MonPtr		monitor;
    GDevPtr		device;
    int			numdisplays;
    DispPtr		displays;
    pointer		options;
} 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 */

    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			videoRam;		/* amount of video ram (kb) */
    unsigned long	biosBase;		/* Base address of video BIOS */
    unsigned long	memBase;		/* Frame buffer base address */
    int			memClk;			/* memory clock */
#if 0	/* to be decided */
    int			textClockFreq;		/* clock of text mode */
#endif
    Bool		flipPixels;		/* swap default black/white */
    pointer		options;

    int			chipID;
    int			chipRev;

    /* Allow screens to be enabled/disabled individually */
    Bool		vtSema;

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

    /*
     * 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];
    pointer		reservedPtr[NUM_RESERVED_POINTERS];

    /*
     * Driver entry points.
     *
     */

    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);
    void		(*FreeScreen)(int scrnIndex, int flags);
    int			(*ValidMode)(int scrnIndex, DisplayModePtr mode,
				     Bool verbose, int flags);

	/* These belong in extension-specific private areas */
    /* 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);

    /*
     * 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.
     */
    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		(*Probe)(int flags);
} DriverRec, *DriverPtr;


typedef struct {
    int			token;		/* id of the token */
    const char *	name;		/* token name */
} SymTabRec, *SymTabPtr;


typedef union {
    unsigned long	num;
    char *		str;
    double		realnum;
} ValueUnion;

typedef enum {
    OPTV_NONE = 0,
    OPTV_INTEGER,
    OPTV_STRING,		/* a non-empty string */
    OPTV_ANYSTR,		/* Any string, including an empty one */
    OPTV_REAL,
    OPTV_BOOLEAN
} OptionValueType;

typedef struct {
    int			token;
    const char*		name;
    OptionValueType	type;
    ValueUnion		value;
    Bool		found;
} OptionInfoRec, *OptionInfoPtr;


/* 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) */

#if 0
#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

#endif /* _XF86STR_H */

Powered by
ViewCVS 0.9.2