Mesa (master): i965: replace fnv1a hash function with xxhash
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 25 19:56:39 UTC 2020
Module: Mesa
Branch: master
Commit: 013df5849897e71f62a0df12691f19f0d56cbdf3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=013df5849897e71f62a0df12691f19f0d56cbdf3
Author: Dmitriy Nester <dmitriynester at gmail.com>
Date: Thu Feb 27 15:28:50 2020 +0200
i965: replace fnv1a hash function with xxhash
xxhash is faster than fnv1a in almost all circumstances, so we're
switching to it globally.
Signed-off-by: Dmytro Nester <dmytro.nester at globallogic.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4020>
---
src/mesa/drivers/dri/i965/brw_program_cache.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index c1bdaab591c..90999ab0a4f 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -54,6 +54,8 @@
#include "brw_program.h"
#include "compiler/brw_eu.h"
#include "util/u_memory.h"
+#define XXH_INLINE_ALL
+#include "util/xxhash.h"
#define FILE_DEBUG_FLAG DEBUG_STATE
@@ -96,9 +98,9 @@ brw_stage_cache_id(gl_shader_stage stage)
static GLuint
hash_key(struct brw_cache_item *item)
{
- uint32_t hash = _mesa_fnv32_1a_offset_bias;
- hash = _mesa_fnv32_1a_accumulate(hash, item->cache_id);
- hash = _mesa_fnv32_1a_accumulate_block(hash, item->key, item->key_size);
+ uint32_t hash = 0;
+ hash = XXH32(&item->cache_id, sizeof(item->cache_id), hash);
+ hash = XXH32(item->key, item->key_size, hash);
return hash;
}
More information about the mesa-commit
mailing list