Mesa (master): llvmpipe: fix wierd performance regression in isosurf

Keith Whitwell keithw at kemper.freedesktop.org
Sun Sep 12 14:02:12 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Sep 12 14:29:00 2010 +0100

llvmpipe: fix wierd performance regression in isosurf

I really don't understand the mechanism behind this, but it
seems like the way data blocks for a scene are malloced, and in
particular whether we treat them as stack or a queue, and whether
we retain the most recently allocated or least recently allocated
has a real affect (~5%) on isosurf framerates...

This is probably specific to my distro or even just my machine,
but none the less, it's nicer not to see the framerates go in the
wrong direction.

---

 src/gallium/drivers/llvmpipe/lp_scene.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index f6c6941..c0732e4 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -58,7 +58,9 @@ lp_scene_create( struct pipe_context *pipe )
       return NULL;
 
    scene->pipe = pipe;
-   scene->data.head = &scene->data.first;
+
+   scene->data.head =
+      CALLOC_STRUCT(data_block);
 
    pipe_mutex_init(scene->mutex);
 
@@ -73,7 +75,8 @@ void
 lp_scene_destroy(struct lp_scene *scene)
 {
    pipe_mutex_destroy(scene->mutex);
-   assert(scene->data.head == &scene->data.first);
+   assert(scene->data.head->next == NULL);
+   FREE(scene->data.head);
    FREE(scene);
 }
 
@@ -240,14 +243,13 @@ lp_scene_end_rasterization(struct lp_scene *scene )
       struct data_block_list *list = &scene->data;
       struct data_block *block, *tmp;
 
-      for (block = list->head; block; block = tmp) {
+      for (block = list->head->next; block; block = tmp) {
          tmp = block->next;
-         if (block != &list->first)
-            FREE(block);
+	 FREE(block);
       }
 
-      list->head = &list->first;
       list->head->next = NULL;
+      list->head->used = 0;
    }
 
    lp_fence_reference(&scene->fence, NULL);




More information about the mesa-commit mailing list