1 /* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- */
2 /*-
3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
5 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All rights reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
26 *
27 * Authors:
28 * Kevin E. Martin <martin@valinux.com>
29 * Gareth Hughes <gareth@valinux.com>
30 * Keith Whitwell <keith@tungstengraphics.com>
31 *
32 * $FreeBSD$
33 */
34
35 #ifndef __RADEON_DRM_H__
36 #define __RADEON_DRM_H__
37
38 /* WARNING: If you change any of these defines, make sure to change the
39 * defines in the X server file (radeon_sarea.h)
40 */
41 #ifndef __RADEON_SAREA_DEFINES__
42 #define __RADEON_SAREA_DEFINES__
43
44 /* Old style state flags, required for sarea interface (1.1 and 1.2
45 * clears) and 1.2 drm_vertex2 ioctl.
46 */
47 #define RADEON_UPLOAD_CONTEXT 0x00000001
48 #define RADEON_UPLOAD_VERTFMT 0x00000002
49 #define RADEON_UPLOAD_LINE 0x00000004
50 #define RADEON_UPLOAD_BUMPMAP 0x00000008
51 #define RADEON_UPLOAD_MASKS 0x00000010
52 #define RADEON_UPLOAD_VIEWPORT 0x00000020
53 #define RADEON_UPLOAD_SETUP 0x00000040
54 #define RADEON_UPLOAD_TCL 0x00000080
55 #define RADEON_UPLOAD_MISC 0x00000100
56 #define RADEON_UPLOAD_TEX0 0x00000200
57 #define RADEON_UPLOAD_TEX1 0x00000400
58 #define RADEON_UPLOAD_TEX2 0x00000800
59 #define RADEON_UPLOAD_TEX0IMAGES 0x00001000
60 #define RADEON_UPLOAD_TEX1IMAGES 0x00002000
61 #define RADEON_UPLOAD_TEX2IMAGES 0x00004000
62 #define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
63 #define RADEON_REQUIRE_QUIESCENCE 0x00010000
64 #define RADEON_UPLOAD_ZBIAS 0x00020000 /* version 1.2 and newer */
65 #define RADEON_UPLOAD_ALL 0x003effff
66 #define RADEON_UPLOAD_CONTEXT_ALL 0x003e01ff
67
68
69 /* New style per-packet identifiers for use in cmd_buffer ioctl with
70 * the RADEON_EMIT_PACKET command. Comments relate new packets to old
71 * state bits and the packet size:
72 */
73 #define RADEON_EMIT_PP_MISC 0 /* context/7 */
74 #define RADEON_EMIT_PP_CNTL 1 /* context/3 */
75 #define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
76 #define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
77 #define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
78 #define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
79 #define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
80 #define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
81 #define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
82 #define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
83 #define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
84 #define RADEON_EMIT_RE_MISC 11 /* misc/1 */
85 #define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
86 #define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
87 #define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
88 #define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
89 #define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
90 #define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
91 #define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
92 #define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
93 #define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
94 #define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
95 #define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
96 #define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
97 #define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
98 #define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
99 #define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
100 #define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
101 #define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
102 #define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/7 */
103 #define R200_EMIT_TFACTOR_0 30 /* tf/7 */
104 #define R200_EMIT_VTX_FMT_0 31 /* vtx/5 */
105 #define R200_EMIT_VAP_CTL 32 /* vap/1 */
106 #define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
107 #define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
108 #define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
109 #define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
110 #define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
111 #define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
112 #define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
113 #define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
114 #define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
115 #define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
116 #define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
117 #define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
118 #define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
119 #define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
120 #define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
121 #define R200_EMIT_VTE_CNTL 48 /* vte/1 */
122 #define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
123 #define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
124 #define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
125 #define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
126 #define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
127 #define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
128 #define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
129 #define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
130 #define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
131 #define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
132 #define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
133 #define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
134 #define R200_EMIT_PP_CUBIC_FACES_0 61
135 #define R200_EMIT_PP_CUBIC_OFFSETS_0 62
136 #define R200_EMIT_PP_CUBIC_FACES_1 63
137 #define R200_EMIT_PP_CUBIC_OFFSETS_1 64
138 #define R200_EMIT_PP_CUBIC_FACES_2 65
139 #define R200_EMIT_PP_CUBIC_OFFSETS_2 66
140 #define R200_EMIT_PP_CUBIC_FACES_3 67
141 #define R200_EMIT_PP_CUBIC_OFFSETS_3 68
142 #define R200_EMIT_PP_CUBIC_FACES_4 69
143 #define R200_EMIT_PP_CUBIC_OFFSETS_4 70
144 #define R200_EMIT_PP_CUBIC_FACES_5 71
145 #define R200_EMIT_PP_CUBIC_OFFSETS_5 72
146 #define RADEON_EMIT_PP_TEX_SIZE_0 73
147 #define RADEON_EMIT_PP_TEX_SIZE_1 74
148 #define RADEON_EMIT_PP_TEX_SIZE_2 75
149 #define R200_EMIT_RB3D_BLENDCOLOR 76
150 #define RADEON_MAX_STATE_PACKETS 77
151
152
153 /* Commands understood by cmd_buffer ioctl. More can be added but
154 * obviously these can't be removed or changed:
155 */
156 #define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
157 #define RADEON_CMD_SCALARS 2 /* emit scalar data */
158 #define RADEON_CMD_VECTORS 3 /* emit vector data */
159 #define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
160 #define RADEON_CMD_PACKET3 5 /* emit hw packet */
161 #define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
162 #define RADEON_CMD_SCALARS2 7 /* r200 stopgap */
163 #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note:
164 * doesn't make the cpu wait, just
165 * the graphics hardware */
166
167
168 typedef union {
169 int i;
170 struct {
171 unsigned char cmd_type, pad0, pad1, pad2;
172 } header;
173 struct {
174 unsigned char cmd_type, packet_id, pad0, pad1;
175 } packet;
176 struct {
177 unsigned char cmd_type, offset, stride, count;
178 } scalars;
179 struct {
180 unsigned char cmd_type, offset, stride, count;
181 } vectors;
182 struct {
183 unsigned char cmd_type, buf_idx, pad0, pad1;
184 } dma;
185 struct {
186 unsigned char cmd_type, flags, pad0, pad1;
187 } wait;
188 } drm_radeon_cmd_header_t;
189
190 #define RADEON_WAIT_2D 0x1
191 #define RADEON_WAIT_3D 0x2
192
193
194 #define RADEON_FRONT 0x1
195 #define RADEON_BACK 0x2
196 #define RADEON_DEPTH 0x4
197 #define RADEON_STENCIL 0x8
198
199 /* Primitive types
200 */
201 #define RADEON_POINTS 0x1
202 #define RADEON_LINES 0x2
203 #define RADEON_LINE_STRIP 0x3
204 #define RADEON_TRIANGLES 0x4
205 #define RADEON_TRIANGLE_FAN 0x5
206 #define RADEON_TRIANGLE_STRIP 0x6
207
208 /* Vertex/indirect buffer size
209 */
210 #define RADEON_BUFFER_SIZE 65536
211
212 /* Byte offsets for indirect buffer data
213 */
214 #define RADEON_INDEX_PRIM_OFFSET 20
215
216 #define RADEON_SCRATCH_REG_OFFSET 32
217
218 #define RADEON_NR_SAREA_CLIPRECTS 12
219
220 /* There are 2 heaps (local/GART). Each region within a heap is a
221 * minimum of 64k, and there are at most 64 of them per heap.
222 */
223 #define RADEON_LOCAL_TEX_HEAP 0
224 #define RADEON_GART_TEX_HEAP 1
225 #define RADEON_NR_TEX_HEAPS 2
226 #define RADEON_NR_TEX_REGIONS 64
227 #define RADEON_LOG_TEX_GRANULARITY 16
228
229 #define RADEON_MAX_TEXTURE_LEVELS 12
230 #define RADEON_MAX_TEXTURE_UNITS 3
231
232 /* Blits have strict offset rules. All blit offset must be aligned on
233 * a 1K-byte boundary.
234 */
235 #define RADEON_OFFSET_SHIFT 10
236 #define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
237 #define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
238
239 #endif /* __RADEON_SAREA_DEFINES__ */
240
241 typedef struct {
242 unsigned int red;
243 unsigned int green;
244 unsigned int blue;
245 unsigned int alpha;
246 } radeon_color_regs_t;
247
248 typedef struct {
249 /* Context state */
250 unsigned int pp_misc; /* 0x1c14 */
251 unsigned int pp_fog_color;
252 unsigned int re_solid_color;
253 unsigned int rb3d_blendcntl;
254 unsigned int rb3d_depthoffset;
255 unsigned int rb3d_depthpitch;
256 unsigned int rb3d_zstencilcntl;
257
258 unsigned int pp_cntl; /* 0x1c38 */
259 unsigned int rb3d_cntl;
260 unsigned int rb3d_coloroffset;
261 unsigned int re_width_height;
262 unsigned int rb3d_colorpitch;
263 unsigned int se_cntl;
264
265 /* Vertex format state */
266 unsigned int se_coord_fmt; /* 0x1c50 */
267
268 /* Line state */
269 unsigned int re_line_pattern; /* 0x1cd0 */
270 unsigned int re_line_state;
271
272 unsigned int se_line_width; /* 0x1db8 */
273
274 /* Bumpmap state */
275 unsigned int pp_lum_matrix; /* 0x1d00 */
276
277 unsigned int pp_rot_matrix_0; /* 0x1d58 */
278 unsigned int pp_rot_matrix_1;
279
280 /* Mask state */
281 unsigned int rb3d_stencilrefmask; /* 0x1d7c */
282 unsigned int rb3d_ropcntl;
283 unsigned int rb3d_planemask;
284
285 /* Viewport state */
286 unsigned int se_vport_xscale; /* 0x1d98 */
287 unsigned int se_vport_xoffset;
288 unsigned int se_vport_yscale;
289 unsigned int se_vport_yoffset;
290 unsigned int se_vport_zscale;
291 unsigned int se_vport_zoffset;
292
293 /* Setup state */
294 unsigned int se_cntl_status; /* 0x2140 */
295
296 /* Misc state */
297 unsigned int re_top_left; /* 0x26c0 */
298 unsigned int re_misc;
299 } drm_radeon_context_regs_t;
300
301 typedef struct {
302 /* Zbias state */
303 unsigned int se_zbias_factor; /* 0x1dac */
304 unsigned int se_zbias_constant;
305 } drm_radeon_context2_regs_t;
306
307
308 /* Setup registers for each texture unit
309 */
310 typedef struct {
311 unsigned int pp_txfilter;
312 unsigned int pp_txformat;
313 unsigned int pp_txoffset;
314 unsigned int pp_txcblend;
315 unsigned int pp_txablend;
316 unsigned int pp_tfactor;
317 unsigned int pp_border_color;
318 } drm_radeon_texture_regs_t;
319
320 typedef struct {
321 unsigned int start;
322 unsigned int finish;
323 unsigned int prim:8;
324 unsigned int stateidx:8;
325 unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
326 unsigned int vc_format; /* vertex format */
327 } drm_radeon_prim_t;
328
329
330 typedef struct {
331 drm_radeon_context_regs_t context;
332 drm_radeon_texture_regs_t tex[RADEON_MAX_TEXTURE_UNITS];
333 drm_radeon_context2_regs_t context2;
334 unsigned int dirty;
335 } drm_radeon_state_t;
336
337
338 typedef struct {
339 /* The channel for communication of state information to the
340 * kernel on firing a vertex buffer with either of the
341 * obsoleted vertex/index ioctls.
342 */
343 drm_radeon_context_regs_t context_state;
344 drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS];
345 unsigned int dirty;
346 unsigned int vertsize;
347 unsigned int vc_format;
348
349 /* The current cliprects, or a subset thereof.
350 */
351 drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS];
352 unsigned int nbox;
353
354 /* Counters for client-side throttling of rendering clients.
355 */
356 unsigned int last_frame;
357 unsigned int last_dispatch;
358 unsigned int last_clear;
359
360 drm_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1];
361 unsigned int tex_age[RADEON_NR_TEX_HEAPS];
362 int ctx_owner;
363 int pfState; /* number of 3d windows (0,1,2ormore) */
364 int pfCurrentPage; /* which buffer is being displayed? */
365 int crtc2_base; /* CRTC2 frame offset */
366 } drm_radeon_sarea_t;
367
368
369 /* WARNING: If you change any of these defines, make sure to change the
370 * defines in the Xserver file (xf86drmRadeon.h)
371 *
372 * KW: actually it's illegal to change any of this (backwards compatibility).
373 */
374
375 /* Radeon specific ioctls
376 * The device specific ioctl range is 0x40 to 0x79.
377 */
378 #define DRM_RADEON_CP_INIT 0x00
379 #define DRM_RADEON_CP_START 0x01
380 #define DRM_RADEON_CP_STOP 0x02
381 #define DRM_RADEON_CP_RESET 0x03
382 #define DRM_RADEON_CP_IDLE 0x04
383 #define DRM_RADEON_RESET 0x05
384 #define DRM_RADEON_FULLSCREEN 0x06
385 #define DRM_RADEON_SWAP 0x07
386 #define DRM_RADEON_CLEAR 0x08
387 #define DRM_RADEON_VERTEX 0x09
388 #define DRM_RADEON_INDICES 0x0A
389 #define DRM_RADEON_NOT_USED
390 #define DRM_RADEON_STIPPLE 0x0C
391 #define DRM_RADEON_INDIRECT 0x0D
392 #define DRM_RADEON_TEXTURE 0x0E
393 #define DRM_RADEON_VERTEX2 0x0F
394 #define DRM_RADEON_CMDBUF 0x10
395 #define DRM_RADEON_GETPARAM 0x11
396 #define DRM_RADEON_FLIP 0x12
397 #define DRM_RADEON_ALLOC 0x13
398 #define DRM_RADEON_FREE 0x14
399 #define DRM_RADEON_INIT_HEAP 0x15
400 #define DRM_RADEON_IRQ_EMIT 0x16
401 #define DRM_RADEON_IRQ_WAIT 0x17
402 #define DRM_RADEON_CP_RESUME 0x18
403 #define DRM_RADEON_SETPARAM 0x19
404
405 #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
406 #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
407 #define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
408 #define DRM_IOCTL_RADEON_CP_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESET)
409 #define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE)
410 #define DRM_IOCTL_RADEON_RESET DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_RESET)
411 #define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t)
412 #define DRM_IOCTL_RADEON_SWAP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_SWAP)
413 #define DRM_IOCTL_RADEON_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t)
414 #define DRM_IOCTL_RADEON_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t)
415 #define DRM_IOCTL_RADEON_INDICES DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t)
416 #define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t)
417 #define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t)
418 #define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t)
419 #define DRM_IOCTL_RADEON_VERTEX2 DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t)
420 #define DRM_IOCTL_RADEON_CMDBUF DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t)
421 #define DRM_IOCTL_RADEON_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t)
422 #define DRM_IOCTL_RADEON_FLIP DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_FLIP)
423 #define DRM_IOCTL_RADEON_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t)
424 #define DRM_IOCTL_RADEON_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t)
425 #define DRM_IOCTL_RADEON_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t)
426 #define DRM_IOCTL_RADEON_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t)
427 #define DRM_IOCTL_RADEON_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t)
428 #define DRM_IOCTL_RADEON_CP_RESUME DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME)
429 #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
430
431 typedef struct drm_radeon_init {
432 enum {
433 RADEON_INIT_CP = 0x01,
434 RADEON_CLEANUP_CP = 0x02,
435 RADEON_INIT_R200_CP = 0x03
436 } func;
437 unsigned long sarea_priv_offset;
438 int is_pci;
439 int cp_mode;
440 int gart_size;
441 int ring_size;
442 int usec_timeout;
443
444 unsigned int fb_bpp;
445 unsigned int front_offset, front_pitch;
446 unsigned int back_offset, back_pitch;
447 unsigned int depth_bpp;
448 unsigned int depth_offset, depth_pitch;
449
450 unsigned long fb_offset;
451 unsigned long mmio_offset;
452 unsigned long ring_offset;
453 unsigned long ring_rptr_offset;
454 unsigned long buffers_offset;
455 unsigned long gart_textures_offset;
456 } drm_radeon_init_t;
457
458 typedef struct drm_radeon_cp_stop {
459 int flush;
460 int idle;
461 } drm_radeon_cp_stop_t;
462
463 typedef struct drm_radeon_fullscreen {
464 enum {
465 RADEON_INIT_FULLSCREEN = 0x01,
466 RADEON_CLEANUP_FULLSCREEN = 0x02
467 } func;
468 } drm_radeon_fullscreen_t;
469
470 #define CLEAR_X1 0
471 #define CLEAR_Y1 1
472 #define CLEAR_X2 2
473 #define CLEAR_Y2 3
474 #define CLEAR_DEPTH 4
475
476 typedef union drm_radeon_clear_rect {
477 float f[5];
478 unsigned int ui[5];
479 } drm_radeon_clear_rect_t;
480
481 typedef struct drm_radeon_clear {
482 unsigned int flags;
483 unsigned int clear_color;
484 unsigned int clear_depth;
485 unsigned int color_mask;
486 unsigned int depth_mask; /* misnamed field: should be stencil */
487 drm_radeon_clear_rect_t *depth_boxes;
488 } drm_radeon_clear_t;
489
490 typedef struct drm_radeon_vertex {
491 int prim;
492 int idx; /* Index of vertex buffer */
493 int count; /* Number of vertices in buffer */
494 int discard; /* Client finished with buffer? */
495 } drm_radeon_vertex_t;
496
497 typedef struct drm_radeon_indices {
498 int prim;
499 int idx;
500 int start;
501 int end;
502 int discard; /* Client finished with buffer? */
503 } drm_radeon_indices_t;
504
505 /* v1.2 - obsoletes drm_radeon_vertex and drm_radeon_indices
506 * - allows multiple primitives and state changes in a single ioctl
507 * - supports driver change to emit native primitives
508 */
509 typedef struct drm_radeon_vertex2 {
510 int idx; /* Index of vertex buffer */
511 int discard; /* Client finished with buffer? */
512 int nr_states;
513 drm_radeon_state_t *state;
514 int nr_prims;
515 drm_radeon_prim_t *prim;
516 } drm_radeon_vertex2_t;
517
518 /* v1.3 - obsoletes drm_radeon_vertex2
519 * - allows arbitarily large cliprect list
520 * - allows updating of tcl packet, vector and scalar state
521 * - allows memory-efficient description of state updates
522 * - allows state to be emitted without a primitive
523 * (for clears, ctx switches)
524 * - allows more than one dma buffer to be referenced per ioctl
525 * - supports tcl driver
526 * - may be extended in future versions with new cmd types, packets
527 */
528 typedef struct drm_radeon_cmd_buffer {
529 int bufsz;
530 char *buf;
531 int nbox;
532 drm_clip_rect_t *boxes;
533 } drm_radeon_cmd_buffer_t;
534
535 typedef struct drm_radeon_tex_image {
536 unsigned int x, y; /* Blit coordinates */
537 unsigned int width, height;
538 const void *data;
539 } drm_radeon_tex_image_t;
540
541 typedef struct drm_radeon_texture {
542 unsigned int offset;
543 int pitch;
544 int format;
545 int width; /* Texture image coordinates */
546 int height;
547 drm_radeon_tex_image_t *image;
548 } drm_radeon_texture_t;
549
550 typedef struct drm_radeon_stipple {
551 unsigned int *mask;
552 } drm_radeon_stipple_t;
553
554 typedef struct drm_radeon_indirect {
555 int idx;
556 int start;
557 int end;
558 int discard;
559 } drm_radeon_indirect_t;
560
561
562 /* 1.3: An ioctl to get parameters that aren't available to the 3d
563 * client any other way.
564 */
565 #define RADEON_PARAM_GART_BUFFER_OFFSET 1 /* card offset of 1st GART buffer */
566 #define RADEON_PARAM_LAST_FRAME 2
567 #define RADEON_PARAM_LAST_DISPATCH 3
568 #define RADEON_PARAM_LAST_CLEAR 4
569 /* Added with DRM version 1.6. */
570 #define RADEON_PARAM_IRQ_NR 5
571 #define RADEON_PARAM_GART_BASE 6 /* card offset of GART base */
572 /* Added with DRM version 1.8. */
573 #define RADEON_PARAM_REGISTER_HANDLE 7 /* for drmMap() */
574 #define RADEON_PARAM_STATUS_HANDLE 8
575 #define RADEON_PARAM_SAREA_HANDLE 9
576 #define RADEON_PARAM_GART_TEX_HANDLE 10
577 #define RADEON_PARAM_SCRATCH_OFFSET 11
578
579 typedef struct drm_radeon_getparam {
580 int param;
581 void *value;
582 } drm_radeon_getparam_t;
583
584 /* 1.6: Set up a memory manager for regions of shared memory:
585 */
586 #define RADEON_MEM_REGION_GART 1
587 #define RADEON_MEM_REGION_FB 2
588
589 typedef struct drm_radeon_mem_alloc {
590 int region;
591 int alignment;
592 int size;
593 int *region_offset; /* offset from start of fb or GART */
594 } drm_radeon_mem_alloc_t;
595
596 typedef struct drm_radeon_mem_free {
597 int region;
598 int region_offset;
599 } drm_radeon_mem_free_t;
600
601 typedef struct drm_radeon_mem_init_heap {
602 int region;
603 int size;
604 int start;
605 } drm_radeon_mem_init_heap_t;
606
607
608 /* 1.6: Userspace can request & wait on irq's:
609 */
610 typedef struct drm_radeon_irq_emit {
611 int *irq_seq;
612 } drm_radeon_irq_emit_t;
613
614 typedef struct drm_radeon_irq_wait {
615 int irq_seq;
616 } drm_radeon_irq_wait_t;
617
618
619 /* 1.10: Clients tell the DRM where they think the framebuffer is located in
620 * the card's address space, via a new generic ioctl to set parameters
621 */
622
623 typedef struct drm_radeon_setparam {
624 unsigned int param;
625 int64_t value;
626 } drm_radeon_setparam_t;
627
628 #define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */
629
630
631 #endif
Cache object: a31ef093c75ff7097b1c23eebe5d5ae5
|