mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
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@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9533>
This commit is contained in:
parent
0a78c22666
commit
e26f261c7e
2 changed files with 6 additions and 5 deletions
|
|
@ -62,7 +62,7 @@ _mesa_NewHashTable(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
|
_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 {
|
else {
|
||||||
_mesa_error_no_memory(__func__);
|
_mesa_error_no_memory(__func__);
|
||||||
|
|
@ -96,7 +96,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
|
||||||
free(table->id_alloc);
|
free(table->id_alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtx_destroy(&table->Mutex);
|
simple_mtx_destroy(&table->Mutex);
|
||||||
free(table);
|
free(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
#include "glheader.h"
|
#include "glheader.h"
|
||||||
|
|
||||||
#include "c11/threads.h"
|
#include "c11/threads.h"
|
||||||
|
#include "util/simple_mtx.h"
|
||||||
|
|
||||||
struct util_idalloc;
|
struct util_idalloc;
|
||||||
|
|
||||||
|
|
@ -103,7 +104,7 @@ uint_key(GLuint id)
|
||||||
struct _mesa_HashTable {
|
struct _mesa_HashTable {
|
||||||
struct hash_table *ht;
|
struct hash_table *ht;
|
||||||
GLuint MaxKey; /**< highest key inserted so far */
|
GLuint MaxKey; /**< highest key inserted so far */
|
||||||
mtx_t Mutex; /**< mutual exclusion lock */
|
simple_mtx_t Mutex; /**< mutual exclusion lock */
|
||||||
GLboolean InDeleteAll; /**< Debug check */
|
GLboolean InDeleteAll; /**< Debug check */
|
||||||
/* Used when name reuse is enabled */
|
/* Used when name reuse is enabled */
|
||||||
struct util_idalloc* id_alloc;
|
struct util_idalloc* id_alloc;
|
||||||
|
|
@ -136,7 +137,7 @@ static inline void
|
||||||
_mesa_HashLockMutex(struct _mesa_HashTable *table)
|
_mesa_HashLockMutex(struct _mesa_HashTable *table)
|
||||||
{
|
{
|
||||||
assert(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)
|
_mesa_HashUnlockMutex(struct _mesa_HashTable *table)
|
||||||
{
|
{
|
||||||
assert(table);
|
assert(table);
|
||||||
mtx_unlock(&table->Mutex);
|
simple_mtx_unlock(&table->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void *_mesa_HashLookupLocked(struct _mesa_HashTable *table, GLuint key);
|
extern void *_mesa_HashLookupLocked(struct _mesa_HashTable *table, GLuint key);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue