diff options
author | Timothy Arceri <[email protected]> | 2017-04-07 11:40:40 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-04-22 10:01:15 +1000 |
commit | 918cec8cbeeac58b8d9092d6fc4aacb8490eb50c (patch) | |
tree | 927c186256d0e754e0f9d714e56160a8a179d613 | |
parent | ef6af0d5f7b59bd567c65a41165c321e43de6353 (diff) |
mesa: don't lock hashtables that are not shared across contexts
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.
We could maybe just replace the hash with an ordinary hash table
but for now this should remove most of the unnecessary locking.
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r-- | src/mesa/main/arrayobj.c | 8 | ||||
-rw-r--r-- | src/mesa/main/pipelineobj.c | 6 | ||||
-rw-r--r-- | src/mesa/main/queryobj.c | 8 | ||||
-rw-r--r-- | src/mesa/main/queryobj.h | 2 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 7 |
5 files changed, 16 insertions, 15 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 24555d9c7a6..b901a891dc2 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -71,7 +71,7 @@ _mesa_lookup_vao(struct gl_context *ctx, GLuint id) return NULL; else return (struct gl_vertex_array_object *) - _mesa_HashLookup(ctx->Array.Objects, id); + _mesa_HashLookupLocked(ctx->Array.Objects, id); } @@ -108,7 +108,7 @@ _mesa_lookup_vao_err(struct gl_context *ctx, GLuint id, const char *caller) vao = ctx->Array.LastLookedUpVAO; } else { vao = (struct gl_vertex_array_object *) - _mesa_HashLookup(ctx->Array.Objects, id); + _mesa_HashLookupLocked(ctx->Array.Objects, id); /* The ARB_direct_state_access specification says: * @@ -306,7 +306,7 @@ save_array_object(struct gl_context *ctx, struct gl_vertex_array_object *vao) { if (vao->Name > 0) { /* insert into hash table */ - _mesa_HashInsert(ctx->Array.Objects, vao->Name, vao); + _mesa_HashInsertLocked(ctx->Array.Objects, vao->Name, vao); } } @@ -320,7 +320,7 @@ remove_array_object(struct gl_context *ctx, struct gl_vertex_array_object *vao) { if (vao->Name > 0) { /* remove from hash table */ - _mesa_HashRemove(ctx->Array.Objects, vao->Name); + _mesa_HashRemoveLocked(ctx->Array.Objects, vao->Name); } } diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 9a852be0920..dbca3c366ce 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -144,7 +144,7 @@ _mesa_lookup_pipeline_object(struct gl_context *ctx, GLuint id) return NULL; else return (struct gl_pipeline_object *) - _mesa_HashLookup(ctx->Pipeline.Objects, id); + _mesa_HashLookupLocked(ctx->Pipeline.Objects, id); } /** @@ -154,7 +154,7 @@ static void save_pipeline_object(struct gl_context *ctx, struct gl_pipeline_object *obj) { if (obj->Name > 0) { - _mesa_HashInsert(ctx->Pipeline.Objects, obj->Name, obj); + _mesa_HashInsertLocked(ctx->Pipeline.Objects, obj->Name, obj); } } @@ -166,7 +166,7 @@ static void remove_pipeline_object(struct gl_context *ctx, struct gl_pipeline_object *obj) { if (obj->Name > 0) { - _mesa_HashRemove(ctx->Pipeline.Objects, obj->Name); + _mesa_HashRemoveLocked(ctx->Pipeline.Objects, obj->Name); } } diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index e4edb519344..46535d7b4c8 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -278,7 +278,7 @@ create_queries(struct gl_context *ctx, GLenum target, GLsizei n, GLuint *ids, q->EverBound = GL_TRUE; } ids[i] = first + i; - _mesa_HashInsert(ctx->Query.QueryObjects, first + i, q); + _mesa_HashInsertLocked(ctx->Query.QueryObjects, first + i, q); } } } @@ -345,7 +345,7 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids) q->Active = GL_FALSE; ctx->Driver.EndQuery(ctx, q); } - _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]); + _mesa_HashRemoveLocked(ctx->Query.QueryObjects, ids[i]); ctx->Driver.DeleteQuery(ctx, q); } } @@ -448,7 +448,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}"); return; } - _mesa_HashInsert(ctx->Query.QueryObjects, id, q); + _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q); } } else { @@ -590,7 +590,7 @@ _mesa_QueryCounter(GLuint id, GLenum target) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glQueryCounter"); return; } - _mesa_HashInsert(ctx->Query.QueryObjects, id, q); + _mesa_HashInsertLocked(ctx->Query.QueryObjects, id, q); } else { if (q->Target && q->Target != GL_TIMESTAMP) { diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index d1036fcce3d..24a82571db0 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -35,7 +35,7 @@ static inline struct gl_query_object * _mesa_lookup_query_object(struct gl_context *ctx, GLuint id) { return (struct gl_query_object *) - _mesa_HashLookup(ctx->Query.QueryObjects, id); + _mesa_HashLookupLocked(ctx->Query.QueryObjects, id); } diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 131014ff653..3c72674d6c1 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -965,7 +965,7 @@ _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name) } else return (struct gl_transform_feedback_object *) - _mesa_HashLookup(ctx->TransformFeedback.Objects, name); + _mesa_HashLookupLocked(ctx->TransformFeedback.Objects, name); } static void @@ -1000,7 +1000,8 @@ create_transform_feedbacks(struct gl_context *ctx, GLsizei n, GLuint *ids, return; } ids[i] = first + i; - _mesa_HashInsert(ctx->TransformFeedback.Objects, first + i, obj); + _mesa_HashInsertLocked(ctx->TransformFeedback.Objects, first + i, + obj); if (dsa) { /* this is normally done at bind time in the non-dsa case */ obj->EverBound = GL_TRUE; @@ -1132,7 +1133,7 @@ _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names) names[i]); return; } - _mesa_HashRemove(ctx->TransformFeedback.Objects, names[i]); + _mesa_HashRemoveLocked(ctx->TransformFeedback.Objects, names[i]); /* unref, but object may not be deleted until later */ if (obj == ctx->TransformFeedback.CurrentObject) { reference_transform_feedback_object( |