Mesa (master): freedreno/batch: Export key/hash fxns
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Mar 21 16:34:27 UTC 2021
Module: Mesa
Branch: master
Commit: aa7dd6ff436ff75a97e964249ecde687db6ff465
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa7dd6ff436ff75a97e964249ecde687db6ff465
Author: Rob Clark <robdclark at chromium.org>
Date: Wed Mar 10 11:53:52 2021 -0800
freedreno/batch: Export key/hash fxns
We are going to re-use these for autotune.
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9535>
---
src/gallium/drivers/freedreno/freedreno_batch.h | 3 +++
src/gallium/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);
More information about the mesa-commit
mailing list