diff options
author | Fredrik Höglund <fredrik@kde.org> | 2015-05-03 14:38:53 +0200 |
---|---|---|
committer | Fredrik Höglund <fredrik@kde.org> | 2015-05-17 01:57:46 +0200 |
commit | 1d8b557e6ee6d92250f0e3306c9e3d3f09c7c1ee (patch) | |
tree | 8b8b0c6eea3e1787a6ecb4aa978d0ba283febded | |
parent | fd73e32048f3bfcbf6eb8665f6dd3beae7dce77f (diff) |
mesa: Make pipeline objects non thread safeatomic
Pipeline objects are container objects that are not shared, so they
don't need to be thread safe.
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/pipelineobj.c | 12 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 2 |
3 files changed, 2 insertions, 14 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2f7bfe3d8b..f22b67fe01 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2821,8 +2821,6 @@ struct gl_pipeline_object GLint RefCount; - mtx_t Mutex; - /** * Programs used for rendering * diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index a33cdd139c..de67a7f5c7 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -64,7 +64,6 @@ _mesa_delete_pipeline_object(struct gl_context *ctx, _mesa_reference_shader_program(ctx, &obj->CurrentProgram[i], NULL); _mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL); - mtx_destroy(&obj->Mutex); ralloc_free(obj); } @@ -77,7 +76,6 @@ _mesa_new_pipeline_object(struct gl_context *ctx, GLuint name) struct gl_pipeline_object *obj = rzalloc(NULL, struct gl_pipeline_object); if (obj) { obj->Name = name; - mtx_init(&obj->Mutex, mtx_plain); obj->RefCount = 1; obj->Flags = _mesa_get_shader_flags(); obj->InfoLog = NULL; @@ -183,16 +181,12 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, if (*ptr) { /* Unreference the old pipeline object */ - GLboolean deleteFlag = GL_FALSE; struct gl_pipeline_object *oldObj = *ptr; - mtx_lock(&oldObj->Mutex); assert(oldObj->RefCount > 0); oldObj->RefCount--; - deleteFlag = (oldObj->RefCount == 0); - mtx_unlock(&oldObj->Mutex); - if (deleteFlag) { + if (oldObj->RefCount == 0) { _mesa_delete_pipeline_object(ctx, oldObj); } @@ -202,8 +196,7 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, if (obj) { /* reference new pipeline object */ - mtx_lock(&obj->Mutex); - if (obj->RefCount == 0) { + if (unlikely(obj->RefCount == 0)) { /* this pipeline's being deleted (look just above) */ /* Not sure this can ever really happen. Warn if it does. */ _mesa_problem(NULL, "referencing deleted pipeline object"); @@ -213,7 +206,6 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, obj->RefCount++; *ptr = obj; } - mtx_unlock(&obj->Mutex); } } diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index a04b28711f..f58621c6b5 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -125,7 +125,6 @@ _mesa_init_shader_state(struct gl_context *ctx) /* Extended for ARB_separate_shader_objects */ ctx->Shader.RefCount = 1; - mtx_init(&ctx->Shader.Mutex, mtx_plain); } @@ -148,7 +147,6 @@ _mesa_free_shader_state(struct gl_context *ctx) _mesa_reference_pipeline_object(ctx, &ctx->_Shader, NULL); assert(ctx->Shader.RefCount == 1); - mtx_destroy(&ctx->Shader.Mutex); } |