Mesa (master): r300g/swtcl: move emitting AOS to prepare_for_rendering

Marek Olšák mareko at kemper.freedesktop.org
Wed May 26 22:19:35 UTC 2010


Module: Mesa
Branch: master
Commit: 55a6d3743436fb811dfa1825aabff82fb6610c04
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=55a6d3743436fb811dfa1825aabff82fb6610c04

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed May 26 20:53:56 2010 +0200

r300g/swtcl: move emitting AOS to prepare_for_rendering

---

 src/gallium/drivers/r300/r300_emit.c   |    8 +-------
 src/gallium/drivers/r300/r300_emit.h   |    2 +-
 src/gallium/drivers/r300/r300_render.c |   15 ++++++++++++---
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 8fceb53..40e7b4c 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -864,7 +864,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset, boolean indexed)
     END_CS;
 }
 
-void r300_emit_vertex_buffer(struct r300_context* r300)
+void r300_emit_aos_swtcl(struct r300_context *r300)
 {
     CS_LOCALS(r300);
 
@@ -1168,7 +1168,6 @@ unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300)
 {
-    struct r300_screen* r300screen = r300->screen;
     struct r300_atom* atom;
 
     foreach(atom, &r300->atom_list) {
@@ -1181,10 +1180,5 @@ void r300_emit_dirty_state(struct r300_context* r300)
         }
     }
 
-    /* Emit the VBO for SWTCL. */
-    if (!r300screen->caps.has_tcl) {
-        r300_emit_vertex_buffer(r300);
-    }
-
     r300->dirty_hw++;
 }
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 3c0edf6..da05aff 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -76,7 +76,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
 void r300_emit_textures_state(struct r300_context *r300,
                               unsigned size, void *state);
 
-void r300_emit_vertex_buffer(struct r300_context* r300);
+void r300_emit_aos_swtcl(struct r300_context *r300);
 
 void r300_emit_vertex_stream_state(struct r300_context* r300,
                                    unsigned size, void* state);
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 1961e0e..041ae80 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -136,7 +136,8 @@ enum r300_prepare_flags {
     PREP_FIRST_DRAW     = (1 << 0),
     PREP_VALIDATE_VBOS  = (1 << 1),
     PREP_EMIT_AOS       = (1 << 2),
-    PREP_INDEXED        = (1 << 3)
+    PREP_EMIT_AOS_SWTCL = (1 << 3),
+    PREP_INDEXED        = (1 << 4)
 };
 
 /* Check if the requested number of dwords is available in the CS and
@@ -152,6 +153,7 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
     boolean flushed = FALSE;
     boolean first_draw = flags & PREP_FIRST_DRAW;
     boolean emit_aos = flags & PREP_EMIT_AOS;
+    boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
 
     /* Stencil ref fallback. */
     if (r300->stencil_ref_bf_fallback) {
@@ -167,6 +169,9 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
 
         if (emit_aos)
             cs_dwords += 55; /* emit_aos */
+
+        if (emit_aos_swtcl)
+            cs_dwords += 7; /* emit_aos_swtcl */
     }
 
     /* Emitted in flush. */
@@ -185,6 +190,8 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
         r500_emit_index_offset(r300, index_bias);
         if (emit_aos)
             r300_emit_aos(r300, aos_offset, flags & PREP_INDEXED);
+        if (emit_aos_swtcl)
+            r300_emit_aos_swtcl(r300);
     }
 }
 
@@ -945,7 +952,8 @@ static void r500_render_draw_arrays(struct vbuf_render* render,
 
     (void) i; (void) ptr;
 
-    r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0);
+    r300_prepare_for_rendering(r300, PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+                               NULL, dwords, 0, 0);
 
     DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count);
 
@@ -989,7 +997,8 @@ static void r500_render_draw_elements(struct vbuf_render* render,
 
     CS_LOCALS(r300);
 
-    r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0);
+    r300_prepare_for_rendering(r300, PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+                               NULL, dwords, 0, 0);
 
     BEGIN_CS(dwords);
     OUT_CS_REG(R300_GA_COLOR_CONTROL,




More information about the mesa-commit mailing list