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