Mesa (master): i965: Use bo_references for the state cache delete function.

Eric Anholt anholt at kemper.freedesktop.org
Fri Oct 9 00:20:56 UTC 2009


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct  1 18:16:52 2009 -0700

i965: Use bo_references for the state cache delete function.

This appears to shave about 3% off the CPU usage in cairo-gl for firefox.

---

 src/mesa/drivers/dri/i965/brw_state_cache.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index f8e46aa..c262e1d 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -534,14 +534,9 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo)
    for (i = 0; i < cache->size; i++) {
       for (prev = &cache->items[i]; *prev;) {
 	 struct brw_cache_item *c = *prev;
-	 int j;
-
-	 for (j = 0; j < c->nr_reloc_bufs; j++) {
-	    if (c->reloc_bufs[j] == bo)
-	       break;
-	 }
 
-	 if (j != c->nr_reloc_bufs) {
+	 if (drm_intel_bo_references(c->bo, bo)) {
+	    int j;
 
 	    *prev = c->next;
 
@@ -551,17 +546,8 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo)
 	    free((void *)c->key);
 	    free(c);
 	    cache->n_items--;
-
-	    /* Delete up the tree.  Notably we're trying to get from
-	     * a request to delete the surface, to deleting the surface state
-	     * object, to deleting the binding table.  We're slack and restart
-	     * the deletion process when we do this because the other delete
-	     * may kill our *prev.
-	     */
-	    brw_state_cache_bo_delete(cache, c->bo);
-	    prev = &cache->items[i];
 	 } else {
-	    prev = &(*prev)->next;
+	    prev = &c->next;
 	 }
       }
    }




More information about the mesa-commit mailing list