Mesa (master): r300g: compensate for non-atomized emit_query_end in the CS

Marek Olšák mareko at kemper.freedesktop.org
Tue Apr 27 10:26:22 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Apr 27 11:42:08 2010 +0200

r300g: compensate for non-atomized emit_query_end in the CS

And reserve a little more space just in case.

---

 src/gallium/drivers/r300/r300_emit.c   |    5 +++++
 src/gallium/drivers/r300/r300_render.c |   10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 663a771..0353b90 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -1165,6 +1165,11 @@ unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
         }
     }
 
+    /* emit_query_end is not atomized. */
+    dwords += 26;
+    /* let's reserve some more, just in case */
+    dwords += 32;
+
     return dwords;
 }
 
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 86be3bd..7c3a790 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -600,8 +600,9 @@ void r300_draw_range_elements(struct pipe_context* pipe,
             start += short_count;
             count -= short_count;
 
-            /* 16 spare dwords are enough for emit_draw_elements. */
-            if (count && r300_reserve_cs_space(r300, 16)) {
+            /* 16 spare dwords are enough for emit_draw_elements.
+             * Also reserve some space for emit_query_end. */
+            if (count && r300_reserve_cs_space(r300, 74)) {
                 r300_emit_buffer_validate(r300, TRUE, indexBuffer);
                 r300_emit_dirty_state(r300);
                 r300_emit_aos(r300, 0, TRUE);
@@ -668,8 +669,9 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
                 count -= short_count;
 
                 /* Again, we emit both AOS and draw_arrays so there should be
-                 * at least 128 spare dwords. */
-                if (count && r300_reserve_cs_space(r300, 128)) {
+                 * at least 128 spare dwords.
+                 * Also reserve some space for emit_query_end. */
+                if (count && r300_reserve_cs_space(r300, 186)) {
                     r300_emit_buffer_validate(r300, TRUE, NULL);
                     r300_emit_dirty_state(r300);
                 }




More information about the mesa-commit mailing list