Mesa (main): mesa: use simple_mtx_t for ShaderIncludeMutex

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 6 00:12:41 UTC 2021


Module: Mesa
Branch: main
Commit: 82b420df32c829c0ff177771af2188cfcaf47374
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=82b420df32c829c0ff177771af2188cfcaf47374

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Oct  1 15:59:00 2021 -0400

mesa: use simple_mtx_t for ShaderIncludeMutex

Acked-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

---

 src/mesa/main/mtypes.h    |  2 +-
 src/mesa/main/shaderapi.c | 12 ++++++------
 src/mesa/main/shared.c    |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 96875b96d77..f00f58a80f1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3442,7 +3442,7 @@ struct gl_shared_state
    /* glCompileShaderInclude expects ShaderIncludes not to change while it is
     * in progress.
     */
-   mtx_t ShaderIncludeMutex;
+   simple_mtx_t ShaderIncludeMutex;
 
    /**
     * Some context in this share group was affected by a GPU reset
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 93819241a75..1dda13d9f1f 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -3577,7 +3577,7 @@ _mesa_NamedStringARB(GLenum type, GLint namelen, const GLchar *name,
       return;
    }
 
-   mtx_lock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_lock(&ctx->Shared->ShaderIncludeMutex);
 
    struct hash_table *path_ht =
       ctx->Shared->ShaderIncludes->shader_include_tree;
@@ -3606,7 +3606,7 @@ _mesa_NamedStringARB(GLenum type, GLint namelen, const GLchar *name,
       }
    }
 
-   mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
 
    free(name_cp);
    ralloc_free(mem_ctx);
@@ -3632,12 +3632,12 @@ _mesa_DeleteNamedStringARB(GLint namelen, const GLchar *name)
       return;
    }
 
-   mtx_lock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_lock(&ctx->Shared->ShaderIncludeMutex);
 
    free(shader_include->shader_source);
    shader_include->shader_source = NULL;
 
-   mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
 
    free(name_cp);
 }
@@ -3657,7 +3657,7 @@ _mesa_CompileShaderIncludeARB(GLuint shader, GLsizei count,
 
    void *mem_ctx = ralloc_context(NULL);
 
-   mtx_lock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_lock(&ctx->Shared->ShaderIncludeMutex);
 
    ctx->Shared->ShaderIncludes->include_paths =
       ralloc_array_size(mem_ctx, sizeof(struct sh_incl_path_entry *), count);
@@ -3701,7 +3701,7 @@ exit:
    ctx->Shared->ShaderIncludes->relative_path_cursor = 0;
    ctx->Shared->ShaderIncludes->include_paths = NULL;
 
-   mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
+   simple_mtx_unlock(&ctx->Shared->ShaderIncludeMutex);
 
    ralloc_free(mem_ctx);
 }
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index f91dfd6194f..0f7256b053f 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -96,7 +96,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
 
    /* ARB_shading_language_include */
    _mesa_init_shader_includes(shared);
-   mtx_init(&shared->ShaderIncludeMutex, mtx_plain);
+   simple_mtx_init(&shared->ShaderIncludeMutex, mtx_plain);
 
    /* Create default texture objects */
    for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
@@ -446,7 +446,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
 
    /* ARB_shading_language_include */
    _mesa_destroy_shader_includes(shared);
-   mtx_destroy(&shared->ShaderIncludeMutex);
+   simple_mtx_destroy(&shared->ShaderIncludeMutex);
 
    if (shared->MemoryObjects) {
       _mesa_HashDeleteAll(shared->MemoryObjects, delete_memory_object_cb, ctx);



More information about the mesa-commit mailing list