From aa7dd6ff436ff75a97e964249ecde687db6ff465 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 10 Mar 2021 11:53:52 -0800 Subject: [PATCH] freedreno/batch: Export key/hash fxns We are going to re-use these for autotune. Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_batch.h | 3 +++ .../drivers/freedreno/freedreno_batch_cache.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h index a7e092c8657..e39a65cb846 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.h +++ b/src/gallium/drivers/freedreno/freedreno_batch.h @@ -283,6 +283,9 @@ void fd_batch_resource_write(struct fd_batch *batch, struct fd_resource *rsc) as void fd_batch_resource_read_slowpath(struct fd_batch *batch, struct fd_resource *rsc) assert_dt; void fd_batch_check_size(struct fd_batch *batch) assert_dt; +uint32_t fd_batch_key_hash(const void *_key); +bool fd_batch_key_equals(const void *_a, const void *_b); + /* not called directly: */ void __fd_batch_describe(char* buf, const struct fd_batch *batch) assert_dt; void __fd_batch_destroy(struct fd_batch *batch); diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c index b4963768e6d..621862117f9 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c +++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c @@ -99,8 +99,8 @@ key_alloc(unsigned num_surfs) return key; } -static uint32_t -key_hash(const void *_key) +uint32_t +fd_batch_key_hash(const void *_key) { const struct fd_batch_key *key = _key; uint32_t hash = 0; @@ -109,8 +109,8 @@ key_hash(const void *_key) return hash; } -static bool -key_equals(const void *_a, const void *_b) +bool +fd_batch_key_equals(const void *_a, const void *_b) { const struct fd_batch_key *a = _a; const struct fd_batch_key *b = _b; @@ -121,7 +121,7 @@ key_equals(const void *_a, const void *_b) void fd_bc_init(struct fd_batch_cache *cache) { - cache->ht = _mesa_hash_table_create(NULL, key_hash, key_equals); + cache->ht = _mesa_hash_table_create(NULL, fd_batch_key_hash, fd_batch_key_equals); } void @@ -420,7 +420,7 @@ batch_from_key(struct fd_batch_cache *cache, struct fd_batch_key *key, assert_dt { struct fd_batch *batch = NULL; - uint32_t hash = key_hash(key); + uint32_t hash = fd_batch_key_hash(key); struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(cache->ht, hash, key);