1 /*
2  * Number Nine I128 functions
3  *
4  * Copyright 1996 The XFree86 Project, Inc.
5  *
6  * Author
7  *		Robin Cutshaw
8  *			robin@XFree86.Org
9  */
10 
11 #ifndef I128_H
12 #define I128_H
13 
14 #include "i128pcirename.h"
15 
16 #include "compiler.h"
17 #ifdef HAVE_XAA_H
18 #include "xaa.h"
19 #endif
20 #include "exa.h"
21 #include "xf86Cursor.h"
22 #include "vgaHW.h"
23 #include "colormapst.h"
24 #include "xf86DDC.h"
25 #include "i128reg.h"
26 
27 #include "compat-api.h"
28 struct source_format {
29     int render_format;
30     int i128_format;
31     int swap_flags;
32     int ignore_alpha;
33 };
34 
35 /* Card-specific driver information */
36 
37 #define I128PTR(p) ((I128Ptr)((p)->driverPrivate))
38 
39 #define PCI_VENDOR_NUMNINE		0x105D
40 #define PCI_CHIP_I128			0x2309
41 #define PCI_CHIP_I128_2			0x2339
42 #define PCI_CHIP_I128_T2R		0x493D
43 #define PCI_CHIP_I128_T2R4		0x5348
44 
45 typedef struct {
46     EntityInfoPtr	pEnt;
47     pciVideoPtr		PciInfo;
48 #ifndef XSERVER_LIBPCIACCESS
49     PCITAG		PciTag;
50     xf86AccessRec	Access;
51 #endif
52     int			Chipset;
53     int                 ChipRev;
54     Bool		Primary;
55 
56     /* Ramdac specific */
57     int		RamdacType;
58     Bool	DAC8Bit;
59     Bool	DACSyncOnGreen;
60     int		hotX;
61     int		hotY;
62     Bool	HWCursor;
63     Bool	BlockCursor;
64     Bool	ReloadCursor;
65     Bool	CursorNeedsInit;
66     int		CursorStartX;
67     int		CursorStartY;
68     int		CursorLines;
69     int		AdjustCursorXPos;
70     int		CursGeneration;
71 
72     /* layout specific */
73     int bitsPerPixel;
74     int depth;
75     rgb weight;
76     int displayWidth;
77     int displayOffset;
78     DisplayModePtr mode;
79 
80     /* accel specific */
81     CARD32              buf_ctrl;
82     CARD32		blitdir;
83     CARD32              planemask;
84     CARD32		cmd;
85     CARD32		rop; /* XXX XAA only */
86     CARD32		clptl;
87     CARD32		clpbr;
88     CARD32              sorg;
89     CARD32              sptch;
90     CARD32              dorg;
91     CARD32              dptch;
92     CARD32              wh;
93     CARD32              torg;
94     CARD32              tptch;
95     CARD32              tex_ctl;
96     CARD32              threedctl;
97     CARD32              acntrl;
98     struct source_format *source;
99     /* struct dest_format *dest; */
100 
101     Bool		NoAccel;
102     Bool                exa;
103     Bool		FlatPanel;
104     Bool		DoubleScan;
105     Bool		ShowCache;
106     Bool		ModeSwitched;
107     Bool		Debug;
108     unsigned char	*MemoryPtr;
109     int			MemorySize;
110     int			MemoryType;
111     volatile struct i128mem	mem;
112     struct i128io	io;
113     I128RegRec		RegRec;
114     Bool		StateSaved;
115     Bool		Initialized;
116     Bool		FontsSaved;
117     Bool		LUTSaved;
118     Bool		InitCursorFlag;
119     LUTENTRY		lutorig[256];
120     LUTENTRY		lutcur[256];
121     int			HDisplay;
122     int			maxClock;
123     int			minClock;
124 
125     CloseScreenProcPtr  CloseScreen;
126 #ifdef HAVE_XAA_H
127     XAAInfoRecPtr	XaaInfoRec;
128 #endif
129     ExaDriverPtr        ExaDriver;
130     xf86CursorInfoPtr	CursorInfoRec;
131     I2CBusPtr		I2C;
132     Bool		DGAactive;
133     int			DGAViewportStatus;
134     int			numDGAModes;
135     DGAModePtr		DGAModes;
136     Bool		(*ProgramDAC)(ScrnInfoPtr, DisplayModePtr);
137     unsigned int	(*ddc1Read)(ScrnInfoPtr);
138     Bool		(*i2cInit)(ScrnInfoPtr);
139 
140     OptionInfoPtr	Options;
141 
142 } I128Rec, *I128Ptr;
143 
144 
145 /* Prototypes */
146 
147 void I128AdjustFrame(ADJUST_FRAME_ARGS_DECL);
148 Bool I128SwitchMode(SWITCH_MODE_ARGS_DECL);
149 
150 Bool I128HWCursorInit(ScreenPtr pScreen);
151 
152 Bool I128XaaInit(ScreenPtr pScreen);
153 Bool I128ExaInit(ScreenPtr pScreen);
154 void I128EngineDone(ScrnInfoPtr pScrn);
155 
156 Bool I128Init(ScrnInfoPtr pScrn, DisplayModePtr mode);
157 
158 Bool I128DGAInit(ScreenPtr pScreen);
159 
160 void I128LoadPalette(ScrnInfoPtr pScrn, int numColors,
161 	int *indices, LOCO *colors, VisualPtr pVisual);
162 
163 void I128SaveState(ScrnInfoPtr pScrn);
164 void I128RestoreState(ScrnInfoPtr pScrn);
165 void I128InitLUT(I128Ptr pI128);
166 
167 Bool I128RestoreCursor(ScrnInfoPtr pScrn);
168 Bool I128RepositionCursor(ScrnInfoPtr pScrn);
169 
170 Bool I128IBMHWCursorInit(ScrnInfoPtr pScrn);
171 Bool I128TIHWCursorInit(ScrnInfoPtr pScrn);
172 
173 Bool I128ProgramTi3025(ScrnInfoPtr pScrn, DisplayModePtr mode);
174 Bool I128ProgramIBMRGB(ScrnInfoPtr pScrn, DisplayModePtr mode);
175 Bool I128ProgramSilverHammer(ScrnInfoPtr pScrn, DisplayModePtr mode);
176 
177 /* void I128DumpBaseRegisters(ScrnInfoPtr pScrn); */
178 void I128DumpActiveRegisters(ScrnInfoPtr pScrn);
179 /* void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg); */
180 
181 #endif
182