mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
vdpau: Replace usage of mtx_t with simple_mtx_t in htab.c
This is a prepare for removing _MTX_INITIALIZER_NP. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21284>
This commit is contained in:
parent
3821a125b9
commit
1a1a644d96
1 changed files with 12 additions and 11 deletions
|
|
@ -25,12 +25,13 @@
|
|||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "util/simple_mtx.h"
|
||||
#include "util/u_handle_table.h"
|
||||
#include "util/u_thread.h"
|
||||
#include "vdpau_private.h"
|
||||
|
||||
static struct handle_table *htab = NULL;
|
||||
static mtx_t htab_lock = _MTX_INITIALIZER_NP;
|
||||
static simple_mtx_t htab_lock = SIMPLE_MTX_INITIALIZER;
|
||||
|
||||
boolean vlCreateHTAB(void)
|
||||
{
|
||||
|
|
@ -38,22 +39,22 @@ boolean vlCreateHTAB(void)
|
|||
|
||||
/* Make sure handle table handles match VDPAU handles. */
|
||||
assert(sizeof(unsigned) <= sizeof(vlHandle));
|
||||
mtx_lock(&htab_lock);
|
||||
simple_mtx_lock(&htab_lock);
|
||||
if (!htab)
|
||||
htab = handle_table_create();
|
||||
ret = htab != NULL;
|
||||
mtx_unlock(&htab_lock);
|
||||
simple_mtx_unlock(&htab_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void vlDestroyHTAB(void)
|
||||
{
|
||||
mtx_lock(&htab_lock);
|
||||
simple_mtx_lock(&htab_lock);
|
||||
if (htab && !handle_table_get_first_handle(htab)) {
|
||||
handle_table_destroy(htab);
|
||||
htab = NULL;
|
||||
}
|
||||
mtx_unlock(&htab_lock);
|
||||
simple_mtx_unlock(&htab_lock);
|
||||
}
|
||||
|
||||
vlHandle vlAddDataHTAB(void *data)
|
||||
|
|
@ -61,10 +62,10 @@ vlHandle vlAddDataHTAB(void *data)
|
|||
vlHandle handle = 0;
|
||||
|
||||
assert(data);
|
||||
mtx_lock(&htab_lock);
|
||||
simple_mtx_lock(&htab_lock);
|
||||
if (htab)
|
||||
handle = handle_table_add(htab, data);
|
||||
mtx_unlock(&htab_lock);
|
||||
simple_mtx_unlock(&htab_lock);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
@ -73,17 +74,17 @@ void* vlGetDataHTAB(vlHandle handle)
|
|||
void *data = NULL;
|
||||
|
||||
assert(handle);
|
||||
mtx_lock(&htab_lock);
|
||||
simple_mtx_lock(&htab_lock);
|
||||
if (htab)
|
||||
data = handle_table_get(htab, handle);
|
||||
mtx_unlock(&htab_lock);
|
||||
simple_mtx_unlock(&htab_lock);
|
||||
return data;
|
||||
}
|
||||
|
||||
void vlRemoveDataHTAB(vlHandle handle)
|
||||
{
|
||||
mtx_lock(&htab_lock);
|
||||
simple_mtx_lock(&htab_lock);
|
||||
if (htab)
|
||||
handle_table_remove(htab, handle);
|
||||
mtx_unlock(&htab_lock);
|
||||
simple_mtx_unlock(&htab_lock);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue