blob: e2627e30c8b258dd069708b4893a23e0971f612f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
/*
* Copyright © 2010 Jerome Glisse <glisse@freedesktop.org>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef R600_WINSYS_H
#define R600_WINSYS_H
#include "radeon_bo.h"
typedef uint64_t u64;
typedef uint32_t u32;
typedef uint8_t u8;
/* opaque structure */
struct r600_winsys;
struct r600_atom;
#define R600_ATOM_FRAMEBUFFER 1
#define R600_ATOM_RASTERIZER 2
#define R600_ATOM_CB_CNTL 3
#define R600_ATOM_VIEWPORT 4
#define R600_ATOM_SCISSOR 5
#define R600_ATOM_BLEND 6
#define R600_ATOM_CONSTANTS 7
#define R600_ATOM_DEPTH 8
#define R600_ATOM_VS_SHADER 9
#define R600_ATOM_PS_SHADER 10
#define R600_BATCH_NATOMS 11
struct drm_r600_surface {
u32 width;
u32 height;
u32 color_info;
u32 cb_target_mask;
u32 cb_shader_mask;
u32 nsamples;
u32 offset;
u32 placements[2];
u32 handle;
};
struct drm_r600_framebuffer {
u32 width;
u32 height;
u32 ncb;
struct drm_r600_surface cb[8];
u32 db_offset;
u32 db_placements[2];
u32 db_handle;
u32 db_depth_size;
u32 db_depth_view;
u32 db_depth_info;
u32 db_htile_surface;
u32 db_prefetch_limit;
};
struct drm_r600_cb_cntl {
u32 cb_clrcmp_control;
u32 cb_clrcmp_src;
u32 cb_clrcmp_dst;
u32 cb_clrcmp_msk;
u32 cb_color_control;
u32 cb_blend_alpha;
u32 cb_blend_blue;
u32 cb_blend_green;
u32 cb_blend_red;
u32 cb_clear_alpha;
u32 cb_clear_blue;
u32 cb_clear_green;
u32 cb_clear_red;
u32 cb_fog_blue;
u32 cb_fog_green;
u32 cb_fog_red;
};
/* pa - primitive assembly */
struct drm_r600_rasterizer {
u32 pa_sc_mpass_ps_cntl;
u32 pa_sc_line_cntl;
u32 pa_sc_aa_config;
u32 pa_sc_aa_sample_locs_mctx;
u32 pa_sc_aa_mask;
u32 pa_cl_clip_cntl;
u32 pa_cl_vs_out_cntl;
u32 pa_cl_naninf_cntl;
u32 pa_cl_gb_vert_clip_adj;
u32 pa_cl_gb_vert_disc_adj;
u32 pa_cl_gb_horz_clip_adj;
u32 pa_cl_gb_horz_disc_adj;
u32 pa_su_sc_mode_cntl;
u32 pa_su_point_size;
u32 pa_su_point_minmax;
u32 pa_su_line_cntl;
u32 pa_sc_line_stipple;
u32 pa_su_poly_offset_db_fmt_cntl;
u32 pa_su_poly_offset_clamp;
u32 pa_su_poly_offset_front_scale;
u32 pa_su_poly_offset_front_offset;
u32 pa_su_poly_offset_back_scale;
u32 pa_su_poly_offset_back_offset;
};
/* vport - viewport */
struct drm_r600_viewport {
u32 pa_cl_vte_cntl;
u32 pa_cl_vport_xscale_0;
u32 pa_cl_vport_yscale_0;
u32 pa_cl_vport_zscale_0;
u32 pa_cl_vport_xoffset_0;
u32 pa_cl_vport_yoffset_0;
u32 pa_cl_vport_zoffset_0;
};
/* pipe_scissor_state */
struct drm_r600_scissor {
u32 pa_sc_vport_scissor_0_tl;
u32 pa_sc_vport_scissor_0_br;
};
/* blend - blending */
struct drm_r600_blend {
u32 cb_blend0_control;
u32 cb_blend1_control;
u32 cb_blend2_control;
u32 cb_blend3_control;
u32 cb_blend4_control;
u32 cb_blend5_control;
u32 cb_blend6_control;
u32 cb_blend7_control;
u32 cb_blend_control;
};
/* constant */
struct drm_r600_constants {
u32 offset;
u32 nconstants;
u32 constants[512];
};
/* depth buffer control */
struct drm_r600_depth {
u32 db_stencil_clear;
u32 db_depth_clear;
u32 db_stencilrefmask;
u32 db_stencilrefmask_bf;
u32 db_depth_control;
u32 db_shader_control;
u32 db_render_control;
u32 db_render_override;
u32 db_sresults_compare_state1;
u32 db_preload_control;
u32 db_alpha_to_mask;
};
/* vs_shader - vertex shader */
struct drm_r600_vs_shader {
u32 sq_pgm_resources_vs;
u8 input_semantic[32];
u8 input_gpr[32];
u8 ninputs;
u8 output_semantic[32];
u8 fog_output_id;
u8 noutputs;
u32 ndwords;
u32 handle;
u32 offset;
};
/* fragment shader */
struct drm_r600_fs_shader {
u32 spi_ps_in_control_0;
u32 spi_ps_in_control_1;
u32 spi_ps_input_cntl[32];
u32 sq_pgm_resources_ps;
u32 sq_pgm_exports_ps;
u32 ndwords;
u32 handle;
u32 offset;
};
struct drm_r600_vs_buffer {
u32 handle;
u32 resource_id;
u32 sq_vtx_constant_word0;
u32 sq_vtx_constant_word2;
u32 sq_vtx_constant_word3;
};
struct drm_r600_vs_element {
u32 buffer_id;
u32 semantic;
u32 sq_vtx_word0;
u32 sq_vtx_word1;
u32 sq_vtx_word2;
};
struct drm_r600_vs_input {
u32 nelements;
u32 nbuffers;
struct drm_r600_vs_element elements[32];
struct drm_r600_vs_buffer buffers[32];
};
struct drm_r600_batch {
struct r600_atom *vs_constants;
struct r600_atom *ps_constants;
struct r600_atom *blend;
struct r600_atom *framebuffer;
struct r600_atom *cb_cntl;
struct r600_atom *rasterizer;
struct r600_atom *viewport;
struct r600_atom *scissor;
struct r600_atom *depth;
struct r600_atom *vs_shader;
struct r600_atom *fs_shader;
struct drm_r600_vs_input inputs;
};
struct r600_request {
u32 type;
void *data;
u32 nbo;
struct radeon_bo *bo[32];
};
extern int r600_batches_queue(struct r600_winsys*, struct r600_request*);
extern int r600_batches_flush(struct r600_winsys*);
extern struct r600_atom *r600_atom_create(struct r600_winsys*, struct r600_request*);
extern void r600_atom_destroy(struct r600_atom *atom);
struct pipe_screen *r600_create_screen(struct r600_winsys *r600_winsys, struct radeon_bo_manager *bom);
#endif
|