r300: finish blit support for r300
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 21 Nov 2009 17:16:29 +0000 (18:16 +0100)
committerMaciej Cencora <m.cencora@gmail.com>
Fri, 11 Dec 2009 23:52:51 +0000 (00:52 +0100)
src/mesa/drivers/dri/r300/r300_blit.c

index b4c4b9c9cc294f656dc4c2eb1ec09c784408b5df..7b256dac78a52eec7d964baf422ca829e7df5d54 100644 (file)
@@ -156,14 +156,62 @@ static void r500_emit_rs_setup(struct r300_context *r300)
     END_BATCH();
 }
 
-static void r300_emit_fp_setup(struct r300_context *r300)
+static void r300_emit_fp_setup(struct r300_context *r300,
+                               struct r300_fragment_program_code *code)
 {
-    assert(0);
+    unsigned i;
+    BATCH_LOCALS(&r300->radeon);
+
+    BEGIN_BATCH((code->alu.length + 1) * 4 + code->tex.length + 1 + 9);
+
+    OUT_BATCH_REGSEQ(R300_US_ALU_RGB_INST_0, code->alu.length);
+    for (i = 0; i < code->alu.length; i++) {
+        OUT_BATCH(code->alu.inst[i].rgb_inst);
+    }
+    OUT_BATCH_REGSEQ(R300_US_ALU_RGB_ADDR_0, code->alu.length);
+    for (i = 0; i < code->alu.length; i++) {
+        OUT_BATCH(code->alu.inst[i].rgb_addr);
+    }
+    OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_INST_0, code->alu.length);
+    for (i = 0; i < code->alu.length; i++) {
+        OUT_BATCH(code->alu.inst[i].alpha_inst);
+    }
+    OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_ADDR_0, code->alu.length);
+    for (i = 0; i < code->alu.length; i++) {
+        OUT_BATCH(code->alu.inst[i].alpha_addr);
+    }
+
+    OUT_BATCH_REGSEQ(R300_US_TEX_INST_0, code->tex.length);
+    OUT_BATCH_TABLE(code->tex.inst, code->tex.length);
+
+    OUT_BATCH_REGSEQ(R300_US_CONFIG, 3);
+    OUT_BATCH(R300_PFS_CNTL_FIRST_NODE_HAS_TEX);
+    OUT_BATCH(code->pixsize);
+    OUT_BATCH(code->code_offset);
+    OUT_BATCH_REGSEQ(R300_US_CODE_ADDR_0, 4);
+    OUT_BATCH_TABLE(code->code_addr, 4);
+    END_BATCH();
 }
 
 static void r300_emit_rs_setup(struct r300_context *r300)
 {
-    assert(0);
+    BATCH_LOCALS(&r300->radeon);
+
+    BEGIN_BATCH(7);
+    OUT_BATCH_REGSEQ(R300_RS_COUNT, 2);
+    OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN);
+    OUT_BATCH(0);
+    OUT_BATCH_REGVAL(R300_RS_INST_0,
+                     R300_RS_INST_TEX_ID(0) |
+                     R300_RS_INST_TEX_ADDR(0) |
+                     R300_RS_INST_TEX_CN_WRITE);
+    OUT_BATCH_REGVAL(R300_RS_IP_0,
+                     R300_RS_TEX_PTR(0) |
+                     R300_RS_SEL_S(R300_RS_SEL_C0) |
+                     R300_RS_SEL_R(R300_RS_SEL_C1) |
+                     R300_RS_SEL_T(R300_RS_SEL_K0) |
+                     R300_RS_SEL_Q(R300_RS_SEL_K1));
+    END_BATCH();
 }
 
 static void r300_emit_tx_setup(struct r300_context *r300,
@@ -459,7 +507,7 @@ GLboolean r300_blit(struct r300_context *r300,
         r500_emit_fp_setup(r300, &r300->blit.fp_code.code.r500, dst_mesaformat);
         r500_emit_rs_setup(r300);
     } else {
-        r300_emit_fp_setup(r300);
+        r300_emit_fp_setup(r300, &r300->blit.fp_code.code.r300);
         r300_emit_rs_setup(r300);
     }