mesa: use simple_mtx_t for TexMutex
change mtx_recursive -> mtx_plain, there's no recursive locking Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>
This commit is contained in:
@@ -55,7 +55,7 @@ glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
|
|||||||
|
|
||||||
_mesa_HashLockMutex(ctx->Shared->BufferObjects);
|
_mesa_HashLockMutex(ctx->Shared->BufferObjects);
|
||||||
ctx->BufferObjectsLocked = true;
|
ctx->BufferObjectsLocked = true;
|
||||||
mtx_lock(&ctx->Shared->TexMutex);
|
simple_mtx_lock(&ctx->Shared->TexMutex);
|
||||||
ctx->TexturesLocked = true;
|
ctx->TexturesLocked = true;
|
||||||
|
|
||||||
while (pos < used) {
|
while (pos < used) {
|
||||||
@@ -66,7 +66,7 @@ glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx->TexturesLocked = false;
|
ctx->TexturesLocked = false;
|
||||||
mtx_unlock(&ctx->Shared->TexMutex);
|
simple_mtx_unlock(&ctx->Shared->TexMutex);
|
||||||
ctx->BufferObjectsLocked = false;
|
ctx->BufferObjectsLocked = false;
|
||||||
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
|
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
|
||||||
|
|
||||||
|
@@ -3387,7 +3387,7 @@ struct gl_shared_state
|
|||||||
* \todo Improve the granularity of locking.
|
* \todo Improve the granularity of locking.
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
mtx_t TexMutex; /**< texobj thread safety */
|
simple_mtx_t TexMutex; /**< texobj thread safety */
|
||||||
GLuint TextureStateStamp; /**< state notification for shared tex */
|
GLuint TextureStateStamp; /**< state notification for shared tex */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
@@ -128,7 +128,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
|||||||
assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
|
assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
|
||||||
|
|
||||||
/* Mutex and timestamp for texobj state validation */
|
/* Mutex and timestamp for texobj state validation */
|
||||||
mtx_init(&shared->TexMutex, mtx_recursive);
|
simple_mtx_init(&shared->TexMutex, mtx_plain);
|
||||||
shared->TextureStateStamp = 0;
|
shared->TextureStateStamp = 0;
|
||||||
|
|
||||||
shared->FrameBuffers = _mesa_NewHashTable();
|
shared->FrameBuffers = _mesa_NewHashTable();
|
||||||
@@ -459,7 +459,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
|
|||||||
}
|
}
|
||||||
|
|
||||||
simple_mtx_destroy(&shared->Mutex);
|
simple_mtx_destroy(&shared->Mutex);
|
||||||
mtx_destroy(&shared->TexMutex);
|
simple_mtx_destroy(&shared->TexMutex);
|
||||||
|
|
||||||
free(shared);
|
free(shared);
|
||||||
}
|
}
|
||||||
|
@@ -2161,7 +2161,7 @@ void
|
|||||||
_mesa_lock_context_textures( struct gl_context *ctx )
|
_mesa_lock_context_textures( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
if (!ctx->TexturesLocked)
|
if (!ctx->TexturesLocked)
|
||||||
mtx_lock(&ctx->Shared->TexMutex);
|
simple_mtx_lock(&ctx->Shared->TexMutex);
|
||||||
|
|
||||||
if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
|
if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
|
||||||
ctx->NewState |= _NEW_TEXTURE_OBJECT;
|
ctx->NewState |= _NEW_TEXTURE_OBJECT;
|
||||||
@@ -2176,7 +2176,7 @@ _mesa_unlock_context_textures( struct gl_context *ctx )
|
|||||||
{
|
{
|
||||||
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
|
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
|
||||||
if (!ctx->TexturesLocked)
|
if (!ctx->TexturesLocked)
|
||||||
mtx_unlock(&ctx->Shared->TexMutex);
|
simple_mtx_unlock(&ctx->Shared->TexMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ static inline void
|
|||||||
_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
||||||
{
|
{
|
||||||
if (!ctx->TexturesLocked)
|
if (!ctx->TexturesLocked)
|
||||||
mtx_lock(&ctx->Shared->TexMutex);
|
simple_mtx_lock(&ctx->Shared->TexMutex);
|
||||||
ctx->Shared->TextureStateStamp++;
|
ctx->Shared->TextureStateStamp++;
|
||||||
(void) texObj;
|
(void) texObj;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
|||||||
{
|
{
|
||||||
(void) texObj;
|
(void) texObj;
|
||||||
if (!ctx->TexturesLocked)
|
if (!ctx->TexturesLocked)
|
||||||
mtx_unlock(&ctx->Shared->TexMutex);
|
simple_mtx_unlock(&ctx->Shared->TexMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user