From 4cc02fb9387dbeeea56de3a34854f6739dc97a80 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 1 Jan 2008 02:16:29 -0800 Subject: [965] Improve performance by including reloc target buffer pointers in keys. Without this, the WM binding tables would all collide, for example. Improves openarena performance by around 2%. --- src/mesa/drivers/dri/i965/brw_state_cache.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index d614316ab6..315fd9f206 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -69,7 +69,8 @@ #include "brw_sf.h" #include "brw_gs.h" -static GLuint hash_key( const void *key, GLuint key_size ) +static GLuint hash_key( const void *key, GLuint key_size, + dri_bo **reloc_bufs, GLuint nr_reloc_bufs) { GLuint *ikey = (GLuint *)key; GLuint hash = 0, i; @@ -81,6 +82,12 @@ static GLuint hash_key( const void *key, GLuint key_size ) for (i = 0; i < key_size/4; i++) hash ^= ikey[i]; + /* 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++) + hash ^= ikey[i]; + return hash; } @@ -151,7 +158,7 @@ dri_bo *brw_search_cache( struct brw_cache *cache, void *aux_return ) { struct brw_cache_item *item; - GLuint hash = hash_key(key, key_size); + GLuint hash = hash_key(key, key_size, reloc_bufs, nr_reloc_bufs); item = search_cache(cache, cache_id, hash, key, key_size, reloc_bufs, nr_reloc_bufs); @@ -181,7 +188,7 @@ brw_upload_cache( struct brw_cache *cache, void *aux_return ) { struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item); - GLuint hash = hash_key(key, key_size); + GLuint hash = hash_key(key, key_size, reloc_bufs, nr_reloc_bufs); GLuint relocs_size = nr_reloc_bufs * sizeof(dri_bo *); GLuint aux_size = cache->aux_size[cache_id]; void *tmp; @@ -256,7 +263,7 @@ brw_cache_data_sz(struct brw_cache *cache, { dri_bo *bo; struct brw_cache_item *item; - GLuint hash = hash_key(data, data_size); + GLuint hash = hash_key(data, data_size, reloc_bufs, nr_reloc_bufs); item = search_cache(cache, cache_id, hash, data, data_size, reloc_bufs, nr_reloc_bufs); -- cgit v1.2.3