diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/char/drm/i830_drm.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/char/drm/i830_drm.h')
-rw-r--r-- | drivers/char/drm/i830_drm.h | 350 |
1 files changed, 350 insertions, 0 deletions
diff --git a/drivers/char/drm/i830_drm.h b/drivers/char/drm/i830_drm.h new file mode 100644 index 000000000000..03382c0beee3 --- /dev/null +++ b/drivers/char/drm/i830_drm.h | |||
@@ -0,0 +1,350 @@ | |||
1 | #ifndef _I830_DRM_H_ | ||
2 | #define _I830_DRM_H_ | ||
3 | |||
4 | /* WARNING: These defines must be the same as what the Xserver uses. | ||
5 | * if you change them, you must change the defines in the Xserver. | ||
6 | * | ||
7 | * KW: Actually, you can't ever change them because doing so would | ||
8 | * break backwards compatibility. | ||
9 | */ | ||
10 | |||
11 | #ifndef _I830_DEFINES_ | ||
12 | #define _I830_DEFINES_ | ||
13 | |||
14 | #define I830_DMA_BUF_ORDER 12 | ||
15 | #define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER) | ||
16 | #define I830_DMA_BUF_NR 256 | ||
17 | #define I830_NR_SAREA_CLIPRECTS 8 | ||
18 | |||
19 | /* Each region is a minimum of 64k, and there are at most 64 of them. | ||
20 | */ | ||
21 | #define I830_NR_TEX_REGIONS 64 | ||
22 | #define I830_LOG_MIN_TEX_REGION_SIZE 16 | ||
23 | |||
24 | /* KW: These aren't correct but someone set them to two and then | ||
25 | * released the module. Now we can't change them as doing so would | ||
26 | * break backwards compatibility. | ||
27 | */ | ||
28 | #define I830_TEXTURE_COUNT 2 | ||
29 | #define I830_TEXBLEND_COUNT I830_TEXTURE_COUNT | ||
30 | |||
31 | #define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */ | ||
32 | |||
33 | #define I830_UPLOAD_CTX 0x1 | ||
34 | #define I830_UPLOAD_BUFFERS 0x2 | ||
35 | #define I830_UPLOAD_CLIPRECTS 0x4 | ||
36 | #define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */ | ||
37 | #define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */ | ||
38 | #define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */ | ||
39 | #define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */ | ||
40 | #define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */ | ||
41 | #define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */ | ||
42 | #define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */ | ||
43 | #define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */ | ||
44 | #define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2)) | ||
45 | #define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2)) | ||
46 | #define I830_UPLOAD_TEXIMAGE_MASK 0xff00 | ||
47 | #define I830_UPLOAD_TEX0 0x10000 | ||
48 | #define I830_UPLOAD_TEX1 0x20000 | ||
49 | #define I830_UPLOAD_TEX2 0x40000 | ||
50 | #define I830_UPLOAD_TEX3 0x80000 | ||
51 | #define I830_UPLOAD_TEX_N(n) (0x10000 << (n)) | ||
52 | #define I830_UPLOAD_TEX_MASK 0xf0000 | ||
53 | #define I830_UPLOAD_TEXBLEND0 0x100000 | ||
54 | #define I830_UPLOAD_TEXBLEND1 0x200000 | ||
55 | #define I830_UPLOAD_TEXBLEND2 0x400000 | ||
56 | #define I830_UPLOAD_TEXBLEND3 0x800000 | ||
57 | #define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n)) | ||
58 | #define I830_UPLOAD_TEXBLEND_MASK 0xf00000 | ||
59 | #define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n)) | ||
60 | #define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000 | ||
61 | #define I830_UPLOAD_STIPPLE 0x8000000 | ||
62 | |||
63 | /* Indices into buf.Setup where various bits of state are mirrored per | ||
64 | * context and per buffer. These can be fired at the card as a unit, | ||
65 | * or in a piecewise fashion as required. | ||
66 | */ | ||
67 | |||
68 | /* Destbuffer state | ||
69 | * - backbuffer linear offset and pitch -- invarient in the current dri | ||
70 | * - zbuffer linear offset and pitch -- also invarient | ||
71 | * - drawing origin in back and depth buffers. | ||
72 | * | ||
73 | * Keep the depth/back buffer state here to accommodate private buffers | ||
74 | * in the future. | ||
75 | */ | ||
76 | |||
77 | #define I830_DESTREG_CBUFADDR 0 | ||
78 | #define I830_DESTREG_DBUFADDR 1 | ||
79 | #define I830_DESTREG_DV0 2 | ||
80 | #define I830_DESTREG_DV1 3 | ||
81 | #define I830_DESTREG_SENABLE 4 | ||
82 | #define I830_DESTREG_SR0 5 | ||
83 | #define I830_DESTREG_SR1 6 | ||
84 | #define I830_DESTREG_SR2 7 | ||
85 | #define I830_DESTREG_DR0 8 | ||
86 | #define I830_DESTREG_DR1 9 | ||
87 | #define I830_DESTREG_DR2 10 | ||
88 | #define I830_DESTREG_DR3 11 | ||
89 | #define I830_DESTREG_DR4 12 | ||
90 | #define I830_DEST_SETUP_SIZE 13 | ||
91 | |||
92 | /* Context state | ||
93 | */ | ||
94 | #define I830_CTXREG_STATE1 0 | ||
95 | #define I830_CTXREG_STATE2 1 | ||
96 | #define I830_CTXREG_STATE3 2 | ||
97 | #define I830_CTXREG_STATE4 3 | ||
98 | #define I830_CTXREG_STATE5 4 | ||
99 | #define I830_CTXREG_IALPHAB 5 | ||
100 | #define I830_CTXREG_STENCILTST 6 | ||
101 | #define I830_CTXREG_ENABLES_1 7 | ||
102 | #define I830_CTXREG_ENABLES_2 8 | ||
103 | #define I830_CTXREG_AA 9 | ||
104 | #define I830_CTXREG_FOGCOLOR 10 | ||
105 | #define I830_CTXREG_BLENDCOLR0 11 | ||
106 | #define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */ | ||
107 | #define I830_CTXREG_VF 13 | ||
108 | #define I830_CTXREG_VF2 14 | ||
109 | #define I830_CTXREG_MCSB0 15 | ||
110 | #define I830_CTXREG_MCSB1 16 | ||
111 | #define I830_CTX_SETUP_SIZE 17 | ||
112 | |||
113 | /* 1.3: Stipple state | ||
114 | */ | ||
115 | #define I830_STPREG_ST0 0 | ||
116 | #define I830_STPREG_ST1 1 | ||
117 | #define I830_STP_SETUP_SIZE 2 | ||
118 | |||
119 | |||
120 | /* Texture state (per tex unit) | ||
121 | */ | ||
122 | |||
123 | #define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */ | ||
124 | #define I830_TEXREG_MI1 1 | ||
125 | #define I830_TEXREG_MI2 2 | ||
126 | #define I830_TEXREG_MI3 3 | ||
127 | #define I830_TEXREG_MI4 4 | ||
128 | #define I830_TEXREG_MI5 5 | ||
129 | #define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */ | ||
130 | #define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */ | ||
131 | #define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */ | ||
132 | #define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */ | ||
133 | #define I830_TEX_SETUP_SIZE 10 | ||
134 | |||
135 | #define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */ | ||
136 | #define I830_TEXREG_TM0S0 1 | ||
137 | #define I830_TEXREG_TM0S1 2 | ||
138 | #define I830_TEXREG_TM0S2 3 | ||
139 | #define I830_TEXREG_TM0S3 4 | ||
140 | #define I830_TEXREG_TM0S4 5 | ||
141 | #define I830_TEXREG_NOP0 6 /* noop */ | ||
142 | #define I830_TEXREG_NOP1 7 /* noop */ | ||
143 | #define I830_TEXREG_NOP2 8 /* noop */ | ||
144 | #define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */ | ||
145 | #define __I830_TEX_SETUP_SIZE 10 | ||
146 | |||
147 | #define I830_FRONT 0x1 | ||
148 | #define I830_BACK 0x2 | ||
149 | #define I830_DEPTH 0x4 | ||
150 | |||
151 | #endif /* _I830_DEFINES_ */ | ||
152 | |||
153 | typedef struct _drm_i830_init { | ||
154 | enum { | ||
155 | I830_INIT_DMA = 0x01, | ||
156 | I830_CLEANUP_DMA = 0x02 | ||
157 | } func; | ||
158 | unsigned int mmio_offset; | ||
159 | unsigned int buffers_offset; | ||
160 | int sarea_priv_offset; | ||
161 | unsigned int ring_start; | ||
162 | unsigned int ring_end; | ||
163 | unsigned int ring_size; | ||
164 | unsigned int front_offset; | ||
165 | unsigned int back_offset; | ||
166 | unsigned int depth_offset; | ||
167 | unsigned int w; | ||
168 | unsigned int h; | ||
169 | unsigned int pitch; | ||
170 | unsigned int pitch_bits; | ||
171 | unsigned int back_pitch; | ||
172 | unsigned int depth_pitch; | ||
173 | unsigned int cpp; | ||
174 | } drm_i830_init_t; | ||
175 | |||
176 | /* Warning: If you change the SAREA structure you must change the Xserver | ||
177 | * structure as well */ | ||
178 | |||
179 | typedef struct _drm_i830_tex_region { | ||
180 | unsigned char next, prev; /* indices to form a circular LRU */ | ||
181 | unsigned char in_use; /* owned by a client, or free? */ | ||
182 | int age; /* tracked by clients to update local LRU's */ | ||
183 | } drm_i830_tex_region_t; | ||
184 | |||
185 | typedef struct _drm_i830_sarea { | ||
186 | unsigned int ContextState[I830_CTX_SETUP_SIZE]; | ||
187 | unsigned int BufferState[I830_DEST_SETUP_SIZE]; | ||
188 | unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE]; | ||
189 | unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE]; | ||
190 | unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT]; | ||
191 | unsigned int Palette[2][256]; | ||
192 | unsigned int dirty; | ||
193 | |||
194 | unsigned int nbox; | ||
195 | drm_clip_rect_t boxes[I830_NR_SAREA_CLIPRECTS]; | ||
196 | |||
197 | /* Maintain an LRU of contiguous regions of texture space. If | ||
198 | * you think you own a region of texture memory, and it has an | ||
199 | * age different to the one you set, then you are mistaken and | ||
200 | * it has been stolen by another client. If global texAge | ||
201 | * hasn't changed, there is no need to walk the list. | ||
202 | * | ||
203 | * These regions can be used as a proxy for the fine-grained | ||
204 | * texture information of other clients - by maintaining them | ||
205 | * in the same lru which is used to age their own textures, | ||
206 | * clients have an approximate lru for the whole of global | ||
207 | * texture space, and can make informed decisions as to which | ||
208 | * areas to kick out. There is no need to choose whether to | ||
209 | * kick out your own texture or someone else's - simply eject | ||
210 | * them all in LRU order. | ||
211 | */ | ||
212 | |||
213 | drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS+1]; | ||
214 | /* Last elt is sentinal */ | ||
215 | int texAge; /* last time texture was uploaded */ | ||
216 | int last_enqueue; /* last time a buffer was enqueued */ | ||
217 | int last_dispatch; /* age of the most recently dispatched buffer */ | ||
218 | int last_quiescent; /* */ | ||
219 | int ctxOwner; /* last context to upload state */ | ||
220 | |||
221 | int vertex_prim; | ||
222 | |||
223 | int pf_enabled; /* is pageflipping allowed? */ | ||
224 | int pf_active; | ||
225 | int pf_current_page; /* which buffer is being displayed? */ | ||
226 | |||
227 | int perf_boxes; /* performance boxes to be displayed */ | ||
228 | |||
229 | /* Here's the state for texunits 2,3: | ||
230 | */ | ||
231 | unsigned int TexState2[I830_TEX_SETUP_SIZE]; | ||
232 | unsigned int TexBlendState2[I830_TEXBLEND_SIZE]; | ||
233 | unsigned int TexBlendStateWordsUsed2; | ||
234 | |||
235 | unsigned int TexState3[I830_TEX_SETUP_SIZE]; | ||
236 | unsigned int TexBlendState3[I830_TEXBLEND_SIZE]; | ||
237 | unsigned int TexBlendStateWordsUsed3; | ||
238 | |||
239 | unsigned int StippleState[I830_STP_SETUP_SIZE]; | ||
240 | } drm_i830_sarea_t; | ||
241 | |||
242 | /* Flags for perf_boxes | ||
243 | */ | ||
244 | #define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ | ||
245 | #define I830_BOX_FLIP 0x2 /* populated by kernel */ | ||
246 | #define I830_BOX_WAIT 0x4 /* populated by kernel & client */ | ||
247 | #define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ | ||
248 | #define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ | ||
249 | |||
250 | |||
251 | /* I830 specific ioctls | ||
252 | * The device specific ioctl range is 0x40 to 0x79. | ||
253 | */ | ||
254 | #define DRM_I830_INIT 0x00 | ||
255 | #define DRM_I830_VERTEX 0x01 | ||
256 | #define DRM_I830_CLEAR 0x02 | ||
257 | #define DRM_I830_FLUSH 0x03 | ||
258 | #define DRM_I830_GETAGE 0x04 | ||
259 | #define DRM_I830_GETBUF 0x05 | ||
260 | #define DRM_I830_SWAP 0x06 | ||
261 | #define DRM_I830_COPY 0x07 | ||
262 | #define DRM_I830_DOCOPY 0x08 | ||
263 | #define DRM_I830_FLIP 0x09 | ||
264 | #define DRM_I830_IRQ_EMIT 0x0a | ||
265 | #define DRM_I830_IRQ_WAIT 0x0b | ||
266 | #define DRM_I830_GETPARAM 0x0c | ||
267 | #define DRM_I830_SETPARAM 0x0d | ||
268 | |||
269 | #define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_INIT, drm_i830_init_t) | ||
270 | #define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_VERTEX, drm_i830_vertex_t) | ||
271 | #define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_CLEAR, drm_i830_clear_t) | ||
272 | #define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLUSH) | ||
273 | #define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_GETAGE) | ||
274 | #define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETBUF, drm_i830_dma_t) | ||
275 | #define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_SWAP) | ||
276 | #define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_COPY, drm_i830_copy_t) | ||
277 | #define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_DOCOPY) | ||
278 | #define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLIP) | ||
279 | #define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_EMIT, drm_i830_irq_emit_t) | ||
280 | #define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_WAIT, drm_i830_irq_wait_t) | ||
281 | #define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETPARAM, drm_i830_getparam_t) | ||
282 | #define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_SETPARAM, drm_i830_setparam_t) | ||
283 | |||
284 | typedef struct _drm_i830_clear { | ||
285 | int clear_color; | ||
286 | int clear_depth; | ||
287 | int flags; | ||
288 | unsigned int clear_colormask; | ||
289 | unsigned int clear_depthmask; | ||
290 | } drm_i830_clear_t; | ||
291 | |||
292 | |||
293 | |||
294 | /* These may be placeholders if we have more cliprects than | ||
295 | * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to | ||
296 | * false, indicating that the buffer will be dispatched again with a | ||
297 | * new set of cliprects. | ||
298 | */ | ||
299 | typedef struct _drm_i830_vertex { | ||
300 | int idx; /* buffer index */ | ||
301 | int used; /* nr bytes in use */ | ||
302 | int discard; /* client is finished with the buffer? */ | ||
303 | } drm_i830_vertex_t; | ||
304 | |||
305 | typedef struct _drm_i830_copy_t { | ||
306 | int idx; /* buffer index */ | ||
307 | int used; /* nr bytes in use */ | ||
308 | void __user *address; /* Address to copy from */ | ||
309 | } drm_i830_copy_t; | ||
310 | |||
311 | typedef struct drm_i830_dma { | ||
312 | void __user *virtual; | ||
313 | int request_idx; | ||
314 | int request_size; | ||
315 | int granted; | ||
316 | } drm_i830_dma_t; | ||
317 | |||
318 | |||
319 | /* 1.3: Userspace can request & wait on irq's: | ||
320 | */ | ||
321 | typedef struct drm_i830_irq_emit { | ||
322 | int __user *irq_seq; | ||
323 | } drm_i830_irq_emit_t; | ||
324 | |||
325 | typedef struct drm_i830_irq_wait { | ||
326 | int irq_seq; | ||
327 | } drm_i830_irq_wait_t; | ||
328 | |||
329 | |||
330 | /* 1.3: New ioctl to query kernel params: | ||
331 | */ | ||
332 | #define I830_PARAM_IRQ_ACTIVE 1 | ||
333 | |||
334 | typedef struct drm_i830_getparam { | ||
335 | int param; | ||
336 | int __user *value; | ||
337 | } drm_i830_getparam_t; | ||
338 | |||
339 | |||
340 | /* 1.3: New ioctl to set kernel params: | ||
341 | */ | ||
342 | #define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 | ||
343 | |||
344 | typedef struct drm_i830_setparam { | ||
345 | int param; | ||
346 | int value; | ||
347 | } drm_i830_setparam_t; | ||
348 | |||
349 | |||
350 | #endif /* _I830_DRM_H_ */ | ||