annotate drivers/hacking.ati @ 29594:331320b4557b

Limit amount of data allocated on stack, strlen(filename) is not a good idea for file name strings that might come from arbitrary playlists, use PATH_MAX instead.
author reimar
date Wed, 02 Sep 2009 19:49:10 +0000
parents 0f1b5b68af32
children 0ad2da052b2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22691
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
1 ATI chips hacking
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
2 =================
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
3 Dedicated to ATI's hackers.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
4
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
5 Preface
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
6 ~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
7 This document will compare ATI chips only from point of DAC and video overlay.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
8 There are lots of difference from 3D point, dual-head support, tv-out support
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
9 and many other things but it's already perfectly different story.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
10 This document doesn't include information about ATI AIW (All In Wonder) chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
11
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
12 What are units on modern ATI chips:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
13 DAC - (Digital to Analog Convertor) controls CRTC, LCD, DFP monitor's output
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
14 Consists from:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
15 PLL - (Programable line length) registers
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
16 CRTC - CRT controller
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
17 LCD/DFP scaler
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
18 surface control
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
19 DAC2 - controls CRTC, LCD, DFP monitor's output on second head
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
20 TVDAC - controls Composite Video and Super Video output ports
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
21 Consists from:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
22 TV_PLL
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
23 TV scaler & sync unit
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
24 TV format convertor (PAL/NTSC)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
25 TVCAP - controls Video-In port
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
26 MPP - Miscellaneous peripheral port. (includes macrovision's filter - copy
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
27 protection mechanism)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
28 OV - Video overlay (YUV BES) (include subpictures, gamma correction and
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
29 adaptive deinterlacing)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 22691
diff changeset
30 CAP0 - Video capturing
22691
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
31 CAP1 - Video capturing (second unit)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
32 RT - Rage theatre: video encoding and mixing
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
33 MUX - video muxer
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
34 MEM - PCI/AGP bus mastering
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
35 2D - GUI engine
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
36 3D - 3D-OpenGL engine (There are lots of stuff)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
37 I2C - I2C Bus control
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
38
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
39 This document is mainly related only with OV unit ;)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
40 Video decoding diagram:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
41
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
42 RAM memory: [ App ] Copies YUV image to overlay memory
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
43 | <-- (It's possible to program DMA here)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
44 overlay memory:[ OV ] performs scaling and YUVtoRGB convertion
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
45 /\
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
46 RGB memory: / \
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
47 / [ macrovision ] performs copy protection filtering
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
48 / \ (unneeded but presented by default thing;)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
49 [ CRTC/LCD/DFP DAC ] [ TV DAC ] convert RGB memory to CRTC and NTSC/PAL signals
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
50 | |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
51 [CRTC/LCD/DFP Monitor] [TV-screen]
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
52
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
53 History
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
54 ~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
55 What is history of ATI's chips? I can be wrong but below is my vision
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
56 of this question:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
57
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
58 0. I don't know any earlied chips :(
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
59 1. Mach8
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
60 2. Mach16
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
61 3. Mach32
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
62
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
63 4. Mach64.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
64 It's first chip which has support from side of open
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
65 source drivers. Set of mach64 chips is:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
66 mach64GX (ATI888GX00)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
67 mach64CX (ATI888CX00)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
68 mach64CT (ATI264CT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
69 mach64ET (ATI264ET)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
70 mach64VTA3 (ATI264VT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
71 mach64VTA4 (ATI264VT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
72 mach64VTB (ATI264VTB)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
73 mach64VT4 (ATI264VT4)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
74
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
75 5. 3D rage chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
76 It seems that these chips have fully compatible by GPU with Mach64
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
77 which is extended by 3D possibilities. Set of 3D rage chips is:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
78 3D RAGE (GT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
79 3D RAGE II+ (GTB)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
80 3D RAGE IIC (PCI)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
81 3D RAGE IIC (AGP)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
82 3D RAGE LT
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
83 3D RAGE LT-G
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
84 3D RAGE PRO (BGA, AGP)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
85 3D RAGE PRO (BGA, AGP, 1x only)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
86 3D RAGE PRO (BGA, PCI)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
87 3D RAGE PRO (PQFP, PCI)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
88 3D RAGE PRO (PQFP, PCI, limited 3D)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
89 3D RAGE (XL)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
90 3D RAGE LT PRO (AGP)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
91 3D RAGE LT PRO (PCI)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
92 3D RAGE Mobility (PCI)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
93 3D RAGE Mobility (AGP)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
94
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
95 6. Rage128 chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
96 These chips have perfectly new GPU which supports memory mapped IO
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
97 space for accelerating port access (It's main cause of incompatibility
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
98 with mach64). Set of Rage128 chips is:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
99 Rage128 GL RE
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
100 Rage128 GL RF
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
101 Rage128 GL RG
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
102 Rage128 GL RH
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
103 Rage128 GL RI
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
104 Rage128 VR RK
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
105 Rage128 VR RL
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
106 Rage128 VR RM
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
107 Rage128 VR RN
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
108 Rage128 VR RO
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
109 Rage128 Mobility M3 LE
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
110 Rage128 Mobility M3 LF
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
111 7. Rage128Pro chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
112 These chips are successors of Rage128 ones.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
113 Rage128Pro GL PA
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
114 Rage128Pro GL PB
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
115 Rage128Pro GL PC
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
116 Rage128Pro GL PD
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
117 Rage128Pro GL PE
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
118 Rage128Pro GL PF
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
119 Rage128Pro VR PG
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
120 Rage128Pro VR PH
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
121 Rage128Pro VR PI
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
122 Rage128Pro VR PJ
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
123 Rage128Pro VR PK
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
124 Rage128Pro VR PL
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
125 Rage128Pro VR PM
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
126 Rage128Pro VR PN
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
127 Rage128Pro VR PO
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
128 Rage128Pro VR PP
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
129 Rage128Pro VR PQ
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
130 Rage128Pro VR PR
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
131 Rage128Pro VR TR
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
132 Rage128Pro VR PS
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
133 Rage128Pro VR PT
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
134 Rage128Pro VR PU
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
135 Rage128Pro VR PV
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
136 Rage128Pro VR PW
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
137 Rage128Pro VR PX
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
138 Rage128Pro Ultra U1
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
139 Rage128Pro Ultra U2
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
140 Rage128Pro Ultra U3
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
141
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
142 8. Radeon chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
143 Indeed they could be named Rage256 Pro. (With minor changes is fully
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
144 compatible with Rage128 chips).
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
145 Radeon QD
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
146 Radeon QE
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
147 Radeon QF
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
148 Radeon QG
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
149 Radeon VE QY
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
150 Radeon VE QZ
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
151 Radeon M6 LY
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
152 Radeon M6 LZ
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
153 Radeon M7 LW
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
154 9. Radeon2 chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
155 Indeed they could be named Rage512 Pro.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
156 Radeon2 8500 QL
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
157 Radeon2 7500 QW
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
158
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
159 10. Radeon3 and newest are cooming soon, but I hope that they will be fully
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
160 compatible with Radeon1 chips.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
161
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
162 In Radeon famility there were introduced also FX chips: Radeon FX and
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
163 Radeon2 8700 FX. Probably they have the same possibility as other Radeon
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
164 but currently it's unknown for me.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
165
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
166 What about video overlay and DAC?
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
167 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
168
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
169 Currently it's known that there is only difference between
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
170 Mach64 and Rage128 compatible chips:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
171 - They have different logic of io ports programming!
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
172 - They are incompatible by port numbers!
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
173 But:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
174 - They use the same program logic from register's name point.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
175 (Indeed exists slight difference even between Radeon and Rage128
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
176 chips. AFAIK only Radeon has OV0_SLICE_CNTL register which currently
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
177 is not used by driver. But I know only its name ;). Also there
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
178 is difference in slight adjust of BES position but it's configured
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
179 by #ifdef blocks).
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
180
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
181 Please compare:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
182
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
183 (The piece of Back-End Scaler programming)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
184
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
185 Sample for Mach64 compatible chips:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
186 ***********************************
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
187
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
188 #define SPARSE_IO_BASE 0x03fcu
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
189 #define SPARSE_IO_SELECT 0xfc00u
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
190
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
191 #define BLOCK_IO_BASE 0xff00u
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
192 #define BLOCK_IO_SELECT 0x00fcu
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
193
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
194 #define MM_IO_SELECT 0x03fcu
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
195 #define BLOCK_SELECT 0x0400u
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
196 #define DWORD_SELECT (BLOCK_SELECT | MM_IO_SELECT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
197
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
198 #define IO_BYTE_SELECT 0x0003u
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
199
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
200 #define SPARSE_IO_PORT (SPARSE_IO_BASE | IO_BYTE_SELECT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
201 #define BLOCK_IO_PORT (BLOCK_IO_BASE | IO_BYTE_SELECT)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
202
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
203 #define IOPortTag(_SparseIOSelect, _BlockIOSelect) \
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
204 (SetBits(_SparseIOSelect, SPARSE_IO_SELECT) | \
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
205 SetBits(_BlockIOSelect, BLOCK_SELECT | MM_IO_SELECT))
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
206 #define SparseIOTag(_IOSelect) IOPortTag(_IOSelect, 0)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
207 #define BlockIOTag(_IOSelect) IOPortTag(0, _IOSelect)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
208
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
209 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
210
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
211 #define OVERLAY_Y_X_START BlockIOTag(0x100u)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
212 #define OVERLAY_Y_X_END BlockIOTag(0x101u)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
213
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
214 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
215
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
216 #define OUTREG(_Register, _Value) \
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
217 MMIO_OUT32(pATI->pBlock[GetBits(_Register, BLOCK_SELECT)], \
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
218 (_Register) & MM_IO_SELECT, _Value)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
219
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
220 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
221
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
222 OUTREG(OVERLAY_Y_X_START,((drw_x)<<16)|(drw_y)|(1<<31));
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
223 OUTREG(OVERLAY_Y_X_END,((drw_x+drw_w)<<16)|(drw_y+drw_h));
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
224
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
225
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
226 Sample for Rage128 compatible chips:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
227 ************************************
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
228
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
229 #define OV0_Y_X_START 0x0400
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 22691
diff changeset
230 #define OV0_Y_X_END 0x0404
22691
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
231
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
232 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
233
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
234 #define INREG(addr) readl((rage_mmio_base)+addr)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
235 #define OUTREG(addr,val) writel(val, (rage_mmio_base)+addr)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
236
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
237 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
238
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
239 rage_mmio_base = ioremap_nocache(pci_resource_start (dev, 2),RAGE_REGSIZE);
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
240
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
241 ...
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
242
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
243 #ifdef RADEON
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
244 #define X_ADJUST 8
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
245 #else /* rage128 */
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
246 #define X_ADJUST 0
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
247 #endif
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
248
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
249 OUTREG(OV0_Y_X_START,(drw_x+X_ADJUST)|(drw_y<<16));
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
250 OUTREG(OV0_Y_X_END,(drw_x+drw_w+X_ADJUST)|(drw_y+drw_h)<<16));
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
251
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
252 Thus - these chips have almost the same logic from register's name point.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
253 (except the fact that they have swapped 16-bit halfs).
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
254 Yes - programming of Rage128 is much simpler of Mach64.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
255
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
256
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
257 What about other ATI's chips?
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
258 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
259
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
260 I suggest you have latest copy of GATOS-CVS:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
261 http://www.linuxvideo.org
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
262 GATOS was designed and introduced as General ATI TV and Overlay Sowfware.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
263 You will be able to find out there a lots of useful hacking utilities
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
264 (at location gatos-ati/gatos):
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
265 gfxdump - Program for dumping graphics chips registers on Linux and Windows 9X.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
266 (it's more useful for Win9x to hack their values).
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
267 xatitv - For working with tv-in (currently is under hard development)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
268 atitvout- For working with tv-out
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
269 and lot of other stuff.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
270 BUT: After studing of Gatos and X11 stuffs I've found that they are bad
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
271 optimized for movie playback.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
272 Please compare:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
273 radeon_vid - configures video overlay only once and provides DGA to it.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
274 (doesn't require to be MMX optimized)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
275 gatos and X11 - configures video overlay at every slice of frame, then
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
276 performs unoptimized copying of source stuff to video memory
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
277 often with using CopyMungedData (it's C-analog of YV12_to_YUY2)
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
278 since there are lacks in yv12 support.
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
279 (is not MMX optimized that's gladly accepted, but probably
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
280 will be never optimized due portability).
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
281
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
282 hardware IDCT support diagram:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
283 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
284 |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
285 [ Video parser ] <---------- [ Transport demuxing ] --> [ Audio ]
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
286 | | |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
287 [ Variable length decoder] |D |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
288 | |V |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
289 [ Inverse quantization ] |D |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
290 | | |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
291 -------|---[ video card ]---------+ |s |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
292 | | |u |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
293 [ Run level decode & de-zigzag ] | |b |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
294 | | |p |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
295 [ IDCT ] | |i |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
296 | | |c |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
297 [ Motion compensation ] | |t |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
298 | | |u |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
299 [ Advanced deinterlacing ] | |r |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
300 | | |e |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
301 [ Filtered X-Y scaling ] [SUBPIC]-|-----+s [ OSD ]
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
302 | | | | |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
303 [ 4-bit alpha blending ] <---+ | +-------+
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
304 | |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
305 [ YUV to RGB conversion ] |
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
306 -------|--------------------------+
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
307 TV-screen or CRT-display
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
308
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
309
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
310 Conslusion:
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
311 ~~~~~~~~~~~
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
312
544914dadb52 Move files from radeon/ subdirectory here.
diego
parents:
diff changeset
313 That's all folk!