1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
/*
Voodoo Banshee driver version 1.0.2
Author: Daryll Strauss
Copyright: 1998,1999
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.9 2000/02/18 12:20:02 tsi Exp $ */
#ifndef _TDFX_H_
#define _TDFX_H_
#include "xf86PciInfo.h"
#include "xf86Pci.h"
#include "tdfxdefs.h"
#ifdef XF86DRI
#include "xf86drm.h"
#include "sarea.h"
#define _XF86DRI_SERVER_
#include "xf86dri.h"
#include "dri.h"
#include "GL/glxint.h"
#include "tdfx_dri.h"
#include "tdfx_dripriv.h"
#endif
#define TDFX_VERSION 4000
#define TDFX_NAME "TDFX"
#define TDFX_DRIVER_NAME "tdfx"
#define TDFX_MAJOR_VERSION 1
#define TDFX_MINOR_VERSION 0
#define TDFX_PATCHLEVEL 0
struct _TDFXRec;
typedef struct _TDFXRec *TDFXPtr;
#ifdef XF86DRI
#define PIXMAP_CACHE_LINES 128
#else
#define PIXMAP_CACHE_LINES 512
#endif
#ifdef PROP_3DFX
#include "tdfx_priv.h"
#else
#define PROPDATA
#define PROPSAREADATA
#endif
extern Bool TDFXInitPrivate(ScreenPtr pScreen);
extern void TDFXShutdownPrivate(ScreenPtr pScreen);
extern void TDFXSwapContextPrivate(ScreenPtr pScreen);
extern void TDFXLostContext(ScreenPtr pScreen);
#ifdef XF86DRI
extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI);
#endif
#if 0
/* These are not normally turned on. They are only included for debugging. */
#define TRACE 1
#define TRACEACCEL 1
#define TDFX_DEBUG_CMDS
#define TRACECURS 1
#define REGDEBUG 1
#define TRACEREG
#endif
#ifdef TRACE
#define TDFXTRACE ErrorF
#else
#define TDFXTRACE if(0) ErrorF
#endif
#ifdef TRACEACCEL
#define TDFXTRACEACCEL ErrorF
#else
#define TDFXTRACEACCEL if(0) ErrorF
#endif
#ifdef TRACECURS
#define TDFXTRACECURS ErrorF
#else
#define TDFXTRACECURS if(0) (unsigned long)
#endif
#ifdef TRACEREG
#define TDFXTRACEREG ErrorF
#else
#define TDFXTRACEREG if(0) ErrorF
#endif
#include <xaa.h>
#include <xf86Cursor.h>
typedef void (*TDFXWriteIndexedByteFunc)(TDFXPtr pTDFX, int addr,
char index, char value);
typedef char (*TDFXReadIndexedByteFunc)(TDFXPtr pTDFX, int addr,
char index);
typedef void (*TDFXWriteWordFunc)(TDFXPtr pTDFX, int addr, int value);
typedef int (*TDFXReadWordFunc)(TDFXPtr pTDFX, int addr);
typedef void (*TDFXWriteChipIndexedByteFunc)(TDFXPtr pTDFX, int chip,
int addr, char index, char value);
typedef char (*TDFXReadChipIndexedByteFunc)(TDFXPtr pTDFX, int chip,
int addr, char index);
typedef void (*TDFXWriteChipWordFunc)(TDFXPtr pTDFX, int chip,
int addr, int value);
typedef int (*TDFXReadChipWordFunc)(TDFXPtr pTDFX, int chip,
int addr);
typedef void (*TDFXSyncFunc)(ScrnInfoPtr pScrn);
typedef void (*TDFXBufferFunc)(TDFXPtr pTDFX, int which);
typedef struct {
unsigned int vidcfg;
unsigned int vidpll;
unsigned int dacmode;
unsigned int vgainit0;
unsigned int screensize;
unsigned int stride;
unsigned int cursloc;
unsigned int startaddr;
unsigned int clip0min;
unsigned int clip0max;
unsigned int clip1min;
unsigned int clip1max;
unsigned int srcbaseaddr;
unsigned int dstbaseaddr;
unsigned char ExtVga[2];
} TDFXRegRec, *TDFXRegPtr;
typedef struct TextureData_t {
int contextid;
void *data;
struct TextureData_t *next;
} TextureData;
#define MAXCHIPS 4
typedef struct _TDFXRec {
unsigned char *MMIOBase[MAXCHIPS];
unsigned char *FbBase;
unsigned char *myFbBase;
unsigned int PIOBase[MAXCHIPS];
long FbMapSize;
int pixelFormat;
int stride;
int cpp;
int maxClip;
int MaxClock;
int ChipType;
pciVideoPtr PciInfo;
int LinearAddr[MAXCHIPS];
int MMIOAddr[MAXCHIPS];
EntityInfoPtr pEnt;
int numChips;
PCITAG PciTag[MAXCHIPS];
int HasSGRAM;
int PciCnt;
int PrevDrawState;
int DrawState;
int Cmd;
int DashedLineSize;
BoxRec prevBlitDest;
TDFXRegRec SavedReg;
TDFXRegRec ModeReg;
XAAInfoRecPtr AccelInfoRec;
xf86CursorInfoPtr CursorInfoRec;
CloseScreenProcPtr CloseScreen;
Bool usePIO;
Bool NoAccel;
DGAModePtr DGAModes;
Bool DGAactive;
Bool initDone;
int DGAViewportStatus;
int cursorOffset;
int fbOffset;
int backOffset;
int depthOffset;
int texOffset;
int texSize;
TDFXWriteIndexedByteFunc writeControl;
TDFXReadIndexedByteFunc readControl;
TDFXWriteWordFunc writeLong;
TDFXReadWordFunc readLong;
TDFXWriteChipWordFunc writeChipLong;
TDFXReadChipWordFunc readChipLong;
TDFXSyncFunc sync;
int syncDone;
int scanlineWidth;
unsigned char *scanlineColorExpandBuffers[2];
PROPDATA
#ifdef XF86DRI
Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
int drmSubFD;
int numVisualConfigs;
__GLXvisualConfig* pVisualConfigs;
TDFXConfigPrivPtr pVisualConfigsPriv;
TDFXRegRec DRContextRegs;
#endif
} TDFXRec;
typedef struct {
PROPSAREADATA
int fifoOwner;
int CtxOwner;
int TexOwner;
} TDFXSAREAPriv;
#define TDFXPTR(p) ((TDFXPtr)((p)->driverPrivate))
#define DRAW_STATE_CLIPPING 0x1
#define DRAW_STATE_TRANSPARENT 0x2
#define DRAW_STATE_CLIP1CHANGED 0x4
#define TDFX_FRONT 0
#define TDFX_BACK 1
#define TDFX_DEPTH 2
#define TDFX2XCUTOFF 135000
#ifndef PCI_CHIP_VOODOO5
#define PCI_CHIP_VOODOO5 9
#endif
extern Bool TDFXAccelInit(ScreenPtr pScreen);
extern Bool TDFXCursorInit(ScreenPtr pScreen);
extern void TDFXSync(ScrnInfoPtr pScrn);
extern Bool TDFXDRIScreenInit(ScreenPtr pScreen);
extern void TDFXDRICloseScreen(ScreenPtr pScreen);
extern Bool TDFXDRIFinishScreenInit(ScreenPtr pScreen);
extern Bool TDFXDGAInit(ScreenPtr pScreen);
extern void TDFXCursorGrabMemory(ScreenPtr pScreen);
extern void TDFXSetLFBConfig(TDFXPtr pTDFX);
extern void TDFXSendNOPPrivate(ScrnInfoPtr pScrn);
extern Bool TDFXSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
extern void TDFXAdjustFrame(int scrnIndex, int x, int y, int flags);
extern void TDFXSetPIOAccess(TDFXPtr pTDFX);
extern void TDFXSetMMIOAccess(TDFXPtr pTDFX);
extern void TDFXWriteLongMMIO(TDFXPtr pTDFX, int addr, int val);
extern int TDFXReadLongMMIO(TDFXPtr pTDFX, int addr);
extern void TDFXNeedSync(ScrnInfoPtr pScrn);
extern void TDFXCheckSync(ScrnInfoPtr pScrn);
extern void TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
int ydir, int rop,
unsigned int planemask,
int trans_color);
extern void TDFXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int srcX,
int srcY, int dstX, int dstY,
int w, int h);
extern void TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask);
extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
int w, int h);
extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which);
#ifndef PROP_3DFX
#define DECLARE(a)
#define DECLARE_LAUNCH(size, x)
#ifdef TDFX_DEBUG_CMDS
#define TDFXMakeRoom(p, n) \
do { \
if (cmdCnt) \
ErrorF("Previous TDFXMakeRoom passed incorrect size\n"); \
cmdCnt=n; \
lastAddr=0;
TDFXMakeRoomNoProp(p, n); \
} while(0)
#define TDFXWriteLong(p, a, v) \
do { \
if (lastAddr && a<lastAddr) \
ErrorF("TDFXWriteLong not ordered\n"); \
lastAddr=a; \
cmdCnt--; \
TDFXWriteLongMMIO(p, a, v); \
while (0)
#else
#define TDFXMakeRoom(p, n) TDFXMakeRoomNoProp(p, n)
#define TDFXWriteLong(p, a, v) TDFXWriteLongMMIO(p, a, v)
#endif
#define TDFXSendNOP TDFXSendNOPNoProp
#endif
#endif
|