mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
i915g: Improve the flush heuristic by using the previous frame's number of vertices.
This commit is contained in:
parent
fdb62ef3f5
commit
b97889f543
4 changed files with 18 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
|||
* This is not required, just a heuristic
|
||||
*/
|
||||
FLUSH_BATCH(NULL);
|
||||
|
||||
i915->last_fired_vertices = i915->fired_vertices;
|
||||
i915->fired_vertices = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -264,7 +264,10 @@ struct i915_context {
|
|||
struct util_slab_mempool transfer_pool;
|
||||
struct util_slab_mempool texture_transfer_pool;
|
||||
|
||||
int vertices_since_last_flush;
|
||||
/* state for tracking flushes */
|
||||
int last_fired_vertices;
|
||||
int fired_vertices;
|
||||
int queued_vertices;
|
||||
|
||||
/** blitter/hw-clear */
|
||||
struct blitter_context* blitter;
|
||||
|
|
|
|||
|
|
@ -77,5 +77,6 @@ void i915_flush(struct i915_context *i915, struct pipe_fence_handle **fence)
|
|||
i915->static_dirty = ~0;
|
||||
/* kernel emits flushes in between batchbuffers */
|
||||
i915->flush_dirty = 0;
|
||||
i915->vertices_since_last_flush = 0;
|
||||
i915->fired_vertices += i915->queued_vertices;
|
||||
i915->queued_vertices = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue