From 51b1d4f03c78251851b6f29aae93ea5c4a0f184c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 12 Sep 2010 14:29:00 +0100 Subject: [PATCH] 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 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index f6c69415071..c0732e4ab78 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); -- 2.30.2