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 #define NUM_OF_CYCLES 3
29 #define NUM_OF_COMPONENTS 4
31 struct r600_vertex_element
;
32 struct r600_pipe_context
;
34 struct r600_bc_alu_src
{
42 struct r600_bc_alu_dst
{
51 struct list_head list
;
52 struct list_head bs_list
; /* bank swizzle list */
53 struct r600_bc_alu_src src
[3];
54 struct r600_bc_alu_dst dst
;
60 unsigned literal_added
;
61 unsigned bank_swizzle
;
62 unsigned bank_swizzle_force
;
64 int hw_gpr
[NUM_OF_CYCLES
][NUM_OF_COMPONENTS
];
68 struct list_head list
;
80 unsigned coord_type_x
;
81 unsigned coord_type_y
;
82 unsigned coord_type_z
;
83 unsigned coord_type_w
;
95 struct list_head list
;
101 unsigned mega_fetch_count
;
107 unsigned use_const_fields
;
108 unsigned data_format
;
109 unsigned num_format_all
;
110 unsigned format_comp_all
;
111 unsigned srf_mode_all
;
114 struct r600_bc_output
{
117 unsigned end_of_program
;
129 struct list_head list
;
136 unsigned cf_addr
; /* control flow addr */
137 unsigned kcache0_mode
;
138 unsigned kcache1_mode
;
139 unsigned kcache0_addr
;
140 unsigned kcache1_addr
;
141 unsigned kcache0_bank
;
142 unsigned kcache1_bank
;
143 unsigned r6xx_uses_waterfall
;
144 struct list_head alu
;
145 struct list_head tex
;
146 struct list_head vtx
;
147 struct r600_bc_output output
;
148 struct r600_bc_alu
*curr_bs_head
;
155 #define FC_PUSH_VPM 4
156 #define FC_PUSH_WQM 5
158 struct r600_cf_stack_entry
{
160 struct r600_bc_cf
*start
;
161 struct r600_bc_cf
**mid
; /* used to store the else point */
165 #define SQ_MAX_CALL_DEPTH 0x00000020
166 struct r600_cf_callstack
{
167 unsigned fc_sp_before_entry
;
174 enum radeon_family family
;
175 int chiprev
; /* 0 - r600, 1 - r700, 2 - evergreen */
178 struct r600_bc_cf
*cf_last
;
184 unsigned force_add_cf
;
187 struct r600_cf_stack_entry fc_stack
[32];
189 struct r600_cf_callstack callstack
[SQ_MAX_CALL_DEPTH
];
193 int eg_bc_cf_build(struct r600_bc
*bc
, struct r600_bc_cf
*cf
);
194 void eg_cf_vtx(struct r600_vertex_element
*ve
, u32
*bytecode
, unsigned count
);
197 int r600_bc_init(struct r600_bc
*bc
, enum radeon_family family
);
198 void r600_bc_clear(struct r600_bc
*bc
);
199 int r600_bc_add_alu(struct r600_bc
*bc
, const struct r600_bc_alu
*alu
);
200 int r600_bc_add_literal(struct r600_bc
*bc
, const u32
*value
);
201 int r600_bc_add_vtx(struct r600_bc
*bc
, const struct r600_bc_vtx
*vtx
);
202 int r600_bc_add_tex(struct r600_bc
*bc
, const struct r600_bc_tex
*tex
);
203 int r600_bc_add_output(struct r600_bc
*bc
, const struct r600_bc_output
*output
);
204 int r600_bc_build(struct r600_bc
*bc
);
205 int r600_bc_add_cfinst(struct r600_bc
*bc
, int inst
);
206 int r600_bc_add_alu_type(struct r600_bc
*bc
, const struct r600_bc_alu
*alu
, int type
);
207 void r600_bc_dump(struct r600_bc
*bc
);
208 void r600_cf_vtx(struct r600_vertex_element
*ve
, u32
*bytecode
, unsigned count
);
209 void r600_cf_vtx_tc(struct r600_vertex_element
*ve
, u32
*bytecode
, unsigned count
);
211 int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context
*rctx
, struct r600_vertex_element
*ve
);
214 int r700_bc_alu_build(struct r600_bc
*bc
, struct r600_bc_alu
*alu
, unsigned id
);