Remove CVS keywords.
[mesa.git] / src / mesa / drivers / dri / unichrome / server / via_driver.h
1 /*
2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #ifndef _VIA_DRIVER_H
26 #define _VIA_DRIVER_H
27
28 #if 0 /* DEBUG is use in VIA DRI code as a flag */
29 /* #define DEBUG_PRINT */
30 #ifdef DEBUG_PRINT
31 #define DEBUG(x) x
32 #else
33 #define DEBUG(x)
34 #endif
35 #endif
36
37 #if 0
38 #include "vgaHW.h"
39 #include "xf86.h"
40 #include "xf86Resources.h"
41 #include "xf86_ansic.h"
42 #include "xf86Pci.h"
43 #include "xf86PciInfo.h"
44 #include "xf86_OSproc.h"
45 #include "compiler.h"
46 #include "xf86Cursor.h"
47 #include "mipointer.h"
48 #include "micmap.h"
49
50 #define USE_FB
51 #ifdef USE_FB
52 #include "fb.h"
53 #else
54 #include "cfb.h"
55 #include "cfb16.h"
56 #include "cfb32.h"
57 #endif
58
59 #include "xf86cmap.h"
60 #include "vbe.h"
61 #include "xaa.h"
62
63 #include "via_regs.h"
64 #include "via_bios.h"
65 #include "via_gpioi2c.h"
66 #include "via_priv.h"
67 #include "ginfo.h"
68
69 #ifdef XF86DRI
70 #define _XF86DRI_SERVER_
71 #include "sarea.h"
72 #include "dri.h"
73 #include "GL/glxint.h"
74 #include "via_dri.h"
75 #endif
76 #else
77 #include "via_regs.h"
78
79 #include "GL/internal/dri_interface.h"
80 #include "via_dri.h"
81 #endif
82
83 /* _SOLO : copied from via_bios.h */
84 /* System Memory CLK */
85 #define VIA_MEM_SDR66 0x00
86 #define VIA_MEM_SDR100 0x01
87 #define VIA_MEM_SDR133 0x02
88 #define VIA_MEM_DDR200 0x03
89 #define VIA_MEM_DDR266 0x04
90 #define VIA_MEM_DDR333 0x05
91 #define VIA_MEM_DDR400 0x06
92
93 #define DRIVER_NAME "via"
94 #define DRIVER_VERSION "4.1.0"
95 #define VERSION_MAJOR 4
96 #define VERSION_MINOR 1
97 #define PATCHLEVEL 41
98 #define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
99
100 #define VGAIN8(addr) MMIO_IN8(pVia->MapBase+0x8000, addr)
101 #define VGAIN16(addr) MMIO_IN16(pVia->MapBase+0x8000, addr)
102 #define VGAIN(addr) MMIO_IN32(pVia->MapBase+0x8000, addr)
103
104 #define VGAOUT8(addr, val) MMIO_OUT8(pVia->MapBase+0x8000, addr, val)
105 #define VGAOUT16(addr, val) MMIO_OUT16(pVia->MapBase+0x8000, addr, val)
106 #define VGAOUT(addr, val) MMIO_OUT32(pVia->MapBase+0x8000, addr, val)
107
108 #define INREG(addr) MMIO_IN32(pVia->MapBase, addr)
109 #define OUTREG(addr, val) MMIO_OUT32(pVia->MapBase, addr, val)
110 #define INREG16(addr) MMIO_IN16(pVia->MapBase, addr)
111 #define OUTREG16(addr, val) MMIO_OUT16(pVia->MapBase, addr, val)
112
113 #define VIA_PIXMAP_CACHE_SIZE (256 * 1024)
114 #define VIA_CURSOR_SIZE (4 * 1024)
115 #define VIA_VQ_SIZE (256 * 1024)
116
117 typedef struct {
118 unsigned int mode, refresh, resMode;
119 int countWidthByQWord;
120 int offsetWidthByQWord;
121 unsigned char SR08, SR0A, SR0F;
122
123 /* extended Sequencer registers */
124 unsigned char SR10, SR11, SR12, SR13,SR14,SR15,SR16;
125 unsigned char SR17, SR18, SR19, SR1A,SR1B,SR1C,SR1D,SR1E;
126 unsigned char SR1F, SR20, SR21, SR22,SR23,SR24,SR25,SR26;
127 unsigned char SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E;
128 unsigned char SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41;
129 unsigned char SR42, SR43, SR44, SR45,SR46,SR47;
130
131 unsigned char Clock;
132
133 /* extended CRTC registers */
134 unsigned char CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36;
135 unsigned char CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43;
136 unsigned char CR44, CR45, CR46, CR47, CR48, CR49, CR4A;
137 unsigned char CRTCRegs[83];
138 unsigned char TVRegs[0xCF];
139 unsigned char TVRegs2[0xCF];
140 /* unsigned char LCDRegs[0x40];*/
141
142 } VIARegRec, *VIARegPtr;
143
144
145 typedef struct _VIA {
146 VIARegRec SavedReg;
147 VIARegRec ModeReg;
148 #if 0
149 xf86CursorInfoPtr CursorInfoRec;
150 int stateMode;
151 VIAModeInfoPtr VIAModeList;
152 #endif
153 int ModeStructInit;
154 int Bpp, Bpl, ScissB;
155 unsigned PlaneMask;
156
157 unsigned long videoRambytes;
158 int videoRamKbytes;
159 int FBFreeStart;
160 int FBFreeEnd;
161 int CursorStart;
162 int VQStart;
163 int VQEnd;
164
165 /* These are physical addresses. */
166 unsigned long FrameBufferBase;
167 unsigned long MmioBase;
168
169 /* These are linear addresses. */
170 unsigned char* MapBase;
171 unsigned char* VidMapBase;
172 unsigned char* BltBase;
173 unsigned char* MapBaseDense;
174 unsigned char* FBBase;
175 unsigned char* FBStart;
176
177 int PrimaryVidMapped;
178 int dacSpeedBpp;
179 int minClock, maxClock;
180 int MCLK, REFCLK, LCDclk;
181 double refclk_fact;
182
183 /* Here are all the Options */
184 int VQEnable;
185 int pci_burst;
186 int NoPCIRetry;
187 int hwcursor;
188 int NoAccel;
189 int shadowFB;
190 int NoDDCValue;
191 int rotate;
192
193 #if 0
194 CloseScreenProcPtr CloseScreen;
195 pciVideoPtr PciInfo;
196 PCITAG PciTag;
197 #endif
198 int Chipset;
199 int ChipId;
200 int ChipRev;
201 /*vbeInfoPtr pVbe;*/
202 int EntityIndex;
203
204 /* Support for shadowFB and rotation */
205 unsigned char* ShadowPtr;
206 int ShadowPitch;
207 void (*PointerMoved)(int index, int x, int y);
208
209 /* Support for XAA acceleration */
210 #if 0
211 XAAInfoRecPtr AccelInfoRec;
212 xRectangle Rect;
213 #endif
214 u_int32_t SavedCmd;
215 u_int32_t SavedFgColor;
216 u_int32_t SavedBgColor;
217 u_int32_t SavedPattern0;
218 u_int32_t SavedPattern1;
219 u_int32_t SavedPatternAddr;
220
221 #if 0
222 /* Support for Int10 processing */
223 xf86Int10InfoPtr pInt10;
224
225 /* BIOS Info Ptr */
226 VIABIOSInfoPtr pBIOSInfo;
227 VGABIOSVERPtr pBIOSVer;
228 #endif
229
230 /* Support for DGA */
231 int numDGAModes;
232 /*DGAModePtr DGAModes;*/
233 int DGAactive;
234 int DGAViewportStatus;
235
236 /* The various wait handlers. */
237 int (*myWaitIdle)(struct _VIA*);
238
239 #if 0
240 /* I2C & DDC */
241 I2CBusPtr I2C_Port1;
242 I2CBusPtr I2C_Port2;
243 xf86MonPtr DDC1;
244 xf86MonPtr DDC2;
245 #endif
246
247 /* MHS */
248 int IsSecondary;
249 int HasSecondary;
250
251 #if 0
252 /* Capture information */
253 VIACAPINFO CapInfo[2]; /* 2 capture information */
254 #endif
255
256 /*
257 u_int32_t Cap0_Deinterlace;
258 u_int32_t Cap1_Deinterlace;
259
260 int Cap0_FieldSwap;
261 int NoCap0_HFilter;
262 int Capture_OverScanOff;
263 int NoMPEGHQV_VFilter;
264 */
265 #ifdef XF86DRI
266 int directRenderingEnabled;
267 DRIInfoPtr pDRIInfo;
268 int drmFD;
269 int numVisualConfigs;
270 __GLXvisualConfig* pVisualConfigs;
271 VIAConfigPrivPtr pVisualConfigsPriv;
272 unsigned long agpHandle;
273 unsigned long registerHandle;
274 u_int32_t agpAddr;
275 unsigned char *agpBase;
276 unsigned int agpSize;
277 int IsPCI;
278 int drixinerama;
279 #else
280 int drmFD;
281 unsigned long agpHandle;
282 unsigned long registerHandle;
283 unsigned long agpAddr;
284 unsigned char *agpBase;
285 unsigned int agpSize;
286 int IsPCI;
287 #endif
288
289 int V4LEnabled;
290 u_int16_t ActiveDevice; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
291 unsigned char *CursorImage;
292 u_int32_t CursorFG;
293 u_int32_t CursorBG;
294 u_int32_t CursorMC;
295
296 unsigned char MemClk;
297 int EnableExtendedFIFO;
298 VIADRIPtr devPrivate;
299 } VIARec, *VIAPtr;
300
301
302 /* Shortcuts. These depend on a local symbol "pVia". */
303
304 #define WaitIdle() pVia->myWaitIdle(pVia)
305 #define VIAPTR(p) ((VIAPtr)((p)->driverPrivate))
306
307 #endif /* _VIA_DRIVER_H */
308