Comment out the correct #endif directive.
[mplayer/greg.git] / drivers / 3dfx.h
blobeb0130ce3872d7a01358ecd9f5c760c535eda369
1 /*
2 * 3dfx.h
4 * changed by zsteva Aug/Sep 2001, see vo_3dfx.c
6 * Copyright (C) Colin Cross Apr 2000
7 *
8 * mpeg2dec is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
13 * mpeg2dec is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with mpeg2dec; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #define VOODOO_IO_REG_OFFSET ((unsigned long int)0x0000000)
25 #define VOODOO_YUV_REG_OFFSET ((unsigned long int)0x0080100)
26 #define VOODOO_AGP_REG_OFFSET ((unsigned long int)0x0080000)
27 #define VOODOO_2D_REG_OFFSET ((unsigned long int)0x0100000)
28 #define VOODOO_YUV_PLANE_OFFSET ((unsigned long int)0x0C00000)
30 #define VOODOO_BLT_FORMAT_YUYV (8<<16)
31 #define VOODOO_BLT_FORMAT_UYVY (9<<16)
32 #define VOODOO_BLT_FORMAT_16 (3<<16)
33 #define VOODOO_BLT_FORMAT_24 (4<<16)
34 #define VOODOO_BLT_FORMAT_32 (5<<16)
36 #define VOODOO_YUV_STRIDE (1024>>2)
38 struct voodoo_yuv_fb_t {
39 uint32_t Y[0x0040000];
40 uint32_t U[0x0040000];
41 uint32_t V[0x0040000];
44 struct voodoo_yuv_reg_t {
45 uint32_t yuvBaseAddr;
46 uint32_t yuvStride;
49 struct voodoo_2d_reg_t {
50 uint32_t status;
51 uint32_t intCtrl;
52 uint32_t clip0Min;
53 uint32_t clip0Max;
54 uint32_t dstBaseAddr;
55 uint32_t dstFormat;
56 uint32_t srcColorkeyMin;
57 uint32_t srcColorkeyMax;
58 uint32_t dstColorkeyMin;
59 uint32_t dstColorkeyMax;
60 signed long bresError0;
61 signed long bresError1;
62 uint32_t rop;
63 uint32_t srcBaseAddr;
64 uint32_t commandExtra;
65 uint32_t lineStipple;
66 uint32_t lineStyle;
67 uint32_t pattern0Alias;
68 uint32_t pattern1Alias;;
69 uint32_t clip1Min;
70 uint32_t clip1Max;
71 uint32_t srcFormat;
72 uint32_t srcSize;
73 uint32_t srcXY;
74 uint32_t colorBack;
75 uint32_t colorFore;
76 uint32_t dstSize;
77 uint32_t dstXY;
78 uint32_t command;
79 uint32_t RESERVED1;
80 uint32_t RESERVED2;
81 uint32_t RESERVED3;
82 uint8_t launchArea[128];
86 struct voodoo_io_reg_t {
87 uint32_t status;
88 uint32_t pciInit0;
89 uint32_t sipMonitor;
90 uint32_t lfbMemoryConfig;
91 uint32_t miscInit0;
92 uint32_t miscInit1;
93 uint32_t dramInit0;
94 uint32_t dramInit1;
95 uint32_t agpInit;
96 uint32_t tmuGbeInit;
97 uint32_t vgaInit0;
98 uint32_t vgaInit1;
99 uint32_t dramCommand;
100 uint32_t dramData;
101 uint32_t RESERVED1;
102 uint32_t RESERVED2;
104 uint32_t pllCtrl0;
105 uint32_t pllCtrl1;
106 uint32_t pllCtrl2;
107 uint32_t dacMode;
108 uint32_t dacAddr;
109 uint32_t dacData;
111 uint32_t rgbMaxDelta;
112 uint32_t vidProcCfg;
113 uint32_t hwCurPatAddr;
114 uint32_t hwCurLoc;
115 uint32_t hwCurC0;
116 uint32_t hwCurC1;
117 uint32_t vidInFormat;
118 uint32_t vidInStatus;
119 uint32_t vidSerialParallelPort;
120 uint32_t vidInXDecimDeltas;
121 uint32_t vidInDecimInitErrs;
122 uint32_t vidInYDecimDeltas;
123 uint32_t vidPixelBufThold;
124 uint32_t vidChromaMin;
125 uint32_t vidChromaMax;
126 uint32_t vidCurrentLine;
127 uint32_t vidScreenSize;
128 uint32_t vidOverlayStartCoords;
129 uint32_t vidOverlayEndScreenCoord;
130 uint32_t vidOverlayDudx;
131 uint32_t vidOverlayDudxOffsetSrcWidth;
132 uint32_t vidOverlayDvdy;
134 uint32_t vga_registers_not_mem_mapped[12];
135 uint32_t vidOverlayDvdyOffset;
136 uint32_t vidDesktopStartAddr;
137 uint32_t vidDesktopOverlayStride;
138 uint32_t vidInAddr0;
139 uint32_t vidInAddr1;
140 uint32_t vidInAddr2;
141 uint32_t vidInStride;
142 uint32_t vidCurrOverlayStartAddr;
146 struct pioData_t {
147 short port;
148 short size;
149 int device;
150 void *value;
153 typedef struct pioData_t pioData;
154 typedef struct voodoo_2d_reg_t voodoo_2d_reg;
155 typedef struct voodoo_io_reg_t voodoo_io_reg;
156 typedef struct voodoo_yuv_reg_t voodoo_yuv_reg;
157 typedef struct voodoo_yuv_fb_t voodoo_yuv_fb;
160 /* from linux/driver/video/tdfxfb.c, definition for 3dfx registers.
162 * author: Hannu Mallat <hmallat@cc.hut.fi>
165 #ifndef PCI_DEVICE_ID_3DFX_VOODOO5
166 #define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
167 #endif
169 /* membase0 register offsets */
170 #define STATUS 0x00
171 #define PCIINIT0 0x04
172 #define SIPMONITOR 0x08
173 #define LFBMEMORYCONFIG 0x0c
174 #define MISCINIT0 0x10
175 #define MISCINIT1 0x14
176 #define DRAMINIT0 0x18
177 #define DRAMINIT1 0x1c
178 #define AGPINIT 0x20
179 #define TMUGBEINIT 0x24
180 #define VGAINIT0 0x28
181 #define VGAINIT1 0x2c
182 #define DRAMCOMMAND 0x30
183 #define DRAMDATA 0x34
184 /* reserved 0x38 */
185 /* reserved 0x3c */
186 #define PLLCTRL0 0x40
187 #define PLLCTRL1 0x44
188 #define PLLCTRL2 0x48
189 #define DACMODE 0x4c
190 #define DACADDR 0x50
191 #define DACDATA 0x54
192 #define RGBMAXDELTA 0x58
193 #define VIDPROCCFG 0x5c
194 #define HWCURPATADDR 0x60
195 #define HWCURLOC 0x64
196 #define HWCURC0 0x68
197 #define HWCURC1 0x6c
198 #define VIDINFORMAT 0x70
199 #define VIDINSTATUS 0x74
200 #define VIDSERPARPORT 0x78
201 #define VIDINXDELTA 0x7c
202 #define VIDININITERR 0x80
203 #define VIDINYDELTA 0x84
204 #define VIDPIXBUFTHOLD 0x88
205 #define VIDCHRMIN 0x8c
206 #define VIDCHRMAX 0x90
207 #define VIDCURLIN 0x94
208 #define VIDSCREENSIZE 0x98
209 #define VIDOVRSTARTCRD 0x9c
210 #define VIDOVRENDCRD 0xa0
211 #define VIDOVRDUDX 0xa4
212 #define VIDOVRDUDXOFF 0xa8
213 #define VIDOVRDVDY 0xac
214 /* ... */
215 #define VIDOVRDVDYOFF 0xe0
216 #define VIDDESKSTART 0xe4
217 #define VIDDESKSTRIDE 0xe8
218 #define VIDINADDR0 0xec
219 #define VIDINADDR1 0xf0
220 #define VIDINADDR2 0xf4
221 #define VIDINSTRIDE 0xf8
222 #define VIDCUROVRSTART 0xfc
224 #define INTCTRL (0x00100000 + 0x04)
225 #define CLIP0MIN (0x00100000 + 0x08)
226 #define CLIP0MAX (0x00100000 + 0x0c)
227 #define DSTBASE (0x00100000 + 0x10)
228 #define DSTFORMAT (0x00100000 + 0x14)
229 #define SRCCOLORKEYMIN (0x00100000 + 0x18)
230 #define SRCCOLORKEYMAX (0x00100000 + 0x1c)
231 #define DSTCOLORKEYMIN (0x00100000 + 0x20)
232 #define DSTCOLORKEYMAX (0x00100000 + 0x24)
233 #define ROP123 (0x00100000 + 0x30)
234 #define SRCBASE (0x00100000 + 0x34)
235 #define COMMANDEXTRA_2D (0x00100000 + 0x38)
236 #define CLIP1MIN (0x00100000 + 0x4c)
237 #define CLIP1MAX (0x00100000 + 0x50)
238 #define SRCFORMAT (0x00100000 + 0x54)
239 #define SRCSIZE (0x00100000 + 0x58)
240 #define SRCXY (0x00100000 + 0x5c)
241 #define COLORBACK (0x00100000 + 0x60)
242 #define COLORFORE (0x00100000 + 0x64)
243 #define DSTSIZE (0x00100000 + 0x68)
244 #define DSTXY (0x00100000 + 0x6c)
245 #define COMMAND_2D (0x00100000 + 0x70)
246 #define LAUNCH_2D (0x00100000 + 0x80)
248 #define COMMAND_3D (0x00200000 + 0x120)
250 #define SWAPBUFCMD (0x00200000 + 0x128)
251 #define SWAPPENDING (0x00200000 + 0x24C)
252 #define LEFTOVBUF (0x00200000 + 0x250)
253 #define RIGHTOVBUF (0x00200000 + 0x254)
254 #define FBISWAPBUFHIST (0x00200000 + 0x258)
256 /* register bitfields (not all, only as needed) */
258 #define BIT(x) (1UL << (x))
260 /* COMMAND_2D reg. values */
261 #define ROP_COPY 0xcc // src
262 #define ROP_INVERT 0x55 // NOT dst
263 #define ROP_XOR 0x66 // src XOR dst
264 #define ROP_OR (0xee) /* src | dst */
266 #define AUTOINC_DSTX BIT(10)
267 #define AUTOINC_DSTY BIT(11)
270 #define COMMAND_2D_S2S_BITBLT 0x01 // screen to screen
271 #define COMMAND_2D_S2S_STRECH_BLT 0x02 // BLT + Strech
272 #define COMMAND_2D_H2S_BITBLT 0x03 // host to screen
273 #define COMMAND_2D_FILLRECT 0x05
275 #define COMMAND_2D_DO_IMMED BIT(8) // Do it immediatly
279 #define COMMAND_3D_NOP 0x00
280 #define STATUS_RETRACE BIT(6)
281 #define STATUS_BUSY BIT(9)
282 #define MISCINIT1_CLUT_INV BIT(0)
283 #define MISCINIT1_2DBLOCK_DIS BIT(15)
284 #define DRAMINIT0_SGRAM_NUM BIT(26)
285 #define DRAMINIT0_SGRAM_TYPE BIT(27)
286 #define DRAMINIT1_MEM_SDRAM BIT(30)
287 #define VGAINIT0_VGA_DISABLE BIT(0)
288 #define VGAINIT0_EXT_TIMING BIT(1)
289 #define VGAINIT0_8BIT_DAC BIT(2)
290 #define VGAINIT0_EXT_ENABLE BIT(6)
291 #define VGAINIT0_WAKEUP_3C3 BIT(8)
292 #define VGAINIT0_LEGACY_DISABLE BIT(9)
293 #define VGAINIT0_ALT_READBACK BIT(10)
294 #define VGAINIT0_FAST_BLINK BIT(11)
295 #define VGAINIT0_EXTSHIFTOUT BIT(12)
296 #define VGAINIT0_DECODE_3C6 BIT(13)
297 #define VGAINIT0_SGRAM_HBLANK_DISABLE BIT(22)
298 #define VGAINIT1_MASK 0x1fffff
299 #define VIDCFG_VIDPROC_ENABLE BIT(0)
300 #define VIDCFG_CURS_X11 BIT(1)
301 #define VIDCFG_HALF_MODE BIT(4)
302 #define VIDCFG_DESK_ENABLE BIT(7)
303 #define VIDCFG_CLUT_BYPASS BIT(10)
304 #define VIDCFG_2X BIT(26)
305 #define VIDCFG_HWCURSOR_ENABLE BIT(27)
306 #define VIDCFG_PIXFMT_SHIFT 18
307 #define DACMODE_2X BIT(0)
309 /* AGP registers */
310 #define AGPREQSIZE (0x0080000 + 0x00)
311 #define AGPHOSTADDRESSLOW (0x0080000 + 0x04)
312 #define AGPHOSTADDRESSHIGH (0x0080000 + 0x08)
313 #define AGPGRAPHICSADDRESS (0x0080000 + 0x0C)
314 #define AGPGRAPHICSSTRIDE (0x0080000 + 0x10)
315 #define AGPMOVECMD (0x0080000 + 0x14)
317 /* FIFO registers */
318 #define CMDBASEADDR0 (0x0080000 + 0x20)
319 #define CMDBASESIZE0 (0x0080000 + 0x24)
320 #define CMDBUMP0 (0x0080000 + 0x28)
321 #define CMDRDPTRL0 (0x0080000 + 0x2C)
322 #define CMDRDPTRH0 (0x0080000 + 0x30)
323 #define CMDAMIN0 (0x0080000 + 0x34)
324 #define CMDAMAX0 (0x0080000 + 0x38)
325 #define CMDFIFODEPTH0 (0x0080000 + 0x44)
326 #define CMDHOLECNT0 (0x0080000 + 0x48)
329 /* YUV reisters */
330 #define YUVBASEADDRESS (0x0080000 + 0x100)
331 #define YUVSTRIDE (0x0080000 + 0x104)
333 /* VGA rubbish, need to change this for multihead support */
334 #define MISC_W 0x3c2
335 #define MISC_R 0x3cc
336 #define SEQ_I 0x3c4
337 #define SEQ_D 0x3c5
338 #define CRT_I 0x3d4
339 #define CRT_D 0x3d5
340 #define ATT_IW 0x3c0
341 #define RAMDAC_R 0x3c7
342 #define RAMDAC_W 0x3c8
343 #define RAMDAC_D 0x3c9
344 #define IS1_R 0x3da
345 #define GRA_I 0x3ce
346 #define GRA_D 0x3cf
348 #ifndef FB_ACCEL_3DFX_BANSHEE
349 #define FB_ACCEL_3DFX_BANSHEE 31
350 #endif
352 #define TDFXF_HSYNC_ACT_HIGH 0x01
353 #define TDFXF_HSYNC_ACT_LOW 0x02
354 #define TDFXF_VSYNC_ACT_HIGH 0x04
355 #define TDFXF_VSYNC_ACT_LOW 0x08
356 #define TDFXF_LINE_DOUBLE 0x10
357 #define TDFXF_VIDEO_ENABLE 0x20
359 #define TDFXF_HSYNC_MASK 0x03
360 #define TDFXF_VSYNC_MASK 0x0c
362 #define XYREG(x,y) (((((unsigned long)y) & 0x1FFF) << 16) | (((unsigned long)x) & 0x1FFF))
364 //#define TDFXFB_DEBUG
365 #ifdef TDFXFB_DEBUG
366 #define DPRINTK(a,b...) printk(KERN_DEBUG "fb: %s: " a, __FUNCTION__ , ## b)
367 #else
368 #define DPRINTK(a,b...)
369 #endif
371 /* ------------------------------------------------------------------------- */