source: trunk/src/opengl/glide/sst1/init/init.h

Last change on this file was 2885, checked in by sandervl, 26 years ago

Created new Voodoo 1 Glide dir

File size: 12.3 KB
Line 
1/*
2** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
3** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
4** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
5** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
6** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
7** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
8** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
9** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
10**
11** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
12** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
13** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
14** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
15** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
16** THE UNITED STATES.
17**
18** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
19**
20**
21** $Revision: 1.1 $
22** $Date: 2000-02-25 00:31:26 $
23**
24*/
25
26#ifndef _TINI_H_
27#define _TINI_H_
28
29#include <3dfx.h>
30#include <sst1vid.h>
31#include <sst1init.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/*-------------------------------------------------------
38 Constants
39 -------------------------------------------------------*/
40/*
41 More slots than you will ever see in a consumer system
42 */
43#define INIT_MAX_DEVICES 8
44
45/*--IOCTLs-----------------------------------------------*/
46 /* An IOCTL value is appliacable on all systems where the the
47 associated value is ORed into the low eight bits. The reason for
48 this is so that code that calls the init code can do IOCTLs
49 without worrying about conditional compilation for device
50 dependance. So, the form of an IOCTL is:
51
52 #define INIT_FOO_IOCTL \
53 ((hw1 | hw2 | ... | hwn) | (number << INIT_OCTL_VALUE_SHIFT))
54
55 Remember, this isn't really an I/O control, but rather a back
56 door for whatever we've forgotten, or whatever may only apply to
57 a small-enough subset of 3Dfx hardware that it doesn't justify
58 modifying the init API.
59 */
60#define INIT_IOCTL_SST1 0x01
61#define INIT_IOCTL_SST96 0x02
62#define INIT_IOCTL_SST97 0x04
63
64
65#define INIT_IOCTL_VALUE_SHIFT 0x8
66
67#define INIT_VIDTIMINGS_IOCTL \
68 (INIT_IOCTL_SST1 | (0x1 << INIT_IOCTL_VALUE_SHIFT))
69
70 /*
71 Vendor IDs and Device IDs
72 */
73/* 3Dfx Voodoo Graphics */
74#define TDFXVID 0x121A
75#define SST1DID 0x01
76
77/* Alliance AT3D */
78#define AT3DVID 0x1142
79#define AT3DDID 0x643d
80
81/* Trident T96851 */
82#define T968VID 0x1023
83#define T968DID 0x9660
84
85/* MRTI M510 */
86#define MRTIVID 0x1293
87#define MRTIDID 0x0510
88
89/* Macronix MX86251 Fixme!!! these are bogus !!! XXX ??? */
90#define MCRXVID 0x10d9
91#define MCRXDID 0x8626
92
93/*
94 * (* Murali's comments *)
95 *
96 * Note that *EVERY* one of the following 3 definitions have an exact
97 * counterpart in glide.h.
98 *
99 * We could have used the glide definitions, but that would affect layering
100 * glide/src/ * on top of this sst1/init/ * library. So, we use these
101 * redundant defintions, and let glide/src/ * translate from glide.h to
102 * init.h defintions. (Note that translation is simply a typecast).
103 *
104 * The only exception that proves this rule is sst1vid.h, where something
105 * used in the init library (GrScreenResolution_t, GrScreenRefresh_t)
106 * is exposed to the glide application from sst1vid.h, WHICH LIVES IN
107 * THIS DIRECTORY, so we can use these typedefs here directly.
108 *
109 * Here are the relevant counterparts in init.h and glide.h:
110 *
111 * initBuffer_t GrBuffer_t
112 * initOriginLocation_t GrOriginLocation_t
113 * initColorFormat_t GrColorFormat_t
114 * initBufDesc_t ??? (GrBufDesc_t)
115 *
116 *
117 * PLEASE PLEASE PLEASE
118 * Make sure that the correspondence is exact.
119 */
120typedef FxU32 InitBuffer_t;
121#define INIT_BUFFER_FRONTBUFFER 0x0
122#define INIT_BUFFER_BACKBUFFER 0x1
123#define INIT_BUFFER_AUXBUFFER 0x2
124#define INIT_BUFFER_DEPTHBUFFER 0x3
125#define INIT_BUFFER_ALPHABUFFER 0x4
126#define INIT_BUFFER_TRIPLEBUFFER 0x5
127
128#define INIT_BUFFER_FIFOBUFFER 0x6
129#define INIT_BUFFER_SCREENBUFFER 0x7
130#define INIT_BUFFER_TEXTUREBUFFER 0x8
131#define INIT_BUFFER_NONE 0xff
132
133typedef FxU32 InitOriginLocation_t;
134#define INIT_ORIGIN_UPPER_LEFT 0x0
135#define INIT_ORIGIN_LOWER_LEFT 0x1
136
137typedef FxI32 InitColorFormat_t;
138#define INIT_COLORFORMAT_ARGB 0x0
139#define INIT_COLORFORMAT_ABGR 0x1
140#define INIT_COLORFORMAT_RGBA 0x2
141#define INIT_COLORFORMAT_BGRA 0x3
142
143typedef FxI32 InitSmoothingMode_t;
144#define INIT_SMOOTHING_DISABLE 0x0
145#define INIT_SMOOTHING_ENABLE 0x1
146
147typedef FxU32 InitControl_t;
148#define INIT_CONTROL_ACTIVATE 0x1
149#define INIT_CONTROL_DEACTIVATE 0x2
150#define INIT_CONTROL_RESIZE 0x3
151#define INIT_CONTROL_MOVE 0x4
152
153typedef struct _InitBufDesc_t {
154 FxU32 bufMagic;
155 InitBuffer_t bufType;
156 FxU32 bufOffset;
157 FxI32 bufStride;
158 FxU32 bufBPP; /* bits per pixel */
159} InitBufDesc_t;
160
161/*-------------------------------------------------------
162 Data Structures
163 -------------------------------------------------------*/
164
165
166/*-------------------------------------------------------------------
167 Structure: VGInfo
168 Date: 10/4/96
169 Implementor(s): jdt
170 Library: Init
171 Description:
172 Drescribes the capabilities of a standard Voodoo Graphics chip.
173 Members:
174 pfxRev - pixelFx chip rev
175 pfxRam - frame buffer ram
176 nTFX - number of texelFx chips
177 tfxRev - texelFx revision
178 tfxRam = texelFx ram
179 sliDetect - scan line interleave configuration detected
180 -------------------------------------------------------------------*/
181typedef struct _VGInfo {
182 FxU32 vgBaseAddr;
183 FxU32 pfxRev;
184 FxU32 pfxRam;
185 FxU32 nTFX;
186 FxU32 tfxRev;
187 FxU32 tfxRam;
188 FxBool sliDetect;
189 FxU32 slaveBaseAddr;
190} VGInfo;
191
192/*-------------------------------------------------------------------
193 Structure: VG96Info
194 Date: 10/4/96
195 Implementor(s): jdt
196 Library: Init
197 Description:
198 Describes the capabilities of VG 96 accelerated VGA board
199 Members:
200 vgaChip - code describing partner VGA part
201 0 - undefined
202 1 - Alliance AT3D
203 2 - Trident T9685
204 3 - MRTI MR510
205 4 - Macronics MX 86251
206 vg96Rev - revision of VG96 chip
207 vg96Ram - frame buffer ram
208 nTFX - number of texelFx chips
209 tfxRev - texelFx revision
210 tfxRam - texelFx ram
211 -------------------------------------------------------------------*/
212typedef struct _VG96Info {
213 FxU32 vgaBaseAddr;
214 FxU32 vg96BaseAddr;
215 FxU32 vgaChip;
216 FxU32 vg96Rev;
217 FxU32 vg96Ram;
218 FxU32 nTFX;
219 FxU32 tfxRev;
220 FxU32 tfxRam;
221} VG96Info;
222
223/*-------------------------------------------------------------------
224 Structure: H3Info
225 Date: 10/4
226 Implementor(s): jdt
227 Library: Init
228 Description:
229 Capabilities of H3
230 Members:
231 h3Rev - revision of H3
232 fbRam - frame buffer ram
233 texRam - texture ram
234 -------------------------------------------------------------------*/
235typedef struct _H3Info {
236 FxU32 h3Rev;
237 FxU32 fbRam;
238 FxU32 texRam;
239} H3Info;
240
241typedef enum { INIT_VOODOO,
242 INIT_VG96,
243 INIT_H3,
244 NUM_3DFX_PRODUCTS
245} TDFXHwClass;
246
247typedef struct _InitRegisterDesc {
248 union {
249 struct {
250 FxU32
251 *baseAddress, /* Base address */
252 *slavePtr; /* Scanline interleaved slave */
253 } VGRegDesc;
254 struct {
255 volatile FxU32
256 *baseAddress, /* Base address */
257 *partnerRegPtr, /* Partners' registers */
258 *serialStatus, /* Serial Status register */
259 *fifoApertureBase; /* Ptr to base of FIFO apurture */
260
261 FxU8 mclockHi;
262 FxU8 mclockLo;
263 } VG96RegDesc;
264 struct {
265 FxU32
266 *baseAddress; /* Base address */
267 } BansheeRegDesc;
268 } hwDep;
269} InitRegisterDesc;
270
271/*-------------------------------------------------------------------
272 Structure: InitDeviceInfo
273 Date: 10/4
274 Implementor(s): jdt
275 Library: Init
276 Description:
277 Describes a 3Dfx enabled hardware device in a system. Includes
278 the device number which will uniquely identify this device in the
279 current system configuration
280 Members:
281 devNumber - unique device number
282 class -
283 -------------------------------------------------------------------*/
284typedef struct _InitDeviceInfo {
285 FxU32 devNumber;
286 TDFXHwClass hwClass;
287 FxU16
288 vendorID, deviceID;
289 union {
290 VGInfo vgInfo;
291 VG96Info vg96Info;
292 H3Info h3Info;
293 } hwDep;
294 InitRegisterDesc regs;
295} InitDeviceInfo;
296
297
298typedef FxU32 InitSwapType_t;
299#define INIT_SWAP_FLIP 0x0
300#define INIT_SWAP_BLT 0x1
301
302typedef struct _InitFIFOData {
303 FxU32
304 cpuType; /* 5 for Pentium, 6 for Pentium Pro */
305 union {
306 struct {
307 FxU32 fifoFree;
308 FxU32 memFifoStatusLwm;
309 } vgFIFOData;
310 struct {
311 volatile FxU32
312 *fifoVirt, /* linear address of FIFO Start */
313 fifoMax, /* Max linear address in FIFO */
314 fifoPhys, /* Physical location of FIFO */
315 fifoCur, /* Current Wrap */
316 *fifoPtr, /* Pointer to current FIFO entry */
317 fifoSize; /* Size of FIFO in bytes */
318
319#if SST96_ALT_FIFO_WRAP
320 /* dpc - 10 sep 1997 FixMe! -
321 * I need to pass the init code the block size that I want to
322 * write, but I don't want to change the interface out from
323 * everyone else. If we re-visit the init code interface then
324 * fix me then.
325 */
326 FxI32 blockSize;
327
328 FxU32 fifoRead; /* Last known hw read ptr */
329 FxI32 roomToReadPtr; /* # of bytes to fifoRead */
330 FxI32 roomToEnd; /* # of bytes to fifoEnd */
331
332 InitRegisterDesc* regDesc;
333#endif /* SST96_ALT_FIFO_WRAP */
334
335 FxBool
336 fifoLfb; /* LFB FIFO or alternate? */
337 } vg96FIFOData;
338 } hwDep;
339} InitFIFOData;
340
341/*-------------------------------------------------------
342 Hardware Independant Setup Calls
343 -------------------------------------------------------*/
344typedef FxBool InitHWEnumCallback( const InitDeviceInfo *info );
345typedef void InitWriteCallback( FxU32 *linaddr, FxU32 val );
346
347void initEnumHardware( InitHWEnumCallback *cb );
348volatile FxU32* initMapBoard(const FxU32 boardNum);
349void initClose (void);
350FxBool initGetDeviceInfo( FxU32 devNumber, InitDeviceInfo *info );
351FxBool initDeviceSelect( FxU32 devNumber );
352
353/*-------------------------------------------------------
354 Driver Calls
355 -------------------------------------------------------*/
356void initSetWriteMethod( InitWriteCallback *wcb );
357FxBool initSetVideo( FxU32 hWnd,
358 GrScreenResolution_t sRes,
359 GrScreenRefresh_t vRefresh,
360 InitColorFormat_t cFormat,
361 InitOriginLocation_t yOrigin,
362 int nColBuffers,
363 int nAuxBuffers,
364 int *xres,
365 int *yres,
366 int *fbStride,
367 sst1VideoTimingStruct *vidTimings);
368void initRestoreVideo( void );
369
370FxBool initEnableTransport( InitFIFOData *info );
371void initDisableTransport( void );
372
373void initSwapBuffers( FxU32 code );
374FxU32 initStatus( void );
375FxBool initBusy( void );
376void initIdle( void );
377void *initGetBufferPtr( InitBuffer_t buffer, int *strideBytes );
378void initRenderBuffer( InitBuffer_t buffer );
379void initOrigin( InitOriginLocation_t origin );
380void initIOCtl( FxU32 token, void *argument );
381FxBool initControl (FxU32 code);
382FxBool initWrapFIFO(InitFIFOData *fifoData);
383
384/* SST-1 Flotsam */
385void initGamma( double gamma );
386void initSliPciOwner( FxU32 *regbase, FxU32 owner );
387FxU32 initNumBoardsInSystem( void );
388
389const char*
390myGetenv(const char*);
391
392/*
393** Glide 3 init functions
394*/
395FxBool initGammaRGB( double r, double g, double b );
396FxBool initGammaTable(FxU32 nentries, FxU32 *r, FxU32 *g, FxU32 *b);
397sst1VideoTimingStruct *initFindVideoTimingStruct(GrScreenResolution_t sRes, GrScreenRefresh_t vRefresh) ;
398
399#ifdef __cplusplus
400}
401#endif
402
403#endif /* _TINI_H_ */
Note: See TracBrowser for help on using the repository browser.