summaryrefslogtreecommitdiff
path: root/r600_shader.c
diff options
context:
space:
mode:
Diffstat (limited to 'r600_shader.c')
-rw-r--r--r600_shader.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/r600_shader.c b/r600_shader.c
index fd482c8..de22654 100644
--- a/r600_shader.c
+++ b/r600_shader.c
@@ -89,6 +89,10 @@ static struct r600_inst_name sq_cf_alloc_export_inst_name[] = {
void r600_disassemble_sq_cf_inst(u32 *bytecode, u32 ndwords, u32 idx)
{
+ u32 addr = G_008DFC_ADDR(bytecode[idx+0]) << 1;
+ u32 count = G_008DFC_COUNT(bytecode[idx+1]);
+ u32 i;
+
printf("0x%08X 0x%08X CF_INST: %s\n", bytecode[idx+0], bytecode[idx+1],
sq_cf_inst_name[G_008DFC_CF_INST(bytecode[idx+1])].name);
printf(" word0: addr (in dw) %d\n", G_008DFC_ADDR(bytecode[idx+0]) << 1);
@@ -103,6 +107,10 @@ void r600_disassemble_sq_cf_inst(u32 *bytecode, u32 ndwords, u32 idx)
sq_cf_inst_name[G_008DFC_CF_INST(bytecode[idx+1])].name);
printf(" word1: whole quad mode %d\n", G_008DFC_WHOLE_QUAD_MODE(bytecode[idx+1]));
printf(" word1: barrier %d\n", G_008DFC_BARRIER(bytecode[idx+1]));
+ for (i = 0; i <= count; i++)
+ printf(" 0x%08X 0x%08X 0x%08X 0x%08X\n",
+ bytecode[idx+addr+0+(i*4)], bytecode[idx+addr+1+(i*4)],
+ bytecode[idx+addr+2+(i*4)], bytecode[idx+addr+3+(i*4)]);
}
void r600_disassemble_sq_cf_alu_inst(u32 *bytecode, u32 ndwords, u32 idx)
@@ -160,6 +168,7 @@ struct r600_block *r600_block_new(u32 *bytecode, u32 ndwords, u32 idx)
} else {
if (G_008DFC_CF_INST(bytecode[idx+1]) < 0x20) {
r600_disassemble_sq_cf_inst(bytecode, ndwords, idx);
+ blk->last = G_008DFC_END_OF_PROGRAM(bytecode[idx+1]);
} else {
r600_disassemble_sq_cf_alloc_export_inst(bytecode, ndwords, idx);
blk->last = G_008DFC_END_OF_PROGRAM(bytecode[idx+1]);
@@ -194,8 +203,10 @@ int r600_shader_build_fs(struct radeon_device *rdev,
dev_err(rdev->dev, "need at least one input for vertex shader\n");
return -EINVAL;
}
- bytecode[idx++] = 0x00000001;
- bytecode[idx++] = 0x81200000 | S_008DFC_COUNT(inputs->nelements - 1);
+ bytecode[idx++] = 0x00000002;
+ bytecode[idx++] = 0x81000000 | S_008DFC_COUNT(inputs->nelements - 1);
+ bytecode[idx++] = 0x00000000;
+ bytecode[idx++] = 0x8A000000;
for (i = 0; i < inputs->nelements; i++) {
if (inputs->elements[i].buffer_id >= inputs->nbuffers) {
dev_err(rdev->dev, "elements %d referencing invalid buffer %d\n",
@@ -209,6 +220,7 @@ int r600_shader_build_fs(struct radeon_device *rdev,
break;
}
}
+printf("elements %d: gpr %d resource id %d\n", i, gpr, rid);
/* if vs has no corresponding input skip the elements */
if (gpr == -1)
continue;
@@ -218,5 +230,6 @@ int r600_shader_build_fs(struct radeon_device *rdev,
bytecode[idx++] = 0xCAFEDEAD;
}
*ndwords = idx;
+ r600_shader_disassemble(bytecode, idx);
return 0;
}