r600g: split R600 and R700 CF generation for VTX and TEX
authorChristian König <deathsimple@vodafone.de>
Wed, 9 Mar 2011 12:03:50 +0000 (13:03 +0100)
committerChristian König <deathsimple@vodafone.de>
Wed, 9 Mar 2011 13:49:03 +0000 (14:49 +0100)
Reviewed-by: Henri Verbeet <hverbeet@gmail.com>
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h
src/gallium/drivers/r600/r700_asm.c

index e788c6c054ec87abaf0d3f32919f612f84330d06..6a834f267f8b5128bf6459852346aee7bd157631 100644 (file)
@@ -1456,6 +1456,14 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
        return 0;
 }
 
+static void r600_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf)
+{
+       *bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
+       *bytecode++ = S_SQ_CF_WORD1_CF_INST(cf->inst) |
+                       S_SQ_CF_WORD1_BARRIER(1) |
+                       S_SQ_CF_WORD1_COUNT((cf->ndw / 4) - 1);
+}
+
 /* common for r600/r700 - eg in eg_asm.c */
 static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
 {
@@ -1482,10 +1490,10 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
        case V_SQ_CF_WORD1_SQ_CF_INST_TEX:
        case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
        case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
-               bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
-               bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) |
-                                       S_SQ_CF_WORD1_BARRIER(1) |
-                                       S_SQ_CF_WORD1_COUNT((cf->ndw / 4) - 1);
+               if (bc->chiprev == CHIPREV_R700)
+                       r700_bc_cf_vtx_build(&bc->bytecode[id], cf);
+               else
+                       r600_bc_cf_vtx_build(&bc->bytecode[id], cf);
                break;
        case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
        case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
index b22c21d1e237ebd04b77f7a4196fe76cba395d71..f9f4d037eb1ded4e68f3d3e6cc53a5e582abe2bb 100644 (file)
@@ -208,6 +208,7 @@ void r600_bc_dump(struct r600_bc *bc);
 int r600_vertex_elements_build_fetch_shader(struct r600_pipe_context *rctx, struct r600_vertex_element *ve);
 
 /* r700_asm.c */
+void r700_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf);
 int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id);
 
 #endif
index a7f2f54736e9f39d25cacfe5b86de421d2e39de5..b3c7d1494fc88adb382352e26597edc4487ff6f3 100644 (file)
 #include "r600_asm.h"
 #include "r700_sq.h"
 
+void r700_bc_cf_vtx_build(uint32_t *bytecode, const struct r600_bc_cf *cf)
+{
+       unsigned count = (cf->ndw / 4) - 1;
+       *bytecode++ = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
+       *bytecode++ = S_SQ_CF_WORD1_CF_INST(cf->inst) |
+                       S_SQ_CF_WORD1_BARRIER(1) |
+                       S_SQ_CF_WORD1_COUNT(count) |
+                       S_SQ_CF_WORD1_COUNT_3(count >> 3);
+}
 
 int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
 {