1 |
1275 |
phoenix |
/* 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 |
|
|
* All rights reserved.
|
6 |
|
|
*
|
7 |
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
8 |
|
|
* copy of this software and associated documentation files (the "Software"),
|
9 |
|
|
* to deal in the Software without restriction, including without limitation
|
10 |
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11 |
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
12 |
|
|
* Software is furnished to do so, subject to the following conditions:
|
13 |
|
|
*
|
14 |
|
|
* The above copyright notice and this permission notice (including the next
|
15 |
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
16 |
|
|
* Software.
|
17 |
|
|
*
|
18 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
21 |
|
|
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
22 |
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
23 |
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
24 |
|
|
* DEALINGS IN THE SOFTWARE.
|
25 |
|
|
*
|
26 |
|
|
* Authors:
|
27 |
|
|
* Kevin E. Martin <martin@valinux.com>
|
28 |
|
|
* Gareth Hughes <gareth@valinux.com>
|
29 |
|
|
*
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
|
|
#ifndef __RADEON_DRM_H__
|
33 |
|
|
#define __RADEON_DRM_H__
|
34 |
|
|
|
35 |
|
|
/* WARNING: If you change any of these defines, make sure to change the
|
36 |
|
|
* defines in the X server file (radeon_sarea.h)
|
37 |
|
|
*/
|
38 |
|
|
#ifndef __RADEON_SAREA_DEFINES__
|
39 |
|
|
#define __RADEON_SAREA_DEFINES__
|
40 |
|
|
|
41 |
|
|
/* What needs to be changed for the current vertex buffer?
|
42 |
|
|
*/
|
43 |
|
|
#define RADEON_UPLOAD_CONTEXT 0x00000001
|
44 |
|
|
#define RADEON_UPLOAD_VERTFMT 0x00000002
|
45 |
|
|
#define RADEON_UPLOAD_LINE 0x00000004
|
46 |
|
|
#define RADEON_UPLOAD_BUMPMAP 0x00000008
|
47 |
|
|
#define RADEON_UPLOAD_MASKS 0x00000010
|
48 |
|
|
#define RADEON_UPLOAD_VIEWPORT 0x00000020
|
49 |
|
|
#define RADEON_UPLOAD_SETUP 0x00000040
|
50 |
|
|
#define RADEON_UPLOAD_TCL 0x00000080
|
51 |
|
|
#define RADEON_UPLOAD_MISC 0x00000100
|
52 |
|
|
#define RADEON_UPLOAD_TEX0 0x00000200
|
53 |
|
|
#define RADEON_UPLOAD_TEX1 0x00000400
|
54 |
|
|
#define RADEON_UPLOAD_TEX2 0x00000800
|
55 |
|
|
#define RADEON_UPLOAD_TEX0IMAGES 0x00001000
|
56 |
|
|
#define RADEON_UPLOAD_TEX1IMAGES 0x00002000
|
57 |
|
|
#define RADEON_UPLOAD_TEX2IMAGES 0x00004000
|
58 |
|
|
#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
|
59 |
|
|
#define RADEON_REQUIRE_QUIESCENCE 0x00010000
|
60 |
|
|
#define RADEON_UPLOAD_ALL 0x0001ffff
|
61 |
|
|
|
62 |
|
|
#define RADEON_FRONT 0x1
|
63 |
|
|
#define RADEON_BACK 0x2
|
64 |
|
|
#define RADEON_DEPTH 0x4
|
65 |
|
|
|
66 |
|
|
/* Primitive types
|
67 |
|
|
*/
|
68 |
|
|
#define RADEON_POINTS 0x1
|
69 |
|
|
#define RADEON_LINES 0x2
|
70 |
|
|
#define RADEON_LINE_STRIP 0x3
|
71 |
|
|
#define RADEON_TRIANGLES 0x4
|
72 |
|
|
#define RADEON_TRIANGLE_FAN 0x5
|
73 |
|
|
#define RADEON_TRIANGLE_STRIP 0x6
|
74 |
|
|
|
75 |
|
|
/* Vertex/indirect buffer size
|
76 |
|
|
*/
|
77 |
|
|
#define RADEON_BUFFER_SIZE 16384
|
78 |
|
|
|
79 |
|
|
/* Byte offsets for indirect buffer data
|
80 |
|
|
*/
|
81 |
|
|
#define RADEON_INDEX_PRIM_OFFSET 20
|
82 |
|
|
#define RADEON_HOSTDATA_BLIT_OFFSET 32
|
83 |
|
|
|
84 |
|
|
#define RADEON_SCRATCH_REG_OFFSET 32
|
85 |
|
|
|
86 |
|
|
/* Keep these small for testing
|
87 |
|
|
*/
|
88 |
|
|
#define RADEON_NR_SAREA_CLIPRECTS 12
|
89 |
|
|
|
90 |
|
|
/* There are 2 heaps (local/AGP). Each region within a heap is a
|
91 |
|
|
* minimum of 64k, and there are at most 64 of them per heap.
|
92 |
|
|
*/
|
93 |
|
|
#define RADEON_LOCAL_TEX_HEAP 0
|
94 |
|
|
#define RADEON_AGP_TEX_HEAP 1
|
95 |
|
|
#define RADEON_NR_TEX_HEAPS 2
|
96 |
|
|
#define RADEON_NR_TEX_REGIONS 64
|
97 |
|
|
#define RADEON_LOG_TEX_GRANULARITY 16
|
98 |
|
|
|
99 |
|
|
#define RADEON_MAX_TEXTURE_LEVELS 11
|
100 |
|
|
#define RADEON_MAX_TEXTURE_UNITS 3
|
101 |
|
|
|
102 |
|
|
#endif /* __RADEON_SAREA_DEFINES__ */
|
103 |
|
|
|
104 |
|
|
typedef struct {
|
105 |
|
|
unsigned int red;
|
106 |
|
|
unsigned int green;
|
107 |
|
|
unsigned int blue;
|
108 |
|
|
unsigned int alpha;
|
109 |
|
|
} radeon_color_regs_t;
|
110 |
|
|
|
111 |
|
|
typedef struct {
|
112 |
|
|
/* Context state */
|
113 |
|
|
unsigned int pp_misc; /* 0x1c14 */
|
114 |
|
|
unsigned int pp_fog_color;
|
115 |
|
|
unsigned int re_solid_color;
|
116 |
|
|
unsigned int rb3d_blendcntl;
|
117 |
|
|
unsigned int rb3d_depthoffset;
|
118 |
|
|
unsigned int rb3d_depthpitch;
|
119 |
|
|
unsigned int rb3d_zstencilcntl;
|
120 |
|
|
|
121 |
|
|
unsigned int pp_cntl; /* 0x1c38 */
|
122 |
|
|
unsigned int rb3d_cntl;
|
123 |
|
|
unsigned int rb3d_coloroffset;
|
124 |
|
|
unsigned int re_width_height;
|
125 |
|
|
unsigned int rb3d_colorpitch;
|
126 |
|
|
unsigned int se_cntl;
|
127 |
|
|
|
128 |
|
|
/* Vertex format state */
|
129 |
|
|
unsigned int se_coord_fmt; /* 0x1c50 */
|
130 |
|
|
|
131 |
|
|
/* Line state */
|
132 |
|
|
unsigned int re_line_pattern; /* 0x1cd0 */
|
133 |
|
|
unsigned int re_line_state;
|
134 |
|
|
|
135 |
|
|
unsigned int se_line_width; /* 0x1db8 */
|
136 |
|
|
|
137 |
|
|
/* Bumpmap state */
|
138 |
|
|
unsigned int pp_lum_matrix; /* 0x1d00 */
|
139 |
|
|
|
140 |
|
|
unsigned int pp_rot_matrix_0; /* 0x1d58 */
|
141 |
|
|
unsigned int pp_rot_matrix_1;
|
142 |
|
|
|
143 |
|
|
/* Mask state */
|
144 |
|
|
unsigned int rb3d_stencilrefmask; /* 0x1d7c */
|
145 |
|
|
unsigned int rb3d_ropcntl;
|
146 |
|
|
unsigned int rb3d_planemask;
|
147 |
|
|
|
148 |
|
|
/* Viewport state */
|
149 |
|
|
unsigned int se_vport_xscale; /* 0x1d98 */
|
150 |
|
|
unsigned int se_vport_xoffset;
|
151 |
|
|
unsigned int se_vport_yscale;
|
152 |
|
|
unsigned int se_vport_yoffset;
|
153 |
|
|
unsigned int se_vport_zscale;
|
154 |
|
|
unsigned int se_vport_zoffset;
|
155 |
|
|
|
156 |
|
|
/* Setup state */
|
157 |
|
|
unsigned int se_cntl_status; /* 0x2140 */
|
158 |
|
|
|
159 |
|
|
#ifdef TCL_ENABLE
|
160 |
|
|
/* TCL state */
|
161 |
|
|
radeon_color_regs_t se_tcl_material_emmissive; /* 0x2210 */
|
162 |
|
|
radeon_color_regs_t se_tcl_material_ambient;
|
163 |
|
|
radeon_color_regs_t se_tcl_material_diffuse;
|
164 |
|
|
radeon_color_regs_t se_tcl_material_specular;
|
165 |
|
|
unsigned int se_tcl_shininess;
|
166 |
|
|
unsigned int se_tcl_output_vtx_fmt;
|
167 |
|
|
unsigned int se_tcl_output_vtx_sel;
|
168 |
|
|
unsigned int se_tcl_matrix_select_0;
|
169 |
|
|
unsigned int se_tcl_matrix_select_1;
|
170 |
|
|
unsigned int se_tcl_ucp_vert_blend_ctl;
|
171 |
|
|
unsigned int se_tcl_texture_proc_ctl;
|
172 |
|
|
unsigned int se_tcl_light_model_ctl;
|
173 |
|
|
unsigned int se_tcl_per_light_ctl[4];
|
174 |
|
|
#endif
|
175 |
|
|
|
176 |
|
|
/* Misc state */
|
177 |
|
|
unsigned int re_top_left; /* 0x26c0 */
|
178 |
|
|
unsigned int re_misc;
|
179 |
|
|
} drm_radeon_context_regs_t;
|
180 |
|
|
|
181 |
|
|
/* Setup registers for each texture unit
|
182 |
|
|
*/
|
183 |
|
|
typedef struct {
|
184 |
|
|
unsigned int pp_txfilter;
|
185 |
|
|
unsigned int pp_txformat;
|
186 |
|
|
unsigned int pp_txoffset;
|
187 |
|
|
unsigned int pp_txcblend;
|
188 |
|
|
unsigned int pp_txablend;
|
189 |
|
|
unsigned int pp_tfactor;
|
190 |
|
|
|
191 |
|
|
unsigned int pp_border_color;
|
192 |
|
|
|
193 |
|
|
#ifdef CUBIC_ENABLE
|
194 |
|
|
unsigned int pp_cubic_faces;
|
195 |
|
|
unsigned int pp_cubic_offset[5];
|
196 |
|
|
#endif
|
197 |
|
|
} drm_radeon_texture_regs_t;
|
198 |
|
|
|
199 |
|
|
typedef struct {
|
200 |
|
|
unsigned char next, prev;
|
201 |
|
|
unsigned char in_use;
|
202 |
|
|
int age;
|
203 |
|
|
} drm_radeon_tex_region_t;
|
204 |
|
|
|
205 |
|
|
typedef struct {
|
206 |
|
|
/* The channel for communication of state information to the kernel
|
207 |
|
|
* on firing a vertex buffer.
|
208 |
|
|
*/
|
209 |
|
|
drm_radeon_context_regs_t context_state;
|
210 |
|
|
drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS];
|
211 |
|
|
unsigned int dirty;
|
212 |
|
|
unsigned int vertsize;
|
213 |
|
|
unsigned int vc_format;
|
214 |
|
|
|
215 |
|
|
/* The current cliprects, or a subset thereof.
|
216 |
|
|
*/
|
217 |
|
|
drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS];
|
218 |
|
|
unsigned int nbox;
|
219 |
|
|
|
220 |
|
|
/* Counters for client-side throttling of rendering clients.
|
221 |
|
|
*/
|
222 |
|
|
unsigned int last_frame;
|
223 |
|
|
unsigned int last_dispatch;
|
224 |
|
|
unsigned int last_clear;
|
225 |
|
|
|
226 |
|
|
drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1];
|
227 |
|
|
int tex_age[RADEON_NR_TEX_HEAPS];
|
228 |
|
|
int ctx_owner;
|
229 |
|
|
} drm_radeon_sarea_t;
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
/* WARNING: If you change any of these defines, make sure to change the
|
233 |
|
|
* defines in the Xserver file (xf86drmRadeon.h)
|
234 |
|
|
*/
|
235 |
|
|
typedef struct drm_radeon_init {
|
236 |
|
|
enum {
|
237 |
|
|
RADEON_INIT_CP = 0x01,
|
238 |
|
|
RADEON_CLEANUP_CP = 0x02
|
239 |
|
|
} func;
|
240 |
|
|
int sarea_priv_offset;
|
241 |
|
|
int is_pci;
|
242 |
|
|
int cp_mode;
|
243 |
|
|
int agp_size;
|
244 |
|
|
int ring_size;
|
245 |
|
|
int usec_timeout;
|
246 |
|
|
|
247 |
|
|
unsigned int fb_bpp;
|
248 |
|
|
unsigned int front_offset, front_pitch;
|
249 |
|
|
unsigned int back_offset, back_pitch;
|
250 |
|
|
unsigned int depth_bpp;
|
251 |
|
|
unsigned int depth_offset, depth_pitch;
|
252 |
|
|
|
253 |
|
|
unsigned int fb_offset;
|
254 |
|
|
unsigned int mmio_offset;
|
255 |
|
|
unsigned int ring_offset;
|
256 |
|
|
unsigned int ring_rptr_offset;
|
257 |
|
|
unsigned int buffers_offset;
|
258 |
|
|
unsigned int agp_textures_offset;
|
259 |
|
|
} drm_radeon_init_t;
|
260 |
|
|
|
261 |
|
|
typedef struct drm_radeon_cp_stop {
|
262 |
|
|
int flush;
|
263 |
|
|
int idle;
|
264 |
|
|
} drm_radeon_cp_stop_t;
|
265 |
|
|
|
266 |
|
|
typedef struct drm_radeon_fullscreen {
|
267 |
|
|
enum {
|
268 |
|
|
RADEON_INIT_FULLSCREEN = 0x01,
|
269 |
|
|
RADEON_CLEANUP_FULLSCREEN = 0x02
|
270 |
|
|
} func;
|
271 |
|
|
} drm_radeon_fullscreen_t;
|
272 |
|
|
|
273 |
|
|
#define CLEAR_X1 0
|
274 |
|
|
#define CLEAR_Y1 1
|
275 |
|
|
#define CLEAR_X2 2
|
276 |
|
|
#define CLEAR_Y2 3
|
277 |
|
|
#define CLEAR_DEPTH 4
|
278 |
|
|
|
279 |
|
|
typedef struct drm_radeon_clear {
|
280 |
|
|
unsigned int flags;
|
281 |
|
|
int x, y, w, h;
|
282 |
|
|
unsigned int clear_color;
|
283 |
|
|
unsigned int clear_depth;
|
284 |
|
|
union {
|
285 |
|
|
float f[5];
|
286 |
|
|
unsigned int ui[5];
|
287 |
|
|
} rect;
|
288 |
|
|
} drm_radeon_clear_t;
|
289 |
|
|
|
290 |
|
|
typedef struct drm_radeon_vertex {
|
291 |
|
|
int prim;
|
292 |
|
|
int idx; /* Index of vertex buffer */
|
293 |
|
|
int count; /* Number of vertices in buffer */
|
294 |
|
|
int discard; /* Client finished with buffer? */
|
295 |
|
|
} drm_radeon_vertex_t;
|
296 |
|
|
|
297 |
|
|
typedef struct drm_radeon_indices {
|
298 |
|
|
int prim;
|
299 |
|
|
int idx;
|
300 |
|
|
int start;
|
301 |
|
|
int end;
|
302 |
|
|
int discard; /* Client finished with buffer? */
|
303 |
|
|
} drm_radeon_indices_t;
|
304 |
|
|
|
305 |
|
|
typedef struct drm_radeon_blit {
|
306 |
|
|
int idx;
|
307 |
|
|
int pitch;
|
308 |
|
|
int offset;
|
309 |
|
|
int format;
|
310 |
|
|
unsigned short x, y;
|
311 |
|
|
unsigned short width, height;
|
312 |
|
|
} drm_radeon_blit_t;
|
313 |
|
|
|
314 |
|
|
typedef struct drm_radeon_stipple {
|
315 |
|
|
unsigned int *mask;
|
316 |
|
|
} drm_radeon_stipple_t;
|
317 |
|
|
|
318 |
|
|
typedef struct drm_radeon_indirect {
|
319 |
|
|
int idx;
|
320 |
|
|
int start;
|
321 |
|
|
int end;
|
322 |
|
|
int discard;
|
323 |
|
|
} drm_radeon_indirect_t;
|
324 |
|
|
|
325 |
|
|
#endif
|