r300-gallium: Use rs_state emit for r300_surface, move a few things around.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 19:21:29 +0000 (11:21 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 19:22:40 +0000 (11:22 -0800)
Also a possible fix for non-TCL chipsets and trivial/clear.

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

index 49e4a96f833b490d6e097bd21c9b39204a9a81b0..4380bf4b24a951d4a82b4c46b4fbeeb3ecbc732d 100644 (file)
@@ -55,7 +55,12 @@ static void r300_surface_fill(struct pipe_context* pipe,
         return;
     }*/
 
-    BEGIN_CS(163 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2));
+    r300_emit_blend_state(r300, &blend_clear_state);
+    r300_emit_blend_color_state(r300, &blend_color_clear_state);
+    r300_emit_dsa_state(r300, &dsa_clear_state);
+    r300_emit_rs_state(r300, &rs_clear_state);
+
+    BEGIN_CS(143 + (caps->is_r500 ? 22 : 14) + (caps->has_tcl ? 4 : 2));
     /* Flush PVS. */
     OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
 
@@ -69,7 +74,12 @@ static void r300_surface_fill(struct pipe_context* pipe,
     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);
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
+    } else {
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP |
+                R300_VAP_TCL_BYPASS);
+    }
     OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0, 0x0);
     /* XXX magic number not in r300_reg */
     OUT_CS_REG(R300_VAP_PSC_SGN_NORM_CNTL, 0xAAAAAAAA);
@@ -102,9 +112,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
     OUT_CS_REG(R300_GA_POINT_MINMAX, 0x6 |
         (0x1800 << R300_GA_POINT_MINMAX_MAX_SHIFT));
     /* XXX this big chunk should be refactored into rs_state */
-    OUT_CS_REG(R300_GA_LINE_CNTL, 0x00030006);
-    OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, 0x3BAAAAAB);
-    OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, 0x00000000);
     OUT_CS_REG(R300_GA_LINE_S0, 0x00000000);
     OUT_CS_REG(R300_GA_LINE_S1, 0x3F800000);
     OUT_CS_REG(R300_GA_ENHANCE, 0x00000002);
@@ -117,12 +124,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
     OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412);
     OUT_CS_REG(R300_GA_FOG_OFFSET, 0x00000000);
     OUT_CS_REG(R300_SU_TEX_WRAP, 0x00000000);
-    OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_SCALE, 0x00000000);
-    OUT_CS_REG(R300_SU_POLY_OFFSET_FRONT_OFFSET, 0x00000000);
-    OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_SCALE, 0x00000000);
-    OUT_CS_REG(R300_SU_POLY_OFFSET_BACK_OFFSET, 0x00000000);
-    OUT_CS_REG(R300_SU_POLY_OFFSET_ENABLE, 0x00000000);
-    OUT_CS_REG(R300_SU_CULL_MODE, 0x00000000);
     OUT_CS_REG(R300_SU_DEPTH_SCALE, 0x4B7FFFFF);
     OUT_CS_REG(R300_SU_DEPTH_OFFSET, 0x00000000);
     OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C);
@@ -190,11 +191,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
             R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
     }
 
-    /* The size of the point we're about to draw, in sixths of pixels */
-    OUT_CS_REG(R300_GA_POINT_SIZE,
-        ((h * 6) & R300_POINTSIZE_Y_MASK) |
-        ((w * 6) << R300_POINTSIZE_X_SHIFT));
-
     /* XXX */
     OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
 
@@ -277,9 +273,10 @@ static void r300_surface_fill(struct pipe_context* pipe,
     }
     END_CS;
 
-    r300_emit_blend_state(r300, &blend_clear_state);
-    r300_emit_blend_color_state(r300, &blend_color_clear_state);
-    r300_emit_dsa_state(r300, &dsa_clear_state);
+    /* The size of the point we're about to draw, in sixths of pixels */
+    OUT_CS_REG(R300_GA_POINT_SIZE,
+        ((h * 6) & R300_POINTSIZE_Y_MASK) |
+        ((w * 6) << R300_POINTSIZE_X_SHIFT));
 
     BEGIN_CS(24);
     /* Flush colorbuffer and blend caches. */
index 442eac2cf2eada007054edb7b00fd95d70cdff2c..807aad39e49d9e586a527285fc368238df6ffd0f 100644 (file)
@@ -57,4 +57,16 @@ const struct r300_dsa_state dsa_clear_state = {
     .stencil_ref_bf = 0x0,
 };
 
+const struct r300_rs_state rs_clear_state = {
+    .line_control = 0x00030006,
+    .depth_scale_front = 0x0,
+    .depth_offset_front = 0x0,
+    .depth_scale_back = 0x0,
+    .depth_offset_back = 0x0,
+    .polygon_offset_enable = 0x0,
+    .cull_mode = 0x0,
+    .line_stipple_config = 0x3BAAAAAB,
+    .line_stipple_value = 0x0,
+};
+
 #endif /* R300_SURFACE_H */