mesa: Remove unnecessary locking from container objects.
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 <nicolai.haehnle@amd.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:

committed by
Timothy Arceri

parent
622a68ed3e
commit
0b2750620b
@@ -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 */
|
||||
|
@@ -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 */
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user