aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/hash.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-04 12:18:13 +0100
committermarha <marha@users.sourceforge.net>2014-03-04 12:23:48 +0100
commit45392e4a0642880b569ea5d4a350cdc395a2c7db (patch)
treec3c2a49de903a18c3f8e1bf79684c29337ebcf7c /mesalib/src/mesa/main/hash.c
parent5ec0616d4e3c4c6095f4975abbe9c21e5b6af967 (diff)
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.gz
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.tar.bz2
vcxsrv-45392e4a0642880b569ea5d4a350cdc395a2c7db.zip
Merge remote-tracking branch 'origin/released'
* origin/released: libX11 libxcb mesa xserver xcb-proto xkeyboard-config git update 4 Mar 2014 Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mapi/glapi/glthread.c mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/main/bufferobj.c xorg-server/dix/dispatch.c xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/winmultiwindowwm.c
Diffstat (limited to 'mesalib/src/mesa/main/hash.c')
-rw-r--r--mesalib/src/mesa/main/hash.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c
index b31fd4839..4c92005e0 100644
--- a/mesalib/src/mesa/main/hash.c
+++ b/mesalib/src/mesa/main/hash.c
@@ -36,7 +36,6 @@
#include "glheader.h"
#include "imports.h"
-#include "glapi/glthread.h"
#include "hash.h"
#include "hash_table.h"
@@ -59,8 +58,8 @@
struct _mesa_HashTable {
struct hash_table *ht;
GLuint MaxKey; /**< highest key inserted so far */
- _glthread_Mutex Mutex; /**< mutual exclusion lock */
- _glthread_Mutex WalkMutex; /**< for _mesa_HashWalk() */
+ mtx_t Mutex; /**< mutual exclusion lock */
+ mtx_t WalkMutex; /**< for _mesa_HashWalk() */
GLboolean InDeleteAll; /**< Debug check */
/** Value that would be in the table for DELETED_KEY_VALUE. */
void *deleted_key_data;
@@ -117,8 +116,8 @@ _mesa_NewHashTable(void)
if (table) {
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
- _glthread_INIT_MUTEX(table->Mutex);
- _glthread_INIT_MUTEX(table->WalkMutex);
+ mtx_init(&table->Mutex, mtx_plain);
+ mtx_init(&table->WalkMutex, mtx_plain);
}
return table;
}
@@ -144,8 +143,8 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
_mesa_hash_table_destroy(table->ht, NULL);
- _glthread_DESTROY_MUTEX(table->Mutex);
- _glthread_DESTROY_MUTEX(table->WalkMutex);
+ mtx_destroy(&table->Mutex);
+ mtx_destroy(&table->WalkMutex);
free(table);
}
@@ -187,9 +186,9 @@ _mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
{
void *res;
assert(table);
- _glthread_LOCK_MUTEX(table->Mutex);
+ mtx_lock(&table->Mutex);
res = _mesa_HashLookup_unlocked(table, key);
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
return res;
}
@@ -211,7 +210,7 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
assert(table);
assert(key);
- _glthread_LOCK_MUTEX(table->Mutex);
+ mtx_lock(&table->Mutex);
if (key > table->MaxKey)
table->MaxKey = key;
@@ -227,7 +226,7 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
}
}
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
}
@@ -256,14 +255,14 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
return;
}
- _glthread_LOCK_MUTEX(table->Mutex);
+ mtx_lock(&table->Mutex);
if (key == DELETED_KEY_VALUE) {
table->deleted_key_data = NULL;
} else {
entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key));
_mesa_hash_table_remove(table->ht, entry);
}
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
}
@@ -286,7 +285,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
ASSERT(table);
ASSERT(callback);
- _glthread_LOCK_MUTEX(table->Mutex);
+ mtx_lock(&table->Mutex);
table->InDeleteAll = GL_TRUE;
hash_table_foreach(table->ht, entry) {
callback((uintptr_t)entry->key, entry->data, userData);
@@ -297,7 +296,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
table->deleted_key_data = NULL;
}
table->InDeleteAll = GL_FALSE;
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
}
@@ -315,7 +314,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table)
struct _mesa_HashTable *clonetable;
ASSERT(table);
- _glthread_LOCK_MUTEX(table2->Mutex);
+ mtx_lock(&table2->Mutex);
clonetable = _mesa_NewHashTable();
assert(clonetable);
@@ -323,7 +322,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table)
_mesa_HashInsert(clonetable, (GLint)(uintptr_t)entry->key, entry->data);
}
- _glthread_UNLOCK_MUTEX(table2->Mutex);
+ mtx_unlock(&table2->Mutex);
return clonetable;
}
@@ -352,13 +351,13 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
ASSERT(table);
ASSERT(callback);
- _glthread_LOCK_MUTEX(table2->WalkMutex);
+ mtx_lock(&table2->WalkMutex);
hash_table_foreach(table->ht, entry) {
callback((uintptr_t)entry->key, entry->data, userData);
}
if (table->deleted_key_data)
callback(DELETED_KEY_VALUE, table->deleted_key_data, userData);
- _glthread_UNLOCK_MUTEX(table2->WalkMutex);
+ mtx_unlock(&table2->WalkMutex);
}
static void
@@ -398,10 +397,10 @@ GLuint
_mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
{
const GLuint maxKey = ~((GLuint) 0) - 1;
- _glthread_LOCK_MUTEX(table->Mutex);
+ mtx_lock(&table->Mutex);
if (maxKey - numKeys > table->MaxKey) {
/* the quick solution */
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
return table->MaxKey + 1;
}
else {
@@ -419,13 +418,13 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
/* this key not in use, check if we've found enough */
freeCount++;
if (freeCount == numKeys) {
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
return freeStart;
}
}
}
/* cannot allocate a block of numKeys consecutive keys */
- _glthread_UNLOCK_MUTEX(table->Mutex);
+ mtx_unlock(&table->Mutex);
return 0;
}
}