mesa: use simple_mtx_t for ShaderIncludeMutex
authorMarek Olšák <marek.olsak@amd.com>
Fri, 1 Oct 2021 19:59:00 +0000 (15:59 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 5 Oct 2021 23:46:14 +0000 (23:46 +0000)
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>

src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/main/shared.c

index 96875b9..f00f58a 100644 (file)
@@ -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
index 9381924..1dda13d 100644 (file)
@@ -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);
 }
index f91dfd6..0f7256b 100644 (file)
@@ -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);