summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_state_cache.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-01-01 02:16:29 -0800
committerEric Anholt <eric@anholt.net>2008-01-02 09:47:05 -0800
commit4cc02fb9387dbeeea56de3a34854f6739dc97a80 (patch)
treeb821a21d2e3db97ff9103855d16a76d5d356c99d /src/mesa/drivers/dri/i965/brw_state_cache.c
parentde427742b89bc04fd1f59cf6ebab893e14ee8ad4 (diff)
[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%.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_state_cache.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_cache.c15
1 files changed, 11 insertions, 4 deletions
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);