From 0b2750620b65f9a5fd56ed857ddfef5fafec0894 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 21 Apr 2017 13:48:38 +1000 Subject: mesa: Remove unnecessary locking from container objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From Chapter 5 'Shared Objects and Multiple Contexts' of the OpenGL 4.5 spec: "Objects which contain references to other objects include framebuffer, program pipeline, query, transform feedback, and vertex array objects. Such objects are called container objects and are not shared" For we leave locking in place for framebuffer objects because the EXT fbo extension allowed sharing. V2: (Timothy Arceri) - rebased and dropped changes to framebuffer objects Reviewed-by: Nicolai Hähnle Reviewed-by: Samuel Pitoiset --- src/mesa/main/arrayobj.c | 6 ------ src/mesa/main/mtypes.h | 4 ---- src/mesa/main/pipelineobj.c | 6 ------ src/mesa/main/shaderapi.c | 3 --- 4 files changed, 19 deletions(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index fdb3caad954..9f4477e45b3 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -169,7 +169,6 @@ _mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj) { unbind_array_object_vbos(ctx, obj); _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL); - mtx_destroy(&obj->Mutex); free(obj->Label); free(obj); } @@ -192,11 +191,9 @@ _mesa_reference_vao_(struct gl_context *ctx, GLboolean deleteFlag = GL_FALSE; struct gl_vertex_array_object *oldObj = *ptr; - mtx_lock(&oldObj->Mutex); assert(oldObj->RefCount > 0); oldObj->RefCount--; deleteFlag = (oldObj->RefCount == 0); - mtx_unlock(&oldObj->Mutex); if (deleteFlag) _mesa_delete_vao(ctx, oldObj); @@ -207,12 +204,10 @@ _mesa_reference_vao_(struct gl_context *ctx, if (vao) { /* reference new array object */ - mtx_lock(&vao->Mutex); assert(vao->RefCount > 0); vao->RefCount++; *ptr = vao; - mtx_unlock(&vao->Mutex); } } @@ -268,7 +263,6 @@ _mesa_initialize_vao(struct gl_context *ctx, vao->Name = name; - mtx_init(&vao->Mutex, mtx_plain); vao->RefCount = 1; /* Init the individual arrays */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c4fab9dbac2..b3711ba256c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1509,8 +1509,6 @@ struct gl_vertex_array_object GLchar *Label; /**< GL_KHR_debug */ - mtx_t Mutex; - /** * Does the VAO use ARB semantics or Apple semantics? * @@ -3001,8 +2999,6 @@ struct gl_pipeline_object GLint RefCount; - mtx_t Mutex; - GLchar *Label; /**< GL_KHR_debug */ /** diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 2988c97455e..a0fa55a85c4 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -66,7 +66,6 @@ _mesa_delete_pipeline_object(struct gl_context *ctx, } _mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL); - mtx_destroy(&obj->Mutex); free(obj->Label); ralloc_free(obj); } @@ -80,7 +79,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; @@ -189,11 +187,9 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, 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) { _mesa_delete_pipeline_object(ctx, oldObj); @@ -205,12 +201,10 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, if (obj) { /* reference new pipeline object */ - mtx_lock(&obj->Mutex); assert(obj->RefCount > 0); obj->RefCount++; *ptr = obj; - mtx_unlock(&obj->Mutex); } } diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 187475f1277..c41f006eb79 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -138,8 +138,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); - ctx->TessCtrlProgram.patch_vertices = 3; for (i = 0; i < 4; ++i) ctx->TessCtrlProgram.patch_default_outer_level[i] = 1.0; @@ -164,7 +162,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); } -- cgit v1.2.3