(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.12, Fri Jul 18 12:12:36 1997 UTC (15 years, 10 months ago) by dawes
Branch: xf-3_9j-branch
Changes since 1.1.2.11: +1 -2 lines
Some more compile fixes + fix/add some helper functions

/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.1.2.11 1997/07/18 10:09:28 hohndel 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;

/* Video mode */

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

    /* 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;
    ModeFlags			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 {
    char *		id;
    char *		vendor;
    char *		model;
    float		EMPTY;
    int			n_hsync;
    range		hsync[MAX_HSYNC];       
    int			n_vrefresh;                  
    range		vrefresh[MAX_VREFRESH];
    DisplayModePtr	Modes;		/* Start of the monitor's mode list */
    DisplayModePtr	Last;		/* End of the monitor's mode list */
} MonRec, *MonPtr;

/* the list of clock ranges */
typedef struct x_ClockRange {
    struct x_ClockRange *next;
    int			minClock;
    int			maxClock;
    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
#define MAXDACSPEEDS  4  /* for <= 8, 16, 24, 32bpp */

typedef struct {
   char *identifier;
   char *vendor;
   char *board;
   char *chipset;
   char *ramdac;
   int dacSpeeds[MAXDACSPEEDS];
   int clocks;
   int clock[MAXCLOCKS];
   OFlagSet options;
   OFlagSet clockOptions;
   OFlagSet xconfigFlag;
   int videoRam;
   unsigned long speedup;
   char *clockprog;
   int textClockValue;
   int BIOSbase;                 /* Base address of video BIOS */
   unsigned long MemBase;        /* Frame buffer base address */
   unsigned int  IObase;
   unsigned int  DACbase;
   unsigned long COPbase;
   unsigned int  POSbase;
   int instance;
   int s3Madjust;
   int s3Nadjust;
   int s3MClk;
   int chipID;
   int chipRev;
   unsigned long VGAbase;      /* VGA ot XGA 64K aperature base address */
   int s3RefClk;
   int s3BlankDelay;
   char *DCConfig;
   char *DCOptions;
   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;

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

/*
 * 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;
    ScreenPtr		pScreen;		/* Pointer to the ScreenRec */
    int			scrnIndex;		/* Number of this screen */
    Bool		configured;		/* Is this screen valid */ 
    int			tmpIndex;		/* initial number assigned to
						 * this screen before
						 * finalising the number of
						 * availalbe screens */
    int			bitsPerPixel;		/* bpp for default visual */
    int			depth;			/* depth of default visual */
    xrgb		weight;			/* r/g/b weights */
    float		redGamma;		/* Gamma values */
    float		blueGamma;		/* Gamma values */
    float		greenGamma;		/* Gamma values */
    int			defaultVisual;		/* default visual class */
    int			virtualX;		/* Virtual width */
    int			virtualY; 		/* Virtual height */
    int			displayWidth;		/* memory pitch */
    int			frameX0;		/* viewport position */
    int			frameY0;
    int			frameX1;
    int			frameY1;
    int			zoomLocked;		/* Disallow mode changes */
    DisplayModePtr	modes;			/* list of modes */
    DisplayModePtr	currentMode;		/* current mode
						 * This was previously
						 * overloaded with the modes
						 * field, which is a pointer
						 * into a circular list */
    MonPtr		monitor;		/* Monitor information */
    GDevPtr		device;			/* device information */
    int			width;			/* physical display dimensions
						 * in mm */
    int			height;
    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 */
    int			numRequiredModules;

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

    OFlagSet		options;		/* Option flags */
    OFlagSet		clockOptions;		/* Clock option flags */
    OFlagSet		xconfigFlag;		/* Flags indicating which
						 * parameter values were
						 * set from the config file */
    char *		chipset;		/* chipset name */
    char *		ramdac;			/* ramdac name */
    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 */
    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 */

    Bool		bankedMono;
    xrgb		blackColour;
    xrgb		whiteColour;

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

    int			chipID;
    int			chipRev;
    int			textClockFreq;

    /* 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);
    void		(*CloseScreen)(int scrnIndex, ScreenPtr pScreen);
    void		(*FreeScreen)(int scrnIndex, int flags);
    int			(*ValidMode)(int scrnIndex, DisplayModePtr mode,
				     Bool verbose, int flags);
    Bool		(*SaveScreen)(ScreenPtr pScreen, Bool unblank);

    /* 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		(*Register)(int flags);
    Bool		(*ParseConfig)(/*ParseInfoPtr raw*/);
    Bool		(*Probe)(int flags);
    pointer		parseInfo;	/* Driver-specific parsed info */
} DriverRec, *DriverPtr;


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

/* 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_BAD	= 255	/* unspecified reason */
} ModeStatus;

/* 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		= 1,	/* Pick modes with best refresh */
    LOOKUP_NO_INTERLACED	= 2,	/* Ignore interlaced modes */
    LOOKUP_FORCE_DEFAULT	= 4	/* Force default lookup method */
} LookupModeFlags;

#define INTERLACE_REFRESH_WEIGHT	1.5

#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