diff options
author | Eric Anholt <[email protected]> | 2008-01-18 10:15:28 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2008-01-18 10:15:28 -0800 |
commit | 2afe5344dfb7b19563046d7b2f522d91335aac66 (patch) | |
tree | c8a3accef3d0114183e41044c9d75e4754e7a42b /src/mesa | |
parent | 8c56418f979f4b8c79c80738b35ac03470c25fea (diff) |
[965] Do a little bit rotation in state hash to reduce collisions.
This was around 3% improvement in OA.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state_cache.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 315fd9f206d..9e5e6235612 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -79,14 +79,18 @@ static GLuint hash_key( const void *key, GLuint key_size, /* I'm sure this can be improved on: */ - for (i = 0; i < key_size/4; i++) + for (i = 0; i < key_size/4; i++) { hash ^= ikey[i]; + hash = (hash << 5) | (hash >> 27); + } /* Include the BO pointers as key data as well */ ikey = (void *)reloc_bufs; key_size = nr_reloc_bufs * sizeof(dri_bo *); - for (i = 0; i < key_size/4; i++) + for (i = 0; i < key_size/4; i++) { hash ^= ikey[i]; + hash = (hash << 5) | (hash >> 27); + } return hash; } @@ -111,6 +115,16 @@ search_cache(struct brw_cache *cache, enum brw_cache_id cache_id, { struct brw_cache_item *c; +#if 0 + int bucketcount = 0; + + for (c = cache->items[hash % cache->size]; c; c = c->next) + bucketcount++; + + fprintf(stderr, "bucket %d/%d = %d/%d items\n", hash % cache->size, + cache->size, bucketcount, cache->n_items); +#endif + for (c = cache->items[hash % cache->size]; c; c = c->next) { if (c->cache_id == cache_id && c->hash == hash && |