Mesa (master): i915g: Optimize batchbuffer sizes

Stephane Marchesin marcheu at kemper.freedesktop.org
Wed May 8 08:03:42 UTC 2013


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

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Sat May  4 18:59:35 2013 -0700

i915g: Optimize batchbuffer sizes

Now that we don't throttle at every batchbuffer, we can shrink
the size of batchbuffers to achieve early flushing. This gives
a significant speed boost in a lot of games (on the order of
20%).

---

 src/gallium/drivers/i915/i915_prim_vbuf.c     |    8 +++++---
 src/gallium/winsys/i915/drm/i915_drm_winsys.c |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index 4e57eea..f9cd71b 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -704,12 +704,14 @@ i915_vbuf_render_create(struct i915_context *i915)
 
    i915_render->i915 = i915;
 
-   i915_render->base.max_vertex_buffer_bytes = 16*4096;
+   i915_render->base.max_vertex_buffer_bytes = 4*4096;
 
    /* NOTE: it must be such that state and vertices indices fit in a single 
-    * batch buffer.
+    * batch buffer. 4096 is one batch buffer and 430 is the max amount of 
+    * state in dwords. The result is the number of 16-bit indices which can
+    * fit in a single batch buffer.
     */
-   i915_render->base.max_indices = 16*1024;
+   i915_render->base.max_indices = (4096 - 430 * 4) / 2;
 
    i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info;
    i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices;
diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c
index 6c8a10d..9e16f40 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_winsys.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.c
@@ -56,7 +56,7 @@ i915_drm_winsys_create(int drmFD)
 
    idws->fd = drmFD;
    idws->base.pci_id = deviceID;
-   idws->max_batch_size = 16 * 4096;
+   idws->max_batch_size = 1 * 4096;
 
    idws->base.destroy = i915_drm_winsys_destroy;
 




More information about the mesa-commit mailing list