freedreno/batch: Export key/hash fxns

We are going to re-use these for autotune.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9535>
This commit is contained in:
Rob Clark 2021-03-10 11:53:52 -08:00 committed by Marge Bot
parent 4f3c16ec05
commit aa7dd6ff43
2 changed files with 9 additions and 6 deletions

View file

@ -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);

View file

@ -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);