2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
26 #include "util/u_double_list.h"
28 struct r600_vertex_element
;
29 struct r600_pipe_context
;
31 struct r600_bc_alu_src
{
40 struct r600_bc_alu_dst
{
49 struct list_head list
;
50 struct r600_bc_alu_src src
[3];
51 struct r600_bc_alu_dst dst
;
56 unsigned bank_swizzle
;
57 unsigned bank_swizzle_force
;
62 struct list_head list
;
74 unsigned coord_type_x
;
75 unsigned coord_type_y
;
76 unsigned coord_type_z
;
77 unsigned coord_type_w
;
89 struct list_head list
;
95 unsigned mega_fetch_count
;
101 unsigned use_const_fields
;
102 unsigned data_format
;
103 unsigned num_format_all
;
104 unsigned format_comp_all
;
105 unsigned srf_mode_all
;
108 struct r600_bc_output
{
117 unsigned burst_count
;
120 struct r600_bc_kcache
{
127 struct list_head list
;
134 unsigned cf_addr
; /* control flow addr */
136 struct r600_bc_kcache kcache
[2];
137 unsigned r6xx_uses_waterfall
;
138 struct list_head alu
;
139 struct list_head tex
;
140 struct list_head vtx
;
141 struct r600_bc_output output
;
142 struct r600_bc_alu
*curr_bs_head
;
143 struct r600_bc_alu
*prev_bs_head
;
144 struct r600_bc_alu
*prev2_bs_head
;
151 #define FC_PUSH_VPM 4
152 #define FC_PUSH_WQM 5
154 struct r600_cf_stack_entry
{
156 struct r600_bc_cf
*start
;
157 struct r600_bc_cf
**mid
; /* used to store the else point */
161 #define SQ_MAX_CALL_DEPTH 0x00000020
162 struct r600_cf_callstack
{
163 unsigned fc_sp_before_entry
;
170 enum radeon_family family
;
171 int chiprev
; /* 0 - r600, 1 - r700, 2 - evergreen */
174 struct r600_bc_cf
*cf_last
;
180 unsigned force_add_cf
;
183 struct r600_cf_stack_entry fc_stack
[32];
185 struct r600_cf_callstack callstack
[SQ_MAX_CALL_DEPTH
];
189 int eg_bc_cf_build(struct r600_bc
*bc
, struct r600_bc_cf
*cf
);
190 void eg_cf_vtx(struct r600_vertex_element
*ve
, u32
*bytecode
, unsigned count
);
193 int r600_bc_init(struct r600_bc
*bc
, enum radeon_family family
);
194 void r600_bc_clear(struct r600_bc
*bc
);
195 int r600_bc_add_alu(struct r600_bc
*bc
, const struct r600_bc_alu
*alu
);
196 int r600_bc_add_vtx(struct r600_bc
*bc
, const struct r600_bc_vtx
*vtx
);
197 int r600_bc_add_tex(struct r600_bc
*bc
, const struct r600_bc_tex
*tex
);
198 int r600_bc_add_output(struct r600_bc
*bc
, const struct r600_bc_output
*output
);
199 int r600_bc_build(struct r600_bc
*bc
);
200 int r600_bc_add_cfinst(struct r600_bc
*bc
, int inst
);
201 int r600_bc_add_alu_type(struct r600_bc
*bc
, const struct r600_bc_alu
*alu
, int type
);
202 void r600_bc_special_constants(u32 value
, unsigned *sel
, unsigned *neg
);
203 void r600_bc_dump(struct r600_bc
*bc
);
205 int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context
*rctx
, struct r600_vertex_element
*ve
);
208 int r700_bc_alu_build(struct r600_bc
*bc
, struct r600_bc_alu
*alu
, unsigned id
);