r600g: rename bc -> bytecode

It took me a while to figure out what it stands for.
This commit is contained in:
Marek Olšák 2011-08-16 19:35:10 +02:00
parent 61d2dfbe48
commit 4a47662bea
6 changed files with 484 additions and 484 deletions

View File

@ -29,7 +29,7 @@
#include "r600_opcodes.h" #include "r600_opcodes.h"
#include "evergreend.h" #include "evergreend.h"
int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf)
{ {
unsigned id = cf->id; unsigned id = cf->id;

View File

@ -36,7 +36,7 @@
#define NUM_OF_CYCLES 3 #define NUM_OF_CYCLES 3
#define NUM_OF_COMPONENTS 4 #define NUM_OF_COMPONENTS 4
static inline unsigned int r600_bc_get_num_operands(struct r600_bc *bc, struct r600_bc_alu *alu) static inline unsigned int r600_bytecode_get_num_operands(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
if(alu->is_op3) if(alu->is_op3)
return 3; return 3;
@ -152,11 +152,11 @@ static inline unsigned int r600_bc_get_num_operands(struct r600_bc *bc, struct r
return 3; return 3;
} }
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id); int r700_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id);
static struct r600_bc_cf *r600_bc_cf(void) static struct r600_bytecode_cf *r600_bytecode_cf(void)
{ {
struct r600_bc_cf *cf = CALLOC_STRUCT(r600_bc_cf); struct r600_bytecode_cf *cf = CALLOC_STRUCT(r600_bytecode_cf);
if (cf == NULL) if (cf == NULL)
return NULL; return NULL;
@ -167,9 +167,9 @@ static struct r600_bc_cf *r600_bc_cf(void)
return cf; return cf;
} }
static struct r600_bc_alu *r600_bc_alu(void) static struct r600_bytecode_alu *r600_bytecode_alu(void)
{ {
struct r600_bc_alu *alu = CALLOC_STRUCT(r600_bc_alu); struct r600_bytecode_alu *alu = CALLOC_STRUCT(r600_bytecode_alu);
if (alu == NULL) if (alu == NULL)
return NULL; return NULL;
@ -177,9 +177,9 @@ static struct r600_bc_alu *r600_bc_alu(void)
return alu; return alu;
} }
static struct r600_bc_vtx *r600_bc_vtx(void) static struct r600_bytecode_vtx *r600_bytecode_vtx(void)
{ {
struct r600_bc_vtx *vtx = CALLOC_STRUCT(r600_bc_vtx); struct r600_bytecode_vtx *vtx = CALLOC_STRUCT(r600_bytecode_vtx);
if (vtx == NULL) if (vtx == NULL)
return NULL; return NULL;
@ -187,9 +187,9 @@ static struct r600_bc_vtx *r600_bc_vtx(void)
return vtx; return vtx;
} }
static struct r600_bc_tex *r600_bc_tex(void) static struct r600_bytecode_tex *r600_bytecode_tex(void)
{ {
struct r600_bc_tex *tex = CALLOC_STRUCT(r600_bc_tex); struct r600_bytecode_tex *tex = CALLOC_STRUCT(r600_bytecode_tex);
if (tex == NULL) if (tex == NULL)
return NULL; return NULL;
@ -197,15 +197,15 @@ static struct r600_bc_tex *r600_bc_tex(void)
return tex; return tex;
} }
void r600_bc_init(struct r600_bc *bc, enum chip_class chip_class) void r600_bytecode_init(struct r600_bytecode *bc, enum chip_class chip_class)
{ {
LIST_INITHEAD(&bc->cf); LIST_INITHEAD(&bc->cf);
bc->chip_class = chip_class; bc->chip_class = chip_class;
} }
static int r600_bc_add_cf(struct r600_bc *bc) static int r600_bytecode_add_cf(struct r600_bytecode *bc)
{ {
struct r600_bc_cf *cf = r600_bc_cf(); struct r600_bytecode_cf *cf = r600_bytecode_cf();
if (cf == NULL) if (cf == NULL)
return -ENOMEM; return -ENOMEM;
@ -219,7 +219,7 @@ static int r600_bc_add_cf(struct r600_bc *bc)
return 0; return 0;
} }
int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output) int r600_bytecode_add_output(struct r600_bytecode *bc, const struct r600_bytecode_output *output)
{ {
int r; int r;
@ -254,16 +254,16 @@ int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output)
} }
} }
r = r600_bc_add_cf(bc); r = r600_bytecode_add_cf(bc);
if (r) if (r)
return r; return r;
bc->cf_last->inst = output->inst; bc->cf_last->inst = output->inst;
memcpy(&bc->cf_last->output, output, sizeof(struct r600_bc_output)); memcpy(&bc->cf_last->output, output, sizeof(struct r600_bytecode_output));
return 0; return 0;
} }
/* alu instructions that can ony exits once per group */ /* alu instructions that can ony exits once per group */
static int is_alu_once_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_once_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -344,7 +344,7 @@ static int is_alu_once_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
} }
static int is_alu_reduction_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_reduction_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -365,7 +365,7 @@ static int is_alu_reduction_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
} }
static int is_alu_cube_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_cube_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -380,7 +380,7 @@ static int is_alu_cube_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
} }
static int is_alu_mova_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_mova_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -398,7 +398,7 @@ static int is_alu_mova_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
/* alu instructions that can only execute on the vector unit */ /* alu instructions that can only execute on the vector unit */
static int is_alu_vec_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_vec_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
return is_alu_reduction_inst(bc, alu) || return is_alu_reduction_inst(bc, alu) ||
is_alu_mova_inst(bc, alu) || is_alu_mova_inst(bc, alu) ||
@ -407,7 +407,7 @@ static int is_alu_vec_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
/* alu instructions that can only execute on the trans unit */ /* alu instructions that can only execute on the trans unit */
static int is_alu_trans_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_trans_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -478,23 +478,23 @@ static int is_alu_trans_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu)
} }
/* alu instructions that can execute on any unit */ /* alu instructions that can execute on any unit */
static int is_alu_any_unit_inst(struct r600_bc *bc, struct r600_bc_alu *alu) static int is_alu_any_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
{ {
return !is_alu_vec_unit_inst(bc, alu) && return !is_alu_vec_unit_inst(bc, alu) &&
!is_alu_trans_unit_inst(bc, alu); !is_alu_trans_unit_inst(bc, alu);
} }
static int assign_alu_units(struct r600_bc *bc, struct r600_bc_alu *alu_first, static int assign_alu_units(struct r600_bytecode *bc, struct r600_bytecode_alu *alu_first,
struct r600_bc_alu *assignment[5]) struct r600_bytecode_alu *assignment[5])
{ {
struct r600_bc_alu *alu; struct r600_bytecode_alu *alu;
unsigned i, chan, trans; unsigned i, chan, trans;
int max_slots = bc->chip_class == CAYMAN ? 4 : 5; int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
for (i = 0; i < max_slots; i++) for (i = 0; i < max_slots; i++)
assignment[i] = NULL; assignment[i] = NULL;
for (alu = alu_first; alu; alu = LIST_ENTRY(struct r600_bc_alu, alu->list.next, list)) { for (alu = alu_first; alu; alu = LIST_ENTRY(struct r600_bytecode_alu, alu->list.next, list)) {
chan = alu->dst.chan; chan = alu->dst.chan;
if (max_slots == 4) if (max_slots == 4)
trans = 0; trans = 0;
@ -573,7 +573,7 @@ static int reserve_gpr(struct alu_bank_swizzle *bs, unsigned sel, unsigned chan,
return 0; return 0;
} }
static int reserve_cfile(struct r600_bc *bc, struct alu_bank_swizzle *bs, unsigned sel, unsigned chan) static int reserve_cfile(struct r600_bytecode *bc, struct alu_bank_swizzle *bs, unsigned sel, unsigned chan)
{ {
int res, num_res = 4; int res, num_res = 4;
if (bc->chip_class >= R700) { if (bc->chip_class >= R700) {
@ -615,12 +615,12 @@ static int is_const(int sel)
sel <= V_SQ_ALU_SRC_LITERAL); sel <= V_SQ_ALU_SRC_LITERAL);
} }
static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu, static int check_vector(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
struct alu_bank_swizzle *bs, int bank_swizzle) struct alu_bank_swizzle *bs, int bank_swizzle)
{ {
int r, src, num_src, sel, elem, cycle; int r, src, num_src, sel, elem, cycle;
num_src = r600_bc_get_num_operands(bc, alu); num_src = r600_bytecode_get_num_operands(bc, alu);
for (src = 0; src < num_src; src++) { for (src = 0; src < num_src; src++) {
sel = alu->src[src].sel; sel = alu->src[src].sel;
elem = alu->src[src].chan; elem = alu->src[src].chan;
@ -645,12 +645,12 @@ static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu,
return 0; return 0;
} }
static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu, static int check_scalar(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
struct alu_bank_swizzle *bs, int bank_swizzle) struct alu_bank_swizzle *bs, int bank_swizzle)
{ {
int r, src, num_src, const_count, sel, elem, cycle; int r, src, num_src, const_count, sel, elem, cycle;
num_src = r600_bc_get_num_operands(bc, alu); num_src = r600_bytecode_get_num_operands(bc, alu);
for (const_count = 0, src = 0; src < num_src; ++src) { for (const_count = 0, src = 0; src < num_src; ++src) {
sel = alu->src[src].sel; sel = alu->src[src].sel;
elem = alu->src[src].chan; elem = alu->src[src].chan;
@ -691,8 +691,8 @@ static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu,
return 0; return 0;
} }
static int check_and_set_bank_swizzle(struct r600_bc *bc, static int check_and_set_bank_swizzle(struct r600_bytecode *bc,
struct r600_bc_alu *slots[5]) struct r600_bytecode_alu *slots[5])
{ {
struct alu_bank_swizzle bs; struct alu_bank_swizzle bs;
int bank_swizzle[5]; int bank_swizzle[5];
@ -764,10 +764,10 @@ static int check_and_set_bank_swizzle(struct r600_bc *bc,
return -1; return -1;
} }
static int replace_gpr_with_pv_ps(struct r600_bc *bc, static int replace_gpr_with_pv_ps(struct r600_bytecode *bc,
struct r600_bc_alu *slots[5], struct r600_bc_alu *alu_prev) struct r600_bytecode_alu *slots[5], struct r600_bytecode_alu *alu_prev)
{ {
struct r600_bc_alu *prev[5]; struct r600_bytecode_alu *prev[5];
int gpr[5], chan[5]; int gpr[5], chan[5];
int i, j, r, src, num_src; int i, j, r, src, num_src;
int max_slots = bc->chip_class == CAYMAN ? 4 : 5; int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
@ -789,11 +789,11 @@ static int replace_gpr_with_pv_ps(struct r600_bc *bc,
} }
for (i = 0; i < max_slots; ++i) { for (i = 0; i < max_slots; ++i) {
struct r600_bc_alu *alu = slots[i]; struct r600_bytecode_alu *alu = slots[i];
if(!alu) if(!alu)
continue; continue;
num_src = r600_bc_get_num_operands(bc, alu); num_src = r600_bytecode_get_num_operands(bc, alu);
for (src = 0; src < num_src; ++src) { for (src = 0; src < num_src; ++src) {
if (!is_gpr(alu->src[src].sel) || alu->src[src].rel) if (!is_gpr(alu->src[src].sel) || alu->src[src].rel)
continue; continue;
@ -821,7 +821,7 @@ static int replace_gpr_with_pv_ps(struct r600_bc *bc,
return 0; return 0;
} }
void r600_bc_special_constants(u32 value, unsigned *sel, unsigned *neg) void r600_bytecode_special_constants(u32 value, unsigned *sel, unsigned *neg)
{ {
switch(value) { switch(value) {
case 0: case 0:
@ -854,10 +854,10 @@ void r600_bc_special_constants(u32 value, unsigned *sel, unsigned *neg)
} }
/* compute how many literal are needed */ /* compute how many literal are needed */
static int r600_bc_alu_nliterals(struct r600_bc *bc, struct r600_bc_alu *alu, static int r600_bytecode_alu_nliterals(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
uint32_t literal[4], unsigned *nliteral) uint32_t literal[4], unsigned *nliteral)
{ {
unsigned num_src = r600_bc_get_num_operands(bc, alu); unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
unsigned i, j; unsigned i, j;
for (i = 0; i < num_src; ++i) { for (i = 0; i < num_src; ++i) {
@ -880,11 +880,11 @@ static int r600_bc_alu_nliterals(struct r600_bc *bc, struct r600_bc_alu *alu,
return 0; return 0;
} }
static void r600_bc_alu_adjust_literals(struct r600_bc *bc, static void r600_bytecode_alu_adjust_literals(struct r600_bytecode *bc,
struct r600_bc_alu *alu, struct r600_bytecode_alu *alu,
uint32_t literal[4], unsigned nliteral) uint32_t literal[4], unsigned nliteral)
{ {
unsigned num_src = r600_bc_get_num_operands(bc, alu); unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
unsigned i, j; unsigned i, j;
for (i = 0; i < num_src; ++i) { for (i = 0; i < num_src; ++i) {
@ -900,11 +900,11 @@ static void r600_bc_alu_adjust_literals(struct r600_bc *bc,
} }
} }
static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5], static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu *slots[5],
struct r600_bc_alu *alu_prev) struct r600_bytecode_alu *alu_prev)
{ {
struct r600_bc_alu *prev[5]; struct r600_bytecode_alu *prev[5];
struct r600_bc_alu *result[5] = { NULL }; struct r600_bytecode_alu *result[5] = { NULL };
uint32_t literal[4], prev_literal[4]; uint32_t literal[4], prev_literal[4];
unsigned nliteral = 0, prev_nliteral = 0; unsigned nliteral = 0, prev_nliteral = 0;
@ -919,13 +919,13 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
return r; return r;
for (i = 0; i < max_slots; ++i) { for (i = 0; i < max_slots; ++i) {
struct r600_bc_alu *alu; struct r600_bytecode_alu *alu;
/* check number of literals */ /* check number of literals */
if (prev[i]) { if (prev[i]) {
if (r600_bc_alu_nliterals(bc, prev[i], literal, &nliteral)) if (r600_bytecode_alu_nliterals(bc, prev[i], literal, &nliteral))
return 0; return 0;
if (r600_bc_alu_nliterals(bc, prev[i], prev_literal, &prev_nliteral)) if (r600_bytecode_alu_nliterals(bc, prev[i], prev_literal, &prev_nliteral))
return 0; return 0;
if (is_alu_mova_inst(bc, prev[i])) { if (is_alu_mova_inst(bc, prev[i])) {
if (have_rel) if (have_rel)
@ -934,7 +934,7 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
} }
num_once_inst += is_alu_once_inst(bc, prev[i]); num_once_inst += is_alu_once_inst(bc, prev[i]);
} }
if (slots[i] && r600_bc_alu_nliterals(bc, slots[i], literal, &nliteral)) if (slots[i] && r600_bytecode_alu_nliterals(bc, slots[i], literal, &nliteral))
return 0; return 0;
/* Let's check used slots. */ /* Let's check used slots. */
@ -970,7 +970,7 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
} }
/* Let's check source gprs */ /* Let's check source gprs */
num_src = r600_bc_get_num_operands(bc, alu); num_src = r600_bytecode_get_num_operands(bc, alu);
for (src = 0; src < num_src; ++src) { for (src = 0; src < num_src; ++src) {
if (alu->src[src].rel) { if (alu->src[src].rel) {
if (have_mova) if (have_mova)
@ -1020,7 +1020,7 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
} }
/* determine new last instruction */ /* determine new last instruction */
LIST_ENTRY(struct r600_bc_alu, bc->cf_last->alu.prev, list)->last = 1; LIST_ENTRY(struct r600_bytecode_alu, bc->cf_last->alu.prev, list)->last = 1;
/* determine new first instruction */ /* determine new first instruction */
for (i = 0; i < max_slots; ++i) { for (i = 0; i < max_slots; ++i) {
@ -1040,9 +1040,9 @@ static int merge_inst_groups(struct r600_bc *bc, struct r600_bc_alu *slots[5],
* probably do slightly better by recognizing that we actually have two * probably do slightly better by recognizing that we actually have two
* consecutive lines of 16 constants, but the resulting code would also be * consecutive lines of 16 constants, but the resulting code would also be
* somewhat more complicated. */ * somewhat more complicated. */
static int r600_bc_alloc_kcache_lines(struct r600_bc *bc, struct r600_bc_alu *alu, int type) static int r600_bytecode_alloc_kcache_lines(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, int type)
{ {
struct r600_bc_kcache *kcache = bc->cf_last->kcache; struct r600_bytecode_kcache *kcache = bc->cf_last->kcache;
unsigned int required_lines; unsigned int required_lines;
unsigned int free_lines = 0; unsigned int free_lines = 0;
unsigned int cache_line[3]; unsigned int cache_line[3];
@ -1095,7 +1095,7 @@ static int r600_bc_alloc_kcache_lines(struct r600_bc *bc, struct r600_bc_alu *al
/* Start a new ALU clause if needed. */ /* Start a new ALU clause if needed. */
if (required_lines > free_lines) { if (required_lines > free_lines) {
if ((r = r600_bc_add_cf(bc))) { if ((r = r600_bytecode_add_cf(bc))) {
return r; return r;
} }
bc->cf_last->inst = (type << 3); bc->cf_last->inst = (type << 3);
@ -1150,15 +1150,15 @@ static int r600_bc_alloc_kcache_lines(struct r600_bc *bc, struct r600_bc_alu *al
return 0; return 0;
} }
int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type) int r600_bytecode_add_alu_type(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu, int type)
{ {
struct r600_bc_alu *nalu = r600_bc_alu(); struct r600_bytecode_alu *nalu = r600_bytecode_alu();
struct r600_bc_alu *lalu; struct r600_bytecode_alu *lalu;
int i, r; int i, r;
if (nalu == NULL) if (nalu == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(nalu, alu, sizeof(struct r600_bc_alu)); memcpy(nalu, alu, sizeof(struct r600_bytecode_alu));
if (bc->cf_last != NULL && bc->cf_last->inst != (type << 3)) { if (bc->cf_last != NULL && bc->cf_last->inst != (type << 3)) {
/* check if we could add it anyway */ /* check if we could add it anyway */
@ -1176,7 +1176,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
/* cf can contains only alu or only vtx or only tex */ /* cf can contains only alu or only vtx or only tex */
if (bc->cf_last == NULL || bc->force_add_cf) { if (bc->cf_last == NULL || bc->force_add_cf) {
r = r600_bc_add_cf(bc); r = r600_bytecode_add_cf(bc);
if (r) { if (r) {
free(nalu); free(nalu);
return r; return r;
@ -1186,7 +1186,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
/* Setup the kcache for this ALU instruction. This will start a new /* Setup the kcache for this ALU instruction. This will start a new
* ALU clause if needed. */ * ALU clause if needed. */
if ((r = r600_bc_alloc_kcache_lines(bc, nalu, type))) { if ((r = r600_bytecode_alloc_kcache_lines(bc, nalu, type))) {
free(nalu); free(nalu);
return r; return r;
} }
@ -1200,7 +1200,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
bc->ngpr = nalu->src[i].sel + 1; bc->ngpr = nalu->src[i].sel + 1;
} }
if (nalu->src[i].sel == V_SQ_ALU_SRC_LITERAL) if (nalu->src[i].sel == V_SQ_ALU_SRC_LITERAL)
r600_bc_special_constants(nalu->src[i].value, r600_bytecode_special_constants(nalu->src[i].value,
&nalu->src[i].sel, &nalu->src[i].neg); &nalu->src[i].sel, &nalu->src[i].neg);
} }
if (nalu->dst.sel >= bc->ngpr) { if (nalu->dst.sel >= bc->ngpr) {
@ -1215,7 +1215,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
if (nalu->last) { if (nalu->last) {
uint32_t literal[4]; uint32_t literal[4];
unsigned nliteral; unsigned nliteral;
struct r600_bc_alu *slots[5]; struct r600_bytecode_alu *slots[5];
int max_slots = bc->chip_class == CAYMAN ? 4 : 5; int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
r = assign_alu_units(bc, bc->cf_last->curr_bs_head, slots); r = assign_alu_units(bc, bc->cf_last->curr_bs_head, slots);
if (r) if (r)
@ -1239,7 +1239,7 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
for (i = 0, nliteral = 0; i < max_slots; i++) { for (i = 0, nliteral = 0; i < max_slots; i++) {
if (slots[i]) { if (slots[i]) {
r = r600_bc_alu_nliterals(bc, slots[i], literal, &nliteral); r = r600_bytecode_alu_nliterals(bc, slots[i], literal, &nliteral);
if (r) if (r)
return r; return r;
} }
@ -1259,12 +1259,12 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
return 0; return 0;
} }
int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu) int r600_bytecode_add_alu(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu)
{ {
return r600_bc_add_alu_type(bc, alu, BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU)); return r600_bytecode_add_alu_type(bc, alu, BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
} }
static unsigned r600_bc_num_tex_and_vtx_instructions(const struct r600_bc *bc) static unsigned r600_bytecode_num_tex_and_vtx_instructions(const struct r600_bytecode *bc)
{ {
switch (bc->chip_class) { switch (bc->chip_class) {
case R600: case R600:
@ -1283,7 +1283,7 @@ static unsigned r600_bc_num_tex_and_vtx_instructions(const struct r600_bc *bc)
} }
} }
static inline boolean last_inst_was_vtx_fetch(struct r600_bc *bc) static inline boolean last_inst_was_vtx_fetch(struct r600_bytecode *bc)
{ {
if (bc->chip_class == CAYMAN) { if (bc->chip_class == CAYMAN) {
if (bc->cf_last->inst != CM_V_SQ_CF_WORD1_SQ_CF_INST_TC) if (bc->cf_last->inst != CM_V_SQ_CF_WORD1_SQ_CF_INST_TC)
@ -1296,20 +1296,20 @@ static inline boolean last_inst_was_vtx_fetch(struct r600_bc *bc)
return FALSE; return FALSE;
} }
int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx) int r600_bytecode_add_vtx(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx)
{ {
struct r600_bc_vtx *nvtx = r600_bc_vtx(); struct r600_bytecode_vtx *nvtx = r600_bytecode_vtx();
int r; int r;
if (nvtx == NULL) if (nvtx == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(nvtx, vtx, sizeof(struct r600_bc_vtx)); memcpy(nvtx, vtx, sizeof(struct r600_bytecode_vtx));
/* cf can contains only alu or only vtx or only tex */ /* cf can contains only alu or only vtx or only tex */
if (bc->cf_last == NULL || if (bc->cf_last == NULL ||
last_inst_was_vtx_fetch(bc) || last_inst_was_vtx_fetch(bc) ||
bc->force_add_cf) { bc->force_add_cf) {
r = r600_bc_add_cf(bc); r = r600_bytecode_add_cf(bc);
if (r) { if (r) {
free(nvtx); free(nvtx);
return r; return r;
@ -1323,24 +1323,24 @@ int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx)
/* each fetch use 4 dwords */ /* each fetch use 4 dwords */
bc->cf_last->ndw += 4; bc->cf_last->ndw += 4;
bc->ndw += 4; bc->ndw += 4;
if ((bc->cf_last->ndw / 4) >= r600_bc_num_tex_and_vtx_instructions(bc)) if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
bc->force_add_cf = 1; bc->force_add_cf = 1;
return 0; return 0;
} }
int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex) int r600_bytecode_add_tex(struct r600_bytecode *bc, const struct r600_bytecode_tex *tex)
{ {
struct r600_bc_tex *ntex = r600_bc_tex(); struct r600_bytecode_tex *ntex = r600_bytecode_tex();
int r; int r;
if (ntex == NULL) if (ntex == NULL)
return -ENOMEM; return -ENOMEM;
memcpy(ntex, tex, sizeof(struct r600_bc_tex)); memcpy(ntex, tex, sizeof(struct r600_bytecode_tex));
/* we can't fetch data und use it as texture lookup address in the same TEX clause */ /* we can't fetch data und use it as texture lookup address in the same TEX clause */
if (bc->cf_last != NULL && if (bc->cf_last != NULL &&
bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) { bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) {
struct r600_bc_tex *ttex; struct r600_bytecode_tex *ttex;
LIST_FOR_EACH_ENTRY(ttex, &bc->cf_last->tex, list) { LIST_FOR_EACH_ENTRY(ttex, &bc->cf_last->tex, list) {
if (ttex->dst_gpr == ntex->src_gpr) { if (ttex->dst_gpr == ntex->src_gpr) {
bc->force_add_cf = 1; bc->force_add_cf = 1;
@ -1356,7 +1356,7 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex)
if (bc->cf_last == NULL || if (bc->cf_last == NULL ||
bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_TEX || bc->cf_last->inst != V_SQ_CF_WORD1_SQ_CF_INST_TEX ||
bc->force_add_cf) { bc->force_add_cf) {
r = r600_bc_add_cf(bc); r = r600_bytecode_add_cf(bc);
if (r) { if (r) {
free(ntex); free(ntex);
return r; return r;
@ -1373,15 +1373,15 @@ int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex)
/* each texture fetch use 4 dwords */ /* each texture fetch use 4 dwords */
bc->cf_last->ndw += 4; bc->cf_last->ndw += 4;
bc->ndw += 4; bc->ndw += 4;
if ((bc->cf_last->ndw / 4) >= r600_bc_num_tex_and_vtx_instructions(bc)) if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
bc->force_add_cf = 1; bc->force_add_cf = 1;
return 0; return 0;
} }
int r600_bc_add_cfinst(struct r600_bc *bc, int inst) int r600_bytecode_add_cfinst(struct r600_bytecode *bc, int inst)
{ {
int r; int r;
r = r600_bc_add_cf(bc); r = r600_bytecode_add_cf(bc);
if (r) if (r)
return r; return r;
@ -1390,13 +1390,13 @@ int r600_bc_add_cfinst(struct r600_bc *bc, int inst)
return 0; return 0;
} }
int cm_bc_add_cf_end(struct r600_bc *bc) int cm_bytecode_add_cf_end(struct r600_bytecode *bc)
{ {
return r600_bc_add_cfinst(bc, CM_V_SQ_CF_WORD1_SQ_CF_INST_END); return r600_bytecode_add_cfinst(bc, CM_V_SQ_CF_WORD1_SQ_CF_INST_END);
} }
/* common to all 3 families */ /* common to all 3 families */
static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsigned id) static int r600_bytecode_vtx_build(struct r600_bytecode *bc, struct r600_bytecode_vtx *vtx, unsigned id)
{ {
bc->bytecode[id] = S_SQ_VTX_WORD0_BUFFER_ID(vtx->buffer_id) | bc->bytecode[id] = S_SQ_VTX_WORD0_BUFFER_ID(vtx->buffer_id) |
S_SQ_VTX_WORD0_FETCH_TYPE(vtx->fetch_type) | S_SQ_VTX_WORD0_FETCH_TYPE(vtx->fetch_type) |
@ -1425,7 +1425,7 @@ static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsign
} }
/* common to all 3 families */ /* common to all 3 families */
static int r600_bc_tex_build(struct r600_bc *bc, struct r600_bc_tex *tex, unsigned id) static int r600_bytecode_tex_build(struct r600_bytecode *bc, struct r600_bytecode_tex *tex, unsigned id)
{ {
bc->bytecode[id++] = S_SQ_TEX_WORD0_TEX_INST(tex->inst) | bc->bytecode[id++] = S_SQ_TEX_WORD0_TEX_INST(tex->inst) |
S_SQ_TEX_WORD0_RESOURCE_ID(tex->resource_id) | S_SQ_TEX_WORD0_RESOURCE_ID(tex->resource_id) |
@ -1455,7 +1455,7 @@ static int r600_bc_tex_build(struct r600_bc *bc, struct r600_bc_tex *tex, unsign
} }
/* r600 only, r700/eg bits in r700_asm.c */ /* r600 only, r700/eg bits in r700_asm.c */
static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id) static int r600_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id)
{ {
/* don't replace gpr by pv or ps for destination register */ /* don't replace gpr by pv or ps for destination register */
bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
@ -1496,7 +1496,7 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
return 0; return 0;
} }
static void r600_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf) static void r600_bytecode_cf_vtx_build(uint32_t *bytecode, const struct r600_bytecode_cf *cf)
{ {
*bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1); *bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
*bytecode++ = S_SQ_CF_WORD1_CF_INST(cf->inst) | *bytecode++ = S_SQ_CF_WORD1_CF_INST(cf->inst) |
@ -1505,7 +1505,7 @@ static void r600_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf
} }
/* common for r600/r700 - eg in eg_asm.c */ /* common for r600/r700 - eg in eg_asm.c */
static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf) static int r600_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf)
{ {
unsigned id = cf->id; unsigned id = cf->id;
@ -1531,9 +1531,9 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
case V_SQ_CF_WORD1_SQ_CF_INST_VTX: case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC: case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
if (bc->chip_class == R700) if (bc->chip_class == R700)
r700_bc_cf_vtx_build(&bc->bytecode[id], cf); r700_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
else else
r600_bc_cf_vtx_build(&bc->bytecode[id], cf); r600_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
break; break;
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT: case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE: case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
@ -1573,12 +1573,12 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
return 0; return 0;
} }
int r600_bc_build(struct r600_bc *bc) int r600_bytecode_build(struct r600_bytecode *bc)
{ {
struct r600_bc_cf *cf; struct r600_bytecode_cf *cf;
struct r600_bc_alu *alu; struct r600_bytecode_alu *alu;
struct r600_bc_vtx *vtx; struct r600_bytecode_vtx *vtx;
struct r600_bc_tex *tex; struct r600_bytecode_tex *tex;
uint32_t literal[4]; uint32_t literal[4];
unsigned nliteral; unsigned nliteral;
unsigned addr; unsigned addr;
@ -1638,9 +1638,9 @@ int r600_bc_build(struct r600_bc *bc)
LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) { LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
addr = cf->addr; addr = cf->addr;
if (bc->chip_class >= EVERGREEN) if (bc->chip_class >= EVERGREEN)
r = eg_bc_cf_build(bc, cf); r = eg_bytecode_cf_build(bc, cf);
else else
r = r600_bc_cf_build(bc, cf); r = r600_bytecode_cf_build(bc, cf);
if (r) if (r)
return r; return r;
switch (cf->inst) { switch (cf->inst) {
@ -1651,18 +1651,18 @@ int r600_bc_build(struct r600_bc *bc)
nliteral = 0; nliteral = 0;
memset(literal, 0, sizeof(literal)); memset(literal, 0, sizeof(literal));
LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) { LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
r = r600_bc_alu_nliterals(bc, alu, literal, &nliteral); r = r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
if (r) if (r)
return r; return r;
r600_bc_alu_adjust_literals(bc, alu, literal, nliteral); r600_bytecode_alu_adjust_literals(bc, alu, literal, nliteral);
switch(bc->chip_class) { switch(bc->chip_class) {
case R600: case R600:
r = r600_bc_alu_build(bc, alu, addr); r = r600_bytecode_alu_build(bc, alu, addr);
break; break;
case R700: case R700:
case EVERGREEN: /* eg alu is same encoding as r700 */ case EVERGREEN: /* eg alu is same encoding as r700 */
case CAYMAN: /* eg alu is same encoding as r700 */ case CAYMAN: /* eg alu is same encoding as r700 */
r = r700_bc_alu_build(bc, alu, addr); r = r700_bytecode_alu_build(bc, alu, addr);
break; break;
default: default:
R600_ERR("unknown chip class %d.\n", bc->chip_class); R600_ERR("unknown chip class %d.\n", bc->chip_class);
@ -1683,7 +1683,7 @@ int r600_bc_build(struct r600_bc *bc)
case V_SQ_CF_WORD1_SQ_CF_INST_VTX: case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC: case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) { LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
r = r600_bc_vtx_build(bc, vtx, addr); r = r600_bytecode_vtx_build(bc, vtx, addr);
if (r) if (r)
return r; return r;
addr += 4; addr += 4;
@ -1692,14 +1692,14 @@ int r600_bc_build(struct r600_bc *bc)
case V_SQ_CF_WORD1_SQ_CF_INST_TEX: case V_SQ_CF_WORD1_SQ_CF_INST_TEX:
if (bc->chip_class == CAYMAN) { if (bc->chip_class == CAYMAN) {
LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) { LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
r = r600_bc_vtx_build(bc, vtx, addr); r = r600_bytecode_vtx_build(bc, vtx, addr);
if (r) if (r)
return r; return r;
addr += 4; addr += 4;
} }
} }
LIST_FOR_EACH_ENTRY(tex, &cf->tex, list) { LIST_FOR_EACH_ENTRY(tex, &cf->tex, list) {
r = r600_bc_tex_build(bc, tex, addr); r = r600_bytecode_tex_build(bc, tex, addr);
if (r) if (r)
return r; return r;
addr += 4; addr += 4;
@ -1728,17 +1728,17 @@ int r600_bc_build(struct r600_bc *bc)
return 0; return 0;
} }
void r600_bc_clear(struct r600_bc *bc) void r600_bytecode_clear(struct r600_bytecode *bc)
{ {
struct r600_bc_cf *cf = NULL, *next_cf; struct r600_bytecode_cf *cf = NULL, *next_cf;
free(bc->bytecode); free(bc->bytecode);
bc->bytecode = NULL; bc->bytecode = NULL;
LIST_FOR_EACH_ENTRY_SAFE(cf, next_cf, &bc->cf, list) { LIST_FOR_EACH_ENTRY_SAFE(cf, next_cf, &bc->cf, list) {
struct r600_bc_alu *alu = NULL, *next_alu; struct r600_bytecode_alu *alu = NULL, *next_alu;
struct r600_bc_tex *tex = NULL, *next_tex; struct r600_bytecode_tex *tex = NULL, *next_tex;
struct r600_bc_tex *vtx = NULL, *next_vtx; struct r600_bytecode_tex *vtx = NULL, *next_vtx;
LIST_FOR_EACH_ENTRY_SAFE(alu, next_alu, &cf->alu, list) { LIST_FOR_EACH_ENTRY_SAFE(alu, next_alu, &cf->alu, list) {
free(alu); free(alu);
@ -1764,12 +1764,12 @@ void r600_bc_clear(struct r600_bc *bc)
LIST_INITHEAD(&cf->list); LIST_INITHEAD(&cf->list);
} }
void r600_bc_dump(struct r600_bc *bc) void r600_bytecode_dump(struct r600_bytecode *bc)
{ {
struct r600_bc_cf *cf = NULL; struct r600_bytecode_cf *cf = NULL;
struct r600_bc_alu *alu = NULL; struct r600_bytecode_alu *alu = NULL;
struct r600_bc_vtx *vtx = NULL; struct r600_bytecode_vtx *vtx = NULL;
struct r600_bc_tex *tex = NULL; struct r600_bytecode_tex *tex = NULL;
unsigned i, id; unsigned i, id;
uint32_t literal[4]; uint32_t literal[4];
@ -1868,7 +1868,7 @@ void r600_bc_dump(struct r600_bc *bc)
id = cf->addr; id = cf->addr;
nliteral = 0; nliteral = 0;
LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) { LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
r600_bc_alu_nliterals(bc, alu, literal, &nliteral); r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]); fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
fprintf(stderr, "SRC0(SEL:%d ", alu->src[0].sel); fprintf(stderr, "SRC0(SEL:%d ", alu->src[0].sel);
@ -2122,8 +2122,8 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
{ {
static int dump_shaders = -1; static int dump_shaders = -1;
struct r600_bc bc; struct r600_bytecode bc;
struct r600_bc_vtx vtx; struct r600_bytecode_vtx vtx;
struct pipe_vertex_element *elements = ve->elements; struct pipe_vertex_element *elements = ve->elements;
const struct util_format_description *desc; const struct util_format_description *desc;
unsigned fetch_resource_start = rctx->chip_class >= EVERGREEN ? 0 : 160; unsigned fetch_resource_start = rctx->chip_class >= EVERGREEN ? 0 : 160;
@ -2144,11 +2144,11 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
} }
memset(&bc, 0, sizeof(bc)); memset(&bc, 0, sizeof(bc));
r600_bc_init(&bc, rctx->chip_class); r600_bytecode_init(&bc, rctx->chip_class);
for (i = 0; i < ve->count; i++) { for (i = 0; i < ve->count; i++) {
if (elements[i].instance_divisor > 1) { if (elements[i].instance_divisor > 1) {
struct r600_bc_alu alu; struct r600_bytecode_alu alu;
memset(&alu, 0, sizeof(alu)); memset(&alu, 0, sizeof(alu));
alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT); alu.inst = BC_INST(&bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT);
@ -2163,8 +2163,8 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
alu.dst.write = 1; alu.dst.write = 1;
alu.last = 1; alu.last = 1;
if ((r = r600_bc_add_alu(&bc, &alu))) { if ((r = r600_bytecode_add_alu(&bc, &alu))) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
return r; return r;
} }
} }
@ -2175,7 +2175,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
r600_vertex_data_type(ve->elements[i].src_format, &format, &num_format, &format_comp, &endian); r600_vertex_data_type(ve->elements[i].src_format, &format, &num_format, &format_comp, &endian);
desc = util_format_description(ve->elements[i].src_format); desc = util_format_description(ve->elements[i].src_format);
if (desc == NULL) { if (desc == NULL) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
R600_ERR("unknown format %d\n", ve->elements[i].src_format); R600_ERR("unknown format %d\n", ve->elements[i].src_format);
return -EINVAL; return -EINVAL;
} }
@ -2200,16 +2200,16 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
vtx.offset = elements[i].src_offset; vtx.offset = elements[i].src_offset;
vtx.endian = endian; vtx.endian = endian;
if ((r = r600_bc_add_vtx(&bc, &vtx))) { if ((r = r600_bytecode_add_vtx(&bc, &vtx))) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
return r; return r;
} }
} }
r600_bc_add_cfinst(&bc, BC_INST(&bc, V_SQ_CF_WORD1_SQ_CF_INST_RETURN)); r600_bytecode_add_cfinst(&bc, BC_INST(&bc, V_SQ_CF_WORD1_SQ_CF_INST_RETURN));
if ((r = r600_bc_build(&bc))) { if ((r = r600_bytecode_build(&bc))) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
return r; return r;
} }
@ -2218,7 +2218,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
if (dump_shaders) { if (dump_shaders) {
fprintf(stderr, "--------------------------------------------------------------\n"); fprintf(stderr, "--------------------------------------------------------------\n");
r600_bc_dump(&bc); r600_bytecode_dump(&bc);
fprintf(stderr, "______________________________________________________________\n"); fprintf(stderr, "______________________________________________________________\n");
} }
@ -2227,13 +2227,13 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
/* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */ /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE); ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_IMMUTABLE);
if (ve->fetch_shader == NULL) { if (ve->fetch_shader == NULL) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
return -ENOMEM; return -ENOMEM;
} }
bytecode = r600_bo_map(rctx->radeon, ve->fetch_shader, rctx->ctx.cs, PIPE_TRANSFER_WRITE); bytecode = r600_bo_map(rctx->radeon, ve->fetch_shader, rctx->ctx.cs, PIPE_TRANSFER_WRITE);
if (bytecode == NULL) { if (bytecode == NULL) {
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
r600_bo_reference(&ve->fetch_shader, NULL); r600_bo_reference(&ve->fetch_shader, NULL);
return -ENOMEM; return -ENOMEM;
} }
@ -2247,7 +2247,7 @@ int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, stru
} }
r600_bo_unmap(rctx->radeon, ve->fetch_shader); r600_bo_unmap(rctx->radeon, ve->fetch_shader);
r600_bc_clear(&bc); r600_bytecode_clear(&bc);
if (rctx->chip_class >= EVERGREEN) if (rctx->chip_class >= EVERGREEN)
evergreen_fetch_shader(&rctx->context, ve); evergreen_fetch_shader(&rctx->context, ve);

View File

@ -26,7 +26,7 @@
struct r600_vertex_element; struct r600_vertex_element;
struct r600_pipe_context; struct r600_pipe_context;
struct r600_bc_alu_src { struct r600_bytecode_alu_src {
unsigned sel; unsigned sel;
unsigned chan; unsigned chan;
unsigned neg; unsigned neg;
@ -35,7 +35,7 @@ struct r600_bc_alu_src {
uint32_t value; uint32_t value;
}; };
struct r600_bc_alu_dst { struct r600_bytecode_alu_dst {
unsigned sel; unsigned sel;
unsigned chan; unsigned chan;
unsigned clamp; unsigned clamp;
@ -43,10 +43,10 @@ struct r600_bc_alu_dst {
unsigned rel; unsigned rel;
}; };
struct r600_bc_alu { struct r600_bytecode_alu {
struct list_head list; struct list_head list;
struct r600_bc_alu_src src[3]; struct r600_bytecode_alu_src src[3];
struct r600_bc_alu_dst dst; struct r600_bytecode_alu_dst dst;
unsigned inst; unsigned inst;
unsigned last; unsigned last;
unsigned is_op3; unsigned is_op3;
@ -56,7 +56,7 @@ struct r600_bc_alu {
unsigned omod; unsigned omod;
}; };
struct r600_bc_tex { struct r600_bytecode_tex {
struct list_head list; struct list_head list;
unsigned inst; unsigned inst;
unsigned resource_id; unsigned resource_id;
@ -83,7 +83,7 @@ struct r600_bc_tex {
unsigned src_sel_w; unsigned src_sel_w;
}; };
struct r600_bc_vtx { struct r600_bytecode_vtx {
struct list_head list; struct list_head list;
unsigned inst; unsigned inst;
unsigned fetch_type; unsigned fetch_type;
@ -105,7 +105,7 @@ struct r600_bc_vtx {
unsigned endian; unsigned endian;
}; };
struct r600_bc_output { struct r600_bytecode_output {
unsigned array_base; unsigned array_base;
unsigned type; unsigned type;
unsigned end_of_program; unsigned end_of_program;
@ -120,13 +120,13 @@ struct r600_bc_output {
unsigned barrier; unsigned barrier;
}; };
struct r600_bc_kcache { struct r600_bytecode_kcache {
unsigned bank; unsigned bank;
unsigned mode; unsigned mode;
unsigned addr; unsigned addr;
}; };
struct r600_bc_cf { struct r600_bytecode_cf {
struct list_head list; struct list_head list;
unsigned inst; unsigned inst;
unsigned addr; unsigned addr;
@ -135,15 +135,15 @@ struct r600_bc_cf {
unsigned cond; unsigned cond;
unsigned pop_count; unsigned pop_count;
unsigned cf_addr; /* control flow addr */ unsigned cf_addr; /* control flow addr */
struct r600_bc_kcache kcache[2]; struct r600_bytecode_kcache kcache[2];
unsigned r6xx_uses_waterfall; unsigned r6xx_uses_waterfall;
struct list_head alu; struct list_head alu;
struct list_head tex; struct list_head tex;
struct list_head vtx; struct list_head vtx;
struct r600_bc_output output; struct r600_bytecode_output output;
struct r600_bc_alu *curr_bs_head; struct r600_bytecode_alu *curr_bs_head;
struct r600_bc_alu *prev_bs_head; struct r600_bytecode_alu *prev_bs_head;
struct r600_bc_alu *prev2_bs_head; struct r600_bytecode_alu *prev2_bs_head;
}; };
#define FC_NONE 0 #define FC_NONE 0
@ -155,8 +155,8 @@ struct r600_bc_cf {
struct r600_cf_stack_entry { struct r600_cf_stack_entry {
int type; int type;
struct r600_bc_cf *start; struct r600_bytecode_cf *start;
struct r600_bc_cf **mid; /* used to store the else point */ struct r600_bytecode_cf **mid; /* used to store the else point */
int num_mid; int num_mid;
}; };
@ -168,11 +168,11 @@ struct r600_cf_callstack {
int max; int max;
}; };
struct r600_bc { struct r600_bytecode {
enum chip_class chip_class; enum chip_class chip_class;
int type; int type;
struct list_head cf; struct list_head cf;
struct r600_bc_cf *cf_last; struct r600_bytecode_cf *cf_last;
unsigned ndw; unsigned ndw;
unsigned ncf; unsigned ncf;
unsigned ngpr; unsigned ngpr;
@ -187,27 +187,27 @@ struct r600_bc {
}; };
/* eg_asm.c */ /* eg_asm.c */
int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf); int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf);
/* r600_asm.c */ /* r600_asm.c */
void r600_bc_init(struct r600_bc *bc, enum chip_class chip_class); void r600_bytecode_init(struct r600_bytecode *bc, enum chip_class chip_class);
void r600_bc_clear(struct r600_bc *bc); void r600_bytecode_clear(struct r600_bytecode *bc);
int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu); int r600_bytecode_add_alu(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu);
int r600_bc_add_vtx(struct r600_bc *bc, const struct r600_bc_vtx *vtx); int r600_bytecode_add_vtx(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx);
int r600_bc_add_tex(struct r600_bc *bc, const struct r600_bc_tex *tex); int r600_bytecode_add_tex(struct r600_bytecode *bc, const struct r600_bytecode_tex *tex);
int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output); int r600_bytecode_add_output(struct r600_bytecode *bc, const struct r600_bytecode_output *output);
int r600_bc_build(struct r600_bc *bc); int r600_bytecode_build(struct r600_bytecode *bc);
int r600_bc_add_cfinst(struct r600_bc *bc, int inst); int r600_bytecode_add_cfinst(struct r600_bytecode *bc, int inst);
int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type); int r600_bytecode_add_alu_type(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu, int type);
void r600_bc_special_constants(u32 value, unsigned *sel, unsigned *neg); void r600_bytecode_special_constants(u32 value, unsigned *sel, unsigned *neg);
void r600_bc_dump(struct r600_bc *bc); void r600_bytecode_dump(struct r600_bytecode *bc);
int cm_bc_add_cf_end(struct r600_bc *bc); int cm_bytecode_add_cf_end(struct r600_bytecode *bc);
int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve); int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve);
/* r700_asm.c */ /* r700_asm.c */
void r700_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf); void r700_bytecode_cf_vtx_build(uint32_t *bytecode, const struct r600_bytecode_cf *cf);
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id); int r700_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ struct r600_shader_io {
struct r600_shader { struct r600_shader {
unsigned processor_type; unsigned processor_type;
struct r600_bc bc; struct r600_bytecode bc;
unsigned ninput; unsigned ninput;
unsigned noutput; unsigned noutput;
unsigned npos; unsigned npos;

View File

@ -26,7 +26,7 @@
#include "r600_asm.h" #include "r600_asm.h"
#include "r700_sq.h" #include "r700_sq.h"
void r700_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf) void r700_bytecode_cf_vtx_build(uint32_t *bytecode, const struct r600_bytecode_cf *cf)
{ {
unsigned count = (cf->ndw / 4) - 1; unsigned count = (cf->ndw / 4) - 1;
*bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1); *bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
@ -36,7 +36,7 @@ void r700_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf)
S_SQ_CF_WORD1_COUNT_3(count >> 3); S_SQ_CF_WORD1_COUNT_3(count >> 3);
} }
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id) int r700_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id)
{ {
bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) | bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) | S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) |