1 /* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
2 * ffb_drv.h: Creator/Creator3D direct rendering driver.
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
7 /* Auxilliary clips. */
9 volatile unsigned int min
;
10 volatile unsigned int max
;
11 } ffb_auxclip
, *ffb_auxclipPtr
;
13 /* FFB register set. */
14 typedef struct _ffb_fbc
{
15 /* Next vertex registers, on the right we list which drawops
16 * use said register and the logical name the register has in
18 *//* DESCRIPTION DRAWOP(NAME) */
19 /*0x00*/ unsigned int pad1
[3];
21 /*0x0c*/ volatile unsigned int alpha
;
22 /* ALPHA Transparency */
23 /*0x10*/ volatile unsigned int red
;
25 /*0x14*/ volatile unsigned int green
;
27 /*0x18*/ volatile unsigned int blue
;
29 /*0x1c*/ volatile unsigned int z
;
31 /*0x20*/ volatile unsigned int y
;
32 /* Y triangle(DOYF) */
36 /*0x24*/ volatile unsigned int x
;
37 /* X triangle(DOXF) */
41 /*0x28*/ unsigned int pad2
[2];
43 /*0x30*/ volatile unsigned int ryf
;
44 /* Y (alias to DOYF) ddline(RYF) */
47 /*0x34*/ volatile unsigned int rxf
;
51 /*0x38*/ unsigned int pad3
[2];
53 /*0x40*/ volatile unsigned int dmyf
;
54 /* Y (alias to DOYF) triangle(DMYF) */
55 /*0x44*/ volatile unsigned int dmxf
;
56 /* X triangle(DMXF) */
57 /*0x48*/ unsigned int pad4
[2];
59 /*0x50*/ volatile unsigned int ebyi
;
60 /* Y (alias to RYI) polygon(EBYI) */
61 /*0x54*/ volatile unsigned int ebxi
;
63 /*0x58*/ unsigned int pad5
[2];
65 /*0x60*/ volatile unsigned int by
;
72 /*0x64*/ volatile unsigned int bx
;
79 /*0x68*/ volatile unsigned int dy
;
80 /* destination Y fastfill(DSTY) */
83 /*0x6c*/ volatile unsigned int dx
;
84 /* destination X fastfill(DSTX) */
87 /*0x70*/ volatile unsigned int bh
;
88 /* Y (alias to RYI) brline(DYI) */
91 /* Height fastfill(H) */
94 /* Y count fastfill(NY) */
95 /*0x74*/ volatile unsigned int bw
;
103 /*0x78*/ unsigned int pad6
[2];
105 /*0x80*/ unsigned int pad7
[32];
108 /* Setup Unit's vertex state register */
109 /*100*/ volatile unsigned int suvtx
;
110 /*104*/ unsigned int pad8
[63];
113 /* Frame Buffer Control Registers */
114 /*200*/ volatile unsigned int ppc
;
115 /* Pixel Processor Control */
116 /*204*/ volatile unsigned int wid
;
118 /*208*/ volatile unsigned int fg
;
120 /*20c*/ volatile unsigned int bg
;
122 /*210*/ volatile unsigned int consty
;
124 /*214*/ volatile unsigned int constz
;
126 /*218*/ volatile unsigned int xclip
;
128 /*21c*/ volatile unsigned int dcss
;
129 /* Depth Cue Scale Slope */
130 /*220*/ volatile unsigned int vclipmin
;
131 /* Viewclip XY Min Bounds */
132 /*224*/ volatile unsigned int vclipmax
;
133 /* Viewclip XY Max Bounds */
134 /*228*/ volatile unsigned int vclipzmin
;
135 /* Viewclip Z Min Bounds */
136 /*22c*/ volatile unsigned int vclipzmax
;
137 /* Viewclip Z Max Bounds */
138 /*230*/ volatile unsigned int dcsf
;
139 /* Depth Cue Scale Front Bound */
140 /*234*/ volatile unsigned int dcsb
;
141 /* Depth Cue Scale Back Bound */
142 /*238*/ volatile unsigned int dczf
;
143 /* Depth Cue Z Front */
144 /*23c*/ volatile unsigned int dczb
;
145 /* Depth Cue Z Back */
146 /*240*/ unsigned int pad9
;
148 /*244*/ volatile unsigned int blendc
;
149 /* Alpha Blend Control */
150 /*248*/ volatile unsigned int blendc1
;
151 /* Alpha Blend Color 1 */
152 /*24c*/ volatile unsigned int blendc2
;
153 /* Alpha Blend Color 2 */
154 /*250*/ volatile unsigned int fbramitc
;
155 /* FB RAM Interleave Test Control */
156 /*254*/ volatile unsigned int fbc
;
157 /* Frame Buffer Control */
158 /*258*/ volatile unsigned int rop
;
159 /* Raster OPeration */
160 /*25c*/ volatile unsigned int cmp
;
161 /* Frame Buffer Compare */
162 /*260*/ volatile unsigned int matchab
;
163 /* Buffer AB Match Mask */
164 /*264*/ volatile unsigned int matchc
;
165 /* Buffer C(YZ) Match Mask */
166 /*268*/ volatile unsigned int magnab
;
167 /* Buffer AB Magnitude Mask */
168 /*26c*/ volatile unsigned int magnc
;
169 /* Buffer C(YZ) Magnitude Mask */
170 /*270*/ volatile unsigned int fbcfg0
;
171 /* Frame Buffer Config 0 */
172 /*274*/ volatile unsigned int fbcfg1
;
173 /* Frame Buffer Config 1 */
174 /*278*/ volatile unsigned int fbcfg2
;
175 /* Frame Buffer Config 2 */
176 /*27c*/ volatile unsigned int fbcfg3
;
177 /* Frame Buffer Config 3 */
178 /*280*/ volatile unsigned int ppcfg
;
179 /* Pixel Processor Config */
180 /*284*/ volatile unsigned int pick
;
181 /* Picking Control */
182 /*288*/ volatile unsigned int fillmode
;
184 /*28c*/ volatile unsigned int fbramwac
;
185 /* FB RAM Write Address Control */
186 /*290*/ volatile unsigned int pmask
;
188 /*294*/ volatile unsigned int xpmask
;
190 /*298*/ volatile unsigned int ypmask
;
192 /*29c*/ volatile unsigned int zpmask
;
194 /*2a0*/ ffb_auxclip auxclip
[4];
195 /* Auxilliary Viewport Clip */
197 /* New 3dRAM III support regs */
198 /*2c0*/ volatile unsigned int rawblend2
;
199 /*2c4*/ volatile unsigned int rawpreblend
;
200 /*2c8*/ volatile unsigned int rawstencil
;
201 /*2cc*/ volatile unsigned int rawstencilctl
;
202 /*2d0*/ volatile unsigned int threedram1
;
203 /*2d4*/ volatile unsigned int threedram2
;
204 /*2d8*/ volatile unsigned int passin
;
205 /*2dc*/ volatile unsigned int rawclrdepth
;
206 /*2e0*/ volatile unsigned int rawpmask
;
207 /*2e4*/ volatile unsigned int rawcsrc
;
208 /*2e8*/ volatile unsigned int rawmatch
;
209 /*2ec*/ volatile unsigned int rawmagn
;
210 /*2f0*/ volatile unsigned int rawropblend
;
211 /*2f4*/ volatile unsigned int rawcmp
;
212 /*2f8*/ volatile unsigned int rawwac
;
213 /*2fc*/ volatile unsigned int fbramid
;
215 /*300*/ volatile unsigned int drawop
;
217 /*304*/ unsigned int pad10
[2];
219 /*30c*/ volatile unsigned int lpat
;
220 /* Line Pattern control */
221 /*310*/ unsigned int pad11
;
223 /*314*/ volatile unsigned int fontxy
;
224 /* XY Font coordinate */
225 /*318*/ volatile unsigned int fontw
;
227 /*31c*/ volatile unsigned int fontinc
;
229 /*320*/ volatile unsigned int font
;
231 /*324*/ unsigned int pad12
[3];
233 /*330*/ volatile unsigned int blend2
;
234 /*334*/ volatile unsigned int preblend
;
235 /*338*/ volatile unsigned int stencil
;
236 /*33c*/ volatile unsigned int stencilctl
;
238 /*340*/ unsigned int pad13
[4];
240 /*350*/ volatile unsigned int dcss1
;
241 /* Depth Cue Scale Slope 1 */
242 /*354*/ volatile unsigned int dcss2
;
243 /* Depth Cue Scale Slope 2 */
244 /*358*/ volatile unsigned int dcss3
;
245 /* Depth Cue Scale Slope 3 */
246 /*35c*/ volatile unsigned int widpmask
;
247 /*360*/ volatile unsigned int dcs2
;
248 /*364*/ volatile unsigned int dcs3
;
249 /*368*/ volatile unsigned int dcs4
;
250 /*36c*/ unsigned int pad14
;
252 /*370*/ volatile unsigned int dcd2
;
253 /*374*/ volatile unsigned int dcd3
;
254 /*378*/ volatile unsigned int dcd4
;
255 /*37c*/ unsigned int pad15
;
257 /*380*/ volatile unsigned int pattern
[32];
259 /*400*/ unsigned int pad16
[8];
261 /*420*/ volatile unsigned int reset
;
263 /*424*/ unsigned int pad17
[247];
265 /*800*/ volatile unsigned int devid
;
267 /*804*/ unsigned int pad18
[63];
269 /*900*/ volatile unsigned int ucsr
;
270 /* User Control & Status Register */
271 /*904*/ unsigned int pad19
[31];
273 /*980*/ volatile unsigned int mer
;
274 /* Mode Enable Register */
275 /*984*/ unsigned int pad20
[1439];
277 } ffb_fbc
, *ffb_fbcPtr
;
279 struct ffb_hw_context
{
290 unsigned int vclipmin
;
291 unsigned int vclipmax
;
292 unsigned int vclipzmin
;
293 unsigned int vclipzmax
;
299 unsigned int blendc1
;
300 unsigned int blendc2
;
304 unsigned int matchab
;
312 unsigned int auxclip0min
;
313 unsigned int auxclip0max
;
314 unsigned int auxclip1min
;
315 unsigned int auxclip1max
;
316 unsigned int auxclip2min
;
317 unsigned int auxclip2max
;
318 unsigned int auxclip3min
;
319 unsigned int auxclip3max
;
324 unsigned int fontinc
;
325 unsigned int area_pattern
[32];
327 unsigned int stencil
;
328 unsigned int stencilctl
;
341 #define FFB_MAX_CTXS 32
344 ffb1_prototype
= 0, /* Early pre-FCS FFB */
345 ffb1_standard
, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
346 ffb1_speedsort
, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
347 ffb2_prototype
, /* Early pre-FCS vertical FFB2 */
348 ffb2_vertical
, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
349 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
350 ffb2_vertical_plus
, /* Second FCS FFB2/vertical, same timings */
351 ffb2_horizontal
, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
352 ffb2_horizontal_plus
, /* Second FCS FFB2/horizontal, same timings */
353 afb_m3
, /* FCS Elite3D, 3 float chips */
354 afb_m6
/* FCS Elite3D, 6 float chips */
357 typedef struct ffb_dev_priv
{
358 /* Misc software state. */
360 enum ffb_chip_type ffb_type
;
362 struct miscdevice miscdev
;
364 /* Controller registers. */
368 struct ffb_hw_context
*hw_state
[FFB_MAX_CTXS
];
371 extern unsigned long ffb_get_unmapped_area(struct file
*filp
,
375 unsigned long flags
);
376 extern void ffb_set_context_ioctls(void);
377 extern drm_ioctl_desc_t
DRM(ioctls
)[];
379 extern int ffb_driver_context_switch(drm_device_t
* dev
, int old
, int new);