r300: Set up blend state emit, clean up blend registers.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 27 Jan 2009 11:40:46 +0000 (03:40 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 2 Feb 2009 07:30:29 +0000 (23:30 -0800)
Also add at least one missing register to r300_reg.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/r300/r300_surface.h

index 19bfcbdd5ba272cd9abd3e7f80b0a45dba96104d..de606cfab761677c9b1fbeb39679647be8c224b6 100644 (file)
 #include "r300_cs.h"
 #include "r300_screen.h"
 
+void r300_emit_blend_state(struct r300_context* r300,
+                           struct r300_blend_state* blend)
+{
+    CS_LOCALS(r300);
+    OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 2);
+    OUT_CS(blend->blend_control);
+    OUT_CS(blend->alpha_blend_control);
+    OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
+    OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
+}
+
 static void r300_emit_dirty_state(struct r300_context* r300)
 {
     struct r300_screen* r300screen = (struct r300_screen*)r300->context.screen;
@@ -38,12 +49,7 @@ static void r300_emit_dirty_state(struct r300_context* r300)
     /* XXX check size */
 
     if (r300->dirty_state & R300_NEW_BLEND) {
-        struct r300_blend_state* blend = r300->blend_state;
-        /* XXX next two are contiguous regs */
-        OUT_CS_REG(R300_RB3D_CBLEND, blend->blend_control);
-        OUT_CS_REG(R300_RB3D_ABLEND, blend->alpha_blend_control);
-        OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
-        OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither);
+        r300_emit_blend_state(r300, r300->blend_state);
     }
 
     if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
index 7f4a508b1b3d4a03d4d325e168902fe64d4eb91e..c1796ad7a85afa923a8993f6e428ad25c21e6cec 100644 (file)
@@ -151,6 +151,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define     R300_VTX_W0_FMT                       (1 << 10)
 #      define     R300_SERIAL_PROC_ENA                  (1 << 11)
 
+#define R300_VAP_VTX_SIZE               0x20b4
+
 /* BEGIN: Vertex data assembly - lots of uncertainties */
 
 /* gap */
index 9a4b3455d1da572c6813d864c882b53ba4285f3d..6c7784dd4db628e6dcb398c5c2b88b8993b451c9 100644 (file)
@@ -43,24 +43,30 @@ static void r300_surface_fill(struct pipe_context* pipe,
 
 BEGIN_CS(276);
 R300_PACIFY;
-OUT_CS_REG(0x4100, 0x00000000);
+OUT_CS_REG(R300_TX_INVALTAGS, 0x0);
 R300_PACIFY;
+/* Viewport setup */
 OUT_CS_REG(0x1D98, 0x43000000);
 OUT_CS_REG(0x1D9C, 0x43002000);
 OUT_CS_REG(0x1DA0, 0xC3000000);
 OUT_CS_REG(0x1DA4, 0x43002000);
 OUT_CS_REG(0x1DA8, 0x3F000000);
 OUT_CS_REG(0x1DAC, 0x3F000000);
-OUT_CS_REG(0x2284, 0x00000000);
-OUT_CS_REG(0x20B0, 0x0000043F);
-OUT_CS_REG(0x20B4, 0x00000008);
-OUT_CS_REG(0x2134, 0x00FFFFFF);
-OUT_CS_REG(0x2138, 0x00000000);
-OUT_CS_REG(0x2140, 0x00000000);
-OUT_CS_REG(0x2150, 0x00000000);
-OUT_CS_REG(0x21E0, 0x00000000);
-OUT_CS_REG(0x2180, 0x00000000);
-OUT_CS_REG(0x2184, 0x00000000);
+/* Flush PVS. */
+OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+
+OUT_CS_REG(R300_SE_VTE_CNTL, R300_VPORT_X_SCALE_ENA |
+    R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
+    R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
+    R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
+/* Vertex size. */
+OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
+/* Max and min vertex index clamp. */
+OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, 0xFFFFFF);
+OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0x0);
+/* XXX endian */
+OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
 OUT_CS_REG(0x21DC, 0xAAAAAAAA);
 OUT_CS_REG(0x221C, 0x00000000);
 OUT_CS_REG(0x2220, 0x3F800000);
@@ -149,12 +155,8 @@ OUT_CS_REG(0x4BD4, 0x00000000);
 OUT_CS_REG(0x4BD8, 0x00000000);
 OUT_CS_REG(0x4BD8, 0x00000000);
 OUT_CS_REG(0x4E00, 0x00000000);
-OUT_CS_REG(0x4E04, 0x20210000);
-OUT_CS_REG(0x4E08, 0x20210000);
 OUT_CS_REG(0x4E0C, 0x0000000F);
 OUT_CS_REG(0x4E10, 0x00000000);
-OUT_CS_REG(0x4E18, 0x00000000);
-OUT_CS_REG(0x4E50, 0x00000000);
 OUT_CS_REG(0x4E54, 0x00000000);
 OUT_CS_REG(0x4E58, 0x00000000);
 OUT_CS_REG(0x4E5C, 0x00000000);
@@ -243,9 +245,9 @@ OUT_CS_REG(0x2208, 0x00000000);
 OUT_CS_REG(0x2208, 0x00000000);
 OUT_CS_REG(0x2150, 0x21030003);
 OUT_CS_REG(0x4BC0, 0x00000000);
-OUT_CS_REG(0x21E0, 0xF688F688);
-OUT_CS_REG(0x2180, 0x00000001);
-OUT_CS_REG(0x2184, 0x00000405);
+OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0, 0xF688F688);
+OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
+OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
 OUT_CS_REG(0x20B0, 0x0000043F);
 OUT_CS_REG(0x20B4, 0x00000008);
 OUT_CS_REG(0x21DC, 0xAAAAAAAA);
@@ -259,8 +261,8 @@ OUT_CS_REG(0x1DA4, 0x00000000);
 OUT_CS_REG(0x1DA8, 0x3F800000);
 OUT_CS_REG(0x1DAC, 0x00000000);
 OUT_CS_REG(0x4BD4, 0x00000000);
-OUT_CS_REG(0x4E04, 0x00000000);
-OUT_CS_REG(0x4E08, 0x00000000);
+r300_emit_blend_state(r300, &blend_clear_state);
+/* XXX emit blend state */
 OUT_CS_REG(0x221C, 0x0001C000);
 OUT_CS_REG(R300_GA_POINT_SIZE, ((h * 6) & R300_POINTSIZE_Y_MASK) |
     ((w * 6) << R300_POINTSIZE_X_SHIFT));
index 2d64a954126b458e80c5668fced9cd613e2fa75b..6d71601b98cdc7cd77d371f03e193e839eb2fa82 100644 (file)
 
 #include "r300_context.h"
 #include "r300_cs.h"
+#include "r300_emit.h"
 
-/* XXX integrate this into r300_reg */
-#include "r300_fragprog.h"
+const struct r300_blend_state blend_clear_state = {
+    .blend_control = 0x0,
+    .alpha_blend_control = 0x0,
+    .rop = 0x0,
+    .dither = 0x0,
+};
 
 #endif /* R300_SURFACE_H */