Mesa (master): mesa/hash: switch to simple_mtx
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 1 19:35:11 UTC 2021
Module: Mesa
Branch: master
Commit: e26f261c7e376fc95bf2fa4e5ff23164c8d876da
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e26f261c7e376fc95bf2fa4e5ff23164c8d876da
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Wed Mar 10 12:04:39 2021 +0100
mesa/hash: switch to simple_mtx
simple_mtx are faster and smaller (4 bytes instead of 8) so switch to using them.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9533>
---
src/mesa/main/hash.c | 4 ++--
src/mesa/main/hash.h | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index fd82114ec62..2c3064ca673 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -62,7 +62,7 @@ _mesa_NewHashTable(void)
}
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
- mtx_init(&table->Mutex, mtx_plain);
+ simple_mtx_init(&table->Mutex, mtx_plain);
}
else {
_mesa_error_no_memory(__func__);
@@ -96,7 +96,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
free(table->id_alloc);
}
- mtx_destroy(&table->Mutex);
+ simple_mtx_destroy(&table->Mutex);
free(table);
}
diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h
index 7aa1e660917..b476b1bce30 100644
--- a/src/mesa/main/hash.h
+++ b/src/mesa/main/hash.h
@@ -37,6 +37,7 @@
#include "glheader.h"
#include "c11/threads.h"
+#include "util/simple_mtx.h"
struct util_idalloc;
@@ -103,7 +104,7 @@ uint_key(GLuint id)
struct _mesa_HashTable {
struct hash_table *ht;
GLuint MaxKey; /**< highest key inserted so far */
- mtx_t Mutex; /**< mutual exclusion lock */
+ simple_mtx_t Mutex; /**< mutual exclusion lock */
GLboolean InDeleteAll; /**< Debug check */
/* Used when name reuse is enabled */
struct util_idalloc* id_alloc;
@@ -136,7 +137,7 @@ static inline void
_mesa_HashLockMutex(struct _mesa_HashTable *table)
{
assert(table);
- mtx_lock(&table->Mutex);
+ simple_mtx_lock(&table->Mutex);
}
@@ -149,7 +150,7 @@ static inline void
_mesa_HashUnlockMutex(struct _mesa_HashTable *table)
{
assert(table);
- mtx_unlock(&table->Mutex);
+ simple_mtx_unlock(&table->Mutex);
}
extern void *_mesa_HashLookupLocked(struct _mesa_HashTable *table, GLuint key);
More information about the mesa-commit
mailing list