diff options
author | Matt Turner <[email protected]> | 2015-07-30 14:31:04 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-05-20 10:05:09 -0700 |
commit | 015f2207cfa2334fb3bca5b6b941666ebf73e829 (patch) | |
tree | f81f353c0401073c5e0d0748d1530045fe06b0ea /src/mesa/main/texobj.c | |
parent | aded1160e5e722610dd474583d78e745291cbd75 (diff) |
mesa: Replace uses of Shared->Mutex with hash-table mutexes
We were locking the Shared->Mutex and then using calling functions like
_mesa_HashInsert that do additional per-hash-table locking internally.
Instead just lock each hash-table's mutex and use functions like
_mesa_HashInsertLocked and the new _mesa_HashRemoveLocked.
In order to do this, we need to remove the locking from
_mesa_HashFindFreeKeyBlock since it will always be called with the
per-hash-table lock taken.
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c9502bda236..ed630bd0dd1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1219,7 +1219,7 @@ create_textures(struct gl_context *ctx, GLenum target, /* * This must be atomic (generation and allocation of texture IDs) */ - mtx_lock(&ctx->Shared->Mutex); + _mesa_HashLockMutex(ctx->Shared->TexObjects); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); @@ -1229,18 +1229,18 @@ create_textures(struct gl_context *ctx, GLenum target, GLuint name = first + i; texObj = ctx->Driver.NewTextureObject(ctx, name, target); if (!texObj) { - mtx_unlock(&ctx->Shared->Mutex); + _mesa_HashUnlockMutex(ctx->Shared->TexObjects); _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sTextures", caller); return; } /* insert into hash table */ - _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj); + _mesa_HashInsertLocked(ctx->Shared->TexObjects, texObj->Name, texObj); textures[i] = name; } - mtx_unlock(&ctx->Shared->Mutex); + _mesa_HashUnlockMutex(ctx->Shared->TexObjects); } /*@}*/ @@ -1489,9 +1489,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) /* The texture _name_ is now free for re-use. * Remove it from the hash table now. */ - mtx_lock(&ctx->Shared->Mutex); _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name); - mtx_unlock(&ctx->Shared->Mutex); /* Unreference the texobj. If refcount hits zero, the texture * will be deleted. @@ -1723,9 +1721,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } /* and insert it into hash table */ - mtx_lock(&ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj); - mtx_unlock(&ctx->Shared->Mutex); } } |