r300g: compensate for non-atomized emit_query_end in the CS
authorMarek Olšák <maraeo@gmail.com>
Tue, 27 Apr 2010 09:42:08 +0000 (11:42 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 27 Apr 2010 10:25:22 +0000 (12:25 +0200)
And reserve a little more space just in case.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_render.c

index 663a7715d95bdb043a7c854757b4511a62fca27a..0353b90c79761c5b028eec8fbc204d10259a4ffa 100644 (file)
@@ -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;
 }
 
index 86be3bd448c109332891480ed1be73afde99c7e7..7c3a7902a49372a680284a926cae116cca95b9b5 100644 (file)
@@ -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);
                 }