summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-07-20 15:04:55 -0400
committerJerome Glisse <jglisse@redhat.com>2010-07-20 15:07:32 -0400
commit62f8b56dc6bcc13a30ed4f8c2d71e5a139b57b33 (patch)
tree07962d77a925362627dfa0817f27f2b8d796b047 /src/gallium/drivers
parent5ed6627ceb82845a7b578419b3cd4168ad0106d3 (diff)
r600g: split trans unit computation
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_compiler_r600.c28
-rw-r--r--src/gallium/drivers/r600/r600_shader.c2
2 files changed, 23 insertions, 7 deletions
diff --git a/src/gallium/drivers/r600/r600_compiler_r600.c b/src/gallium/drivers/r600/r600_compiler_r600.c
index fba0f3df42..f7234e7646 100644
--- a/src/gallium/drivers/r600/r600_compiler_r600.c
+++ b/src/gallium/drivers/r600/r600_compiler_r600.c
@@ -316,6 +316,7 @@ static struct r600_shader_node *r600_shader_new_node(struct r600_shader *rshader
return NULL;
rnode->node = node;
LIST_INITHEAD(&rnode->vfetch);
+fprintf(stderr, "------------------------ new node (%p %p)\n", &rnode->vfetch, rnode->vfetch.next);
LIST_INITHEAD(&rnode->alu);
LIST_ADDTAIL(&rnode->head, &rshader->nodes);
return rnode;
@@ -425,6 +426,9 @@ static struct r600_shader_alu *r600_shader_insert_alu(struct r600_shader *rshade
alu->alu[2].opcode = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP;
alu->alu[3].opcode = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP;
alu->alu[4].opcode = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP;
+ alu->alu[1].dst.chan = 1;
+ alu->alu[2].dst.chan = 2;
+ alu->alu[3].dst.chan = 3;
LIST_ADDTAIL(&alu->head, &node->alu);
return alu;
}
@@ -435,9 +439,10 @@ static int r600_shader_alu_translate(struct r600_shader *rshader,
{
struct r600_shader_node *rnode;
struct r600_shader_alu *alu;
- int i, j, r, comp, litteral_lastcomp = -1;
+ int i, j, r, litteral_lastcomp = -1;
if (!LIST_IS_EMPTY(&node->vfetch)) {
+fprintf(stderr, "------------------------ add node (%p %p)\n", &node->vfetch, node->vfetch.next);
rnode = r600_shader_new_node(rshader, node->node);
if (rnode == NULL) {
fprintf(stderr, "%s %d new node failed\n", __func__, __LINE__);
@@ -468,7 +473,7 @@ static int r600_shader_alu_translate(struct r600_shader *rshader,
case C_SWIZZLE_0:
case C_SWIZZLE_1:
default:
- fprintf(stderr, "%s %d invalid output\n", __func__, __LINE__);
+ fprintf(stderr, "%s %d invalid output %d\n", __func__, __LINE__, comp);
return -EINVAL;
}
alu->alu[comp].inst = ainfo->instruction;
@@ -521,8 +526,7 @@ static int r600_shader_alu_translate(struct r600_shader *rshader,
default:
break;
}
-printf("nliteral: %d\n", alu->nliteral);
- for (i = instruction->nop; i >= 0; i--) {
+ for (i = 4; i >= 0; i--) {
if (alu->alu[i].inst != INST_NOP) {
alu->alu[i].last = 1;
alu->nalu = i + 1;
@@ -579,9 +583,9 @@ int r600_shader_legalize(struct r600_shader *rshader)
static int r600_cshader_legalize_rec(struct c_shader *shader, struct c_node *node)
{
struct c_node_link *link;
- struct c_instruction *i;
+ struct c_instruction *i, *n;
struct c_operand operand;
- unsigned k;
+ unsigned k, inst;
int r;
LIST_FOR_EACH_ENTRY(i, &node->insts, head) {
@@ -596,6 +600,18 @@ static int r600_cshader_legalize_rec(struct c_shader *shader, struct c_node *nod
default:
break;
}
+ inst = r600_alu_instruction[i->op[k].opcode].instruction;
+ if (r600_instruction_info[inst].is_trans && k < (i->nop -1)) {
+ /* split trans opcode */
+ n = CALLOC_STRUCT(c_instruction);
+ if (n == NULL)
+ return -ENOMEM;
+ for (n->nop = 0, k = k + 1; k < i->nop; k++, n->nop++) {
+ memcpy(&n->op[n->nop - 0], &i->op[k], sizeof(struct c_op));
+ }
+ i->nop -= n->nop;
+ LIST_ADD(&n->head, &i->head);
+ }
}
}
LIST_FOR_EACH_ENTRY(link, &node->childs, head) {
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 2cbfde8713..2b1d54ad03 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -155,13 +155,13 @@ struct r600_pipe_shader *r600_pipe_shader_create(struct pipe_context *ctx, unsig
fprintf(stderr, "ERROR(%s %d)>>\n\n", __func__, __LINE__);
return NULL;
}
- c_shader_dump(&rshader->cshader);
r = r600_cshader_legalize(&rshader->cshader);
if (r) {
r600_pipe_shader_destroy(ctx, rpshader);
fprintf(stderr, "ERROR(%s %d)>>\n\n", __func__, __LINE__);
return NULL;
}
+ c_shader_dump(&rshader->cshader);
r = r700_shader_translate(rshader);
if (r) {
r600_pipe_shader_destroy(ctx, rpshader);