r300-gallium: Properly setup HW/SW TCL controls.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 7 Apr 2009 06:17:33 +0000 (23:17 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 7 Apr 2009 06:18:56 +0000 (23:18 -0700)
This keeps non-TCL chipsets from locking up, and also fully unbreaks
RADEON_NO_TCL rendering.

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

index 095df04630f46971616afb6c2253a6c774d42051..2a77fd173906877fd349644e67176e661a2524c3 100644 (file)
@@ -338,11 +338,17 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 {
     struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
 
-    /* XXX endian control */
-    if (r300_screen(pipe->screen)->caps->has_tcl) {
-        rs->vap_control_status = 0;
-    } else {
+    /* Copy rasterizer state for Draw. */
+    rs->rs = *state;
+
+    /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
+     * Else, enable HW TCL and force Draw's TCL off. */
+    if (state->bypass_vs_clip_and_viewport ||
+            !r300_screen(pipe->screen)->caps->has_tcl) {
         rs->vap_control_status = R300_VAP_TCL_BYPASS;
+    } else {
+        rs->rs.bypass_vs_clip_and_viewport = TRUE;
+        rs->vap_control_status = 0;
     }
 
     rs->point_size = pack_float_16_6x(state->point_size) |
@@ -406,13 +412,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
         rs->color_control = R300_SHADE_MODEL_SMOOTH;
     }
 
-    rs->rs = *state;
-
-    /* If using HW TCL, tell Draw to not do its magic. */
-    if (r300_screen(pipe->screen)->caps->has_tcl) {
-        rs->rs.bypass_vs_clip_and_viewport = TRUE;
-    }
-
     return (void*)rs;
 }
 
index dc4b29eb40a8147f122465ae2caad679da91a871..6bc39954b718d11a4208aea5aaab97c5efbc0fdb 100644 (file)
@@ -109,7 +109,8 @@ static void r300_surface_fill(struct pipe_context* pipe,
     if (caps->has_tcl) {
         r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
     } else {
-        BEGIN_CS(2);
+        BEGIN_CS(4);
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
         OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
                 R300_PVS_NUM_CNTLRS(5) |
                 R300_PVS_NUM_FPUS(caps->num_vert_fpus) |