summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_batch.h
diff options
context:
space:
mode:
authorStéphane Marchesin <[email protected]>2011-08-23 18:44:36 -0700
committerStéphane Marchesin <[email protected]>2011-08-25 22:57:48 -0700
commitb97889f543085f516fc1c821c621790399d57fa5 (patch)
tree56ccf730c31c97949ad2178819e79c18538c300b /src/gallium/drivers/i915/i915_batch.h
parentfdb62ef3f5b0fadd3cbac610f5b612bcfad5af1a (diff)
i915g: Improve the flush heuristic by using the previous frame's number of vertices.
Diffstat (limited to 'src/gallium/drivers/i915/i915_batch.h')
-rw-r--r--src/gallium/drivers/i915/i915_batch.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h
index a1f8bcae802..56d331f3e7a 100644
--- a/src/gallium/drivers/i915/i915_batch.h
+++ b/src/gallium/drivers/i915/i915_batch.h
@@ -64,11 +64,16 @@ static INLINE void i915_flush_heuristically(struct i915_context* i915,
int num_vertex)
{
struct i915_winsys *iws = i915->iws;
- i915->vertices_since_last_flush += num_vertex;
- if ( i915->vertices_since_last_flush > 4096
- || ( i915->vertices_since_last_flush > 256 &&
- !iws->buffer_is_busy(iws, i915->current.cbuf_bo)) )
+
+ i915->queued_vertices += num_vertex;
+
+ /* fire if we have more than 1/20th of the last frame's vertices */
+ if (i915->queued_vertices > i915->last_fired_vertices / 20) {
FLUSH_BATCH(NULL);
+ i915->fired_vertices += i915->queued_vertices;
+ i915->queued_vertices = 0;
+ return;
+ }
}