From f0857fe87b6e8985cb1d0ec46c1a358c4cf37c29 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 16 Oct 2017 11:59:31 +1100 Subject: [PATCH] mesa: use simple mtx in core mesa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Results from x11perf -copywinwin10 on Eric's SKL: 4.33338% ± 0.905054% (n=40) Reviewed-by: Marek Olšák Reviewed-by: Nicolai Hähnle Tested-by: Yogesh Marathe --- src/gallium/state_trackers/dri/dri2.c | 22 +++++++++++----------- src/mesa/main/bufferobj.c | 14 +++++++------- src/mesa/main/debug_output.c | 16 ++++++++-------- src/mesa/main/errors.c | 4 ++-- src/mesa/main/fbobject.c | 14 +++++++------- src/mesa/main/framebuffer.c | 14 +++++++------- src/mesa/main/mtypes.h | 15 ++++++++------- src/mesa/main/renderbuffer.c | 12 ++++++------ src/mesa/main/robustness.c | 4 ++-- src/mesa/main/samplerobj.c | 12 ++++++------ src/mesa/main/shared.c | 12 ++++++------ src/mesa/main/syncobj.c | 14 +++++++------- src/mesa/main/texobj.c | 16 ++++++++-------- src/mesa/vbo/vbo_minmax_index.c | 8 ++++---- 14 files changed, 89 insertions(+), 88 deletions(-) diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index e0cd0e0bc7c..a70f37fe09a 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1696,7 +1696,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, return MESA_GLINTEROP_INVALID_MIP_LEVEL; /* Validate the OpenGL object and get pipe_resource. */ - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); if (target == GL_ARRAY_BUFFER) { /* Buffer objects. @@ -1712,14 +1712,14 @@ dri2_interop_export_object(__DRIcontext *_ctx, * the size of the buffer is 0." */ if (!buf || buf->Size == 0) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OBJECT; } res = st_buffer_object(buf)->buffer; if (!res) { /* this shouldn't happen */ - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OBJECT; } @@ -1740,7 +1740,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, * object or if the width or height of renderbuffer is zero." */ if (!rb || rb->Width == 0 || rb->Height == 0) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OBJECT; } @@ -1749,7 +1749,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, * renderbuffer object." */ if (rb->NumSamples > 1) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OPERATION; } @@ -1759,7 +1759,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, */ res = st_renderbuffer(rb)->texture; if (!res) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_OUT_OF_RESOURCES; } @@ -1789,7 +1789,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, obj->Target != target || !obj->_BaseComplete || (in->miplevel > 0 && !obj->_MipmapComplete)) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OBJECT; } @@ -1802,19 +1802,19 @@ dri2_interop_export_object(__DRIcontext *_ctx, * specification and section 3.7.10 of the OpenGL ES 2.0." */ if (in->miplevel < obj->BaseLevel || in->miplevel > obj->_MaxLevel) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_MIP_LEVEL; } if (!st_finalize_texture(ctx, st->pipe, obj, 0)) { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_OUT_OF_RESOURCES; } res = st_get_texobj_resource(obj); if (!res) { /* Incomplete texture buffer object? This shouldn't really occur. */ - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return MESA_GLINTEROP_INVALID_OBJECT; } @@ -1854,7 +1854,7 @@ dri2_interop_export_object(__DRIcontext *_ctx, success = screen->resource_get_handle(screen, st->pipe, res, &whandle, usage); - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); if (!success) return MESA_GLINTEROP_OUT_OF_HOST_MEMORY; diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index dfeea94bd19..c1dfdfba823 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -471,7 +471,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx, bufObj->RefCount = -1000; bufObj->Name = ~0; - mtx_destroy(&bufObj->Mutex); + simple_mtx_destroy(&bufObj->Mutex); free(bufObj->Label); free(bufObj); } @@ -493,11 +493,11 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, GLboolean deleteFlag = GL_FALSE; struct gl_buffer_object *oldObj = *ptr; - mtx_lock(&oldObj->Mutex); + simple_mtx_lock(&oldObj->Mutex); assert(oldObj->RefCount > 0); oldObj->RefCount--; deleteFlag = (oldObj->RefCount == 0); - mtx_unlock(&oldObj->Mutex); + simple_mtx_unlock(&oldObj->Mutex); if (deleteFlag) { assert(ctx->Driver.DeleteBuffer); @@ -510,12 +510,12 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, if (bufObj) { /* reference new buffer */ - mtx_lock(&bufObj->Mutex); + simple_mtx_lock(&bufObj->Mutex); assert(bufObj->RefCount > 0); bufObj->RefCount++; *ptr = bufObj; - mtx_unlock(&bufObj->Mutex); + simple_mtx_unlock(&bufObj->Mutex); } } @@ -547,7 +547,7 @@ _mesa_initialize_buffer_object(struct gl_context *ctx, GLuint name) { memset(obj, 0, sizeof(struct gl_buffer_object)); - mtx_init(&obj->Mutex, mtx_plain); + simple_mtx_init(&obj->Mutex, mtx_plain); obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; @@ -870,7 +870,7 @@ _mesa_init_buffer_objects( struct gl_context *ctx ) GLuint i; memset(&DummyBufferObject, 0, sizeof(DummyBufferObject)); - mtx_init(&DummyBufferObject.Mutex, mtx_plain); + simple_mtx_init(&DummyBufferObject.Mutex, mtx_plain); DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c index bc933db93d4..859e1f966d2 100644 --- a/src/mesa/main/debug_output.c +++ b/src/mesa/main/debug_output.c @@ -37,7 +37,7 @@ #include "util/simple_list.h" -static mtx_t DynamicIDMutex = _MTX_INITIALIZER_NP; +static simple_mtx_t DynamicIDMutex = _SIMPLE_MTX_INITIALIZER_NP; static GLuint NextDynamicID = 1; @@ -194,10 +194,10 @@ void _mesa_debug_get_id(GLuint *id) { if (!(*id)) { - mtx_lock(&DynamicIDMutex); + simple_mtx_lock(&DynamicIDMutex); if (!(*id)) *id = NextDynamicID++; - mtx_unlock(&DynamicIDMutex); + simple_mtx_unlock(&DynamicIDMutex); } } @@ -702,13 +702,13 @@ debug_pop_group(struct gl_debug_state *debug) static struct gl_debug_state * _mesa_lock_debug_state(struct gl_context *ctx) { - mtx_lock(&ctx->DebugMutex); + simple_mtx_lock(&ctx->DebugMutex); if (!ctx->Debug) { ctx->Debug = debug_create(); if (!ctx->Debug) { GET_CURRENT_CONTEXT(cur); - mtx_unlock(&ctx->DebugMutex); + simple_mtx_unlock(&ctx->DebugMutex); /* * This function may be called from other threads. When that is the @@ -727,7 +727,7 @@ _mesa_lock_debug_state(struct gl_context *ctx) static void _mesa_unlock_debug_state(struct gl_context *ctx) { - mtx_unlock(&ctx->DebugMutex); + simple_mtx_unlock(&ctx->DebugMutex); } /** @@ -1273,7 +1273,7 @@ _mesa_PopDebugGroup(void) void _mesa_init_debug_output(struct gl_context *ctx) { - mtx_init(&ctx->DebugMutex, mtx_plain); + simple_mtx_init(&ctx->DebugMutex, mtx_plain); if (MESA_DEBUG_FLAGS & DEBUG_CONTEXT) { /* If the MESA_DEBUG env is set to "context", we'll turn on the @@ -1301,7 +1301,7 @@ _mesa_free_errors_data(struct gl_context *ctx) ctx->Debug = NULL; } - mtx_destroy(&ctx->DebugMutex); + simple_mtx_destroy(&ctx->DebugMutex); } void GLAPIENTRY diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 9173788d1de..35a2f66c31c 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -276,7 +276,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) do_output = should_output(ctx, error, fmtString); - mtx_lock(&ctx->DebugMutex); + simple_mtx_lock(&ctx->DebugMutex); if (ctx->Debug) { do_log = _mesa_debug_is_message_enabled(ctx->Debug, MESA_DEBUG_SOURCE_API, @@ -287,7 +287,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) else { do_log = GL_FALSE; } - mtx_unlock(&ctx->DebugMutex); + simple_mtx_unlock(&ctx->DebugMutex); if (do_output || do_log) { char s[MAX_DEBUG_MESSAGE_LENGTH], s2[MAX_DEBUG_MESSAGE_LENGTH]; diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9a2c7ebbcf7..81165630d0d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -89,9 +89,9 @@ delete_dummy_framebuffer(struct gl_framebuffer *fb) void _mesa_init_fbobjects(struct gl_context *ctx) { - mtx_init(&DummyFramebuffer.Mutex, mtx_plain); - mtx_init(&DummyRenderbuffer.Mutex, mtx_plain); - mtx_init(&IncompleteFramebuffer.Mutex, mtx_plain); + simple_mtx_init(&DummyFramebuffer.Mutex, mtx_plain); + simple_mtx_init(&DummyRenderbuffer.Mutex, mtx_plain); + simple_mtx_init(&IncompleteFramebuffer.Mutex, mtx_plain); DummyFramebuffer.Delete = delete_dummy_framebuffer; DummyRenderbuffer.Delete = delete_dummy_renderbuffer; IncompleteFramebuffer.Delete = delete_dummy_framebuffer; @@ -558,7 +558,7 @@ _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx, { struct gl_renderbuffer_attachment *att; - mtx_lock(&fb->Mutex); + simple_mtx_lock(&fb->Mutex); att = get_attachment(ctx, fb, attachment, NULL); assert(att); @@ -584,7 +584,7 @@ _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx, invalidate_framebuffer(fb); - mtx_unlock(&fb->Mutex); + simple_mtx_unlock(&fb->Mutex); } @@ -3296,7 +3296,7 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, { FLUSH_VERTICES(ctx, _NEW_BUFFERS); - mtx_lock(&fb->Mutex); + simple_mtx_lock(&fb->Mutex); if (texObj) { if (attachment == GL_DEPTH_ATTACHMENT && texObj == fb->Attachment[BUFFER_STENCIL].Texture && @@ -3355,7 +3355,7 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, invalidate_framebuffer(fb); - mtx_unlock(&fb->Mutex); + simple_mtx_unlock(&fb->Mutex); } diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 039762a074a..663c4034d4a 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -131,7 +131,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, memset(fb, 0, sizeof(struct gl_framebuffer)); - mtx_init(&fb->Mutex, mtx_plain); + simple_mtx_init(&fb->Mutex, mtx_plain); fb->RefCount = 1; @@ -184,7 +184,7 @@ _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name) fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT; fb->_ColorReadBufferIndex = BUFFER_COLOR0; fb->Delete = _mesa_destroy_framebuffer; - mtx_init(&fb->Mutex, mtx_plain); + simple_mtx_init(&fb->Mutex, mtx_plain); } @@ -215,7 +215,7 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb) assert(fb); assert(fb->RefCount == 0); - mtx_destroy(&fb->Mutex); + simple_mtx_destroy(&fb->Mutex); for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; @@ -246,11 +246,11 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_framebuffer *oldFb = *ptr; - mtx_lock(&oldFb->Mutex); + simple_mtx_lock(&oldFb->Mutex); assert(oldFb->RefCount > 0); oldFb->RefCount--; deleteFlag = (oldFb->RefCount == 0); - mtx_unlock(&oldFb->Mutex); + simple_mtx_unlock(&oldFb->Mutex); if (deleteFlag) oldFb->Delete(oldFb); @@ -259,9 +259,9 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr, } if (fb) { - mtx_lock(&fb->Mutex); + simple_mtx_lock(&fb->Mutex); fb->RefCount++; - mtx_unlock(&fb->Mutex); + simple_mtx_unlock(&fb->Mutex); *ptr = fb; } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a6931649aa0..d0926308d0a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -47,6 +47,7 @@ #include "main/formats.h" /* MESA_FORMAT_COUNT */ #include "compiler/glsl/list.h" #include "util/bitscan.h" +#include "util/simple_mtx.h" #include "util/u_dynarray.h" @@ -969,7 +970,7 @@ typedef enum */ struct gl_sampler_object { - mtx_t Mutex; + simple_mtx_t Mutex; GLuint Name; GLint RefCount; GLchar *Label; /**< GL_KHR_debug */ @@ -1001,7 +1002,7 @@ struct gl_sampler_object */ struct gl_texture_object { - mtx_t Mutex; /**< for thread safety */ + simple_mtx_t Mutex; /**< for thread safety */ GLint RefCount; /**< reference count */ GLuint Name; /**< the user-visible texture object ID */ GLchar *Label; /**< GL_KHR_debug */ @@ -1391,7 +1392,7 @@ typedef enum { */ struct gl_buffer_object { - mtx_t Mutex; + simple_mtx_t Mutex; GLint RefCount; GLuint Name; GLchar *Label; /**< GL_KHR_debug */ @@ -3215,7 +3216,7 @@ struct gl_sync_object */ struct gl_shared_state { - mtx_t Mutex; /**< for thread safety */ + simple_mtx_t Mutex; /**< for thread safety */ GLint RefCount; /**< Reference count */ struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ struct _mesa_HashTable *BitmapAtlas; /**< For optimized glBitmap text */ @@ -3299,7 +3300,7 @@ struct gl_shared_state */ struct gl_renderbuffer { - mtx_t Mutex; /**< for thread safety */ + simple_mtx_t Mutex; /**< for thread safety */ GLuint ClassID; /**< Useful for drivers */ GLuint Name; GLchar *Label; /**< GL_KHR_debug */ @@ -3377,7 +3378,7 @@ struct gl_renderbuffer_attachment */ struct gl_framebuffer { - mtx_t Mutex; /**< for thread safety */ + simple_mtx_t Mutex; /**< for thread safety */ /** * If zero, this is a window system framebuffer. If non-zero, this * is a FBO framebuffer; note that for some devices (i.e. those with @@ -4926,7 +4927,7 @@ struct gl_context GLuint ErrorDebugCount; /* GL_ARB_debug_output/GL_KHR_debug */ - mtx_t DebugMutex; + simple_mtx_t DebugMutex; struct gl_debug_state *Debug; GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 925001a76a3..0e017125ac0 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -40,7 +40,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) { GET_CURRENT_CONTEXT(ctx); - mtx_init(&rb->Mutex, mtx_plain); + simple_mtx_init(&rb->Mutex, mtx_plain); rb->ClassID = 0; rb->Name = name; @@ -101,7 +101,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name) void _mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { - mtx_destroy(&rb->Mutex); + simple_mtx_destroy(&rb->Mutex); free(rb->Label); free(rb); } @@ -201,11 +201,11 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_renderbuffer *oldRb = *ptr; - mtx_lock(&oldRb->Mutex); + simple_mtx_lock(&oldRb->Mutex); assert(oldRb->RefCount > 0); oldRb->RefCount--; deleteFlag = (oldRb->RefCount == 0); - mtx_unlock(&oldRb->Mutex); + simple_mtx_unlock(&oldRb->Mutex); if (deleteFlag) { GET_CURRENT_CONTEXT(ctx); @@ -218,9 +218,9 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr, if (rb) { /* reference new renderbuffer */ - mtx_lock(&rb->Mutex); + simple_mtx_lock(&rb->Mutex); rb->RefCount++; - mtx_unlock(&rb->Mutex); + simple_mtx_unlock(&rb->Mutex); *ptr = rb; } } diff --git a/src/mesa/main/robustness.c b/src/mesa/main/robustness.c index 47402a29304..a61c07f125f 100644 --- a/src/mesa/main/robustness.c +++ b/src/mesa/main/robustness.c @@ -136,7 +136,7 @@ _mesa_GetGraphicsResetStatusARB( void ) */ status = ctx->Driver.GetGraphicsResetStatus(ctx); - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); /* If this context has not been affected by a GPU reset, check to see if * some other context in the share group has been affected by a reset. @@ -150,7 +150,7 @@ _mesa_GetGraphicsResetStatusARB( void ) } ctx->ShareGroupReset = ctx->Shared->ShareGroupReset; - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); } if (status != GL_NO_ERROR) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 2ecb01777b3..5ebf9e24f94 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -63,7 +63,7 @@ delete_sampler_object(struct gl_context *ctx, struct gl_sampler_object *sampObj) { _mesa_delete_sampler_handles(ctx, sampObj); - mtx_destroy(&sampObj->Mutex); + simple_mtx_destroy(&sampObj->Mutex); free(sampObj->Label); free(sampObj); } @@ -83,11 +83,11 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, GLboolean deleteFlag = GL_FALSE; struct gl_sampler_object *oldSamp = *ptr; - mtx_lock(&oldSamp->Mutex); + simple_mtx_lock(&oldSamp->Mutex); assert(oldSamp->RefCount > 0); oldSamp->RefCount--; deleteFlag = (oldSamp->RefCount == 0); - mtx_unlock(&oldSamp->Mutex); + simple_mtx_unlock(&oldSamp->Mutex); if (deleteFlag) delete_sampler_object(ctx, oldSamp); @@ -98,12 +98,12 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, if (samp) { /* reference new sampler */ - mtx_lock(&samp->Mutex); + simple_mtx_lock(&samp->Mutex); assert(samp->RefCount > 0); samp->RefCount++; *ptr = samp; - mtx_unlock(&samp->Mutex); + simple_mtx_unlock(&samp->Mutex); } } @@ -114,7 +114,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, static void _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name) { - mtx_init(&sampObj->Mutex, mtx_plain); + simple_mtx_init(&sampObj->Mutex, mtx_plain); sampObj->Name = name; sampObj->RefCount = 1; sampObj->WrapS = GL_REPEAT; diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 53b8597d560..e3417a4df30 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -66,7 +66,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) if (!shared) return NULL; - mtx_init(&shared->Mutex, mtx_plain); + simple_mtx_init(&shared->Mutex, mtx_plain); shared->DisplayList = _mesa_NewHashTable(); shared->BitmapAtlas = _mesa_NewHashTable(); @@ -435,7 +435,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) _mesa_DeleteHashTable(shared->MemoryObjects); } - mtx_destroy(&shared->Mutex); + simple_mtx_destroy(&shared->Mutex); mtx_destroy(&shared->TexMutex); free(shared); @@ -459,11 +459,11 @@ _mesa_reference_shared_state(struct gl_context *ctx, struct gl_shared_state *old = *ptr; GLboolean delete; - mtx_lock(&old->Mutex); + simple_mtx_lock(&old->Mutex); assert(old->RefCount >= 1); old->RefCount--; delete = (old->RefCount == 0); - mtx_unlock(&old->Mutex); + simple_mtx_unlock(&old->Mutex); if (delete) { free_shared_state(ctx, old); @@ -474,9 +474,9 @@ _mesa_reference_shared_state(struct gl_context *ctx, if (state) { /* reference new state */ - mtx_lock(&state->Mutex); + simple_mtx_lock(&state->Mutex); state->RefCount++; *ptr = state; - mtx_unlock(&state->Mutex); + simple_mtx_unlock(&state->Mutex); } } diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 6a21309aadf..c38a5707ddb 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -177,7 +177,7 @@ struct gl_sync_object * _mesa_get_and_ref_sync(struct gl_context *ctx, GLsync sync, bool incRefCount) { struct gl_sync_object *syncObj = (struct gl_sync_object *) sync; - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); if (syncObj != NULL && _mesa_set_search(ctx->Shared->SyncObjects, syncObj) != NULL && !syncObj->DeletePending) { @@ -187,7 +187,7 @@ _mesa_get_and_ref_sync(struct gl_context *ctx, GLsync sync, bool incRefCount) } else { syncObj = NULL; } - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return syncObj; } @@ -198,17 +198,17 @@ _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj, { struct set_entry *entry; - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); syncObj->RefCount -= amount; if (syncObj->RefCount == 0) { entry = _mesa_set_search(ctx->Shared->SyncObjects, syncObj); assert (entry != NULL); _mesa_set_remove(ctx->Shared->SyncObjects, entry); - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); ctx->Driver.DeleteSyncObject(ctx, syncObj); } else { - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); } } @@ -292,9 +292,9 @@ fence_sync(struct gl_context *ctx, GLenum condition, GLbitfield flags) ctx->Driver.FenceSync(ctx, syncObj, condition, flags); - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); _mesa_set_add(ctx->Shared->SyncObjects, syncObj); - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); return (GLsync)syncObj; } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1978898b8b9..71c6f813233 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -274,7 +274,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, memset(obj, 0, sizeof(*obj)); /* init the non-zero fields */ - mtx_init(&obj->Mutex, mtx_plain); + simple_mtx_init(&obj->Mutex, mtx_plain); obj->RefCount = 1; obj->Name = name; obj->Target = target; @@ -411,7 +411,7 @@ _mesa_delete_texture_object(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, &texObj->BufferObject, NULL); /* destroy the mutex -- it may have allocated memory (eg on bsd) */ - mtx_destroy(&texObj->Mutex); + simple_mtx_destroy(&texObj->Mutex); free(texObj->Label); @@ -554,12 +554,12 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr, assert(valid_texture_object(oldTex)); (void) valid_texture_object; /* silence warning in release builds */ - mtx_lock(&oldTex->Mutex); + simple_mtx_lock(&oldTex->Mutex); assert(oldTex->RefCount > 0); oldTex->RefCount--; deleteFlag = (oldTex->RefCount == 0); - mtx_unlock(&oldTex->Mutex); + simple_mtx_unlock(&oldTex->Mutex); if (deleteFlag) { /* Passing in the context drastically changes the driver code for @@ -579,12 +579,12 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr, if (tex) { /* reference new texture */ assert(valid_texture_object(tex)); - mtx_lock(&tex->Mutex); + simple_mtx_lock(&tex->Mutex); assert(tex->RefCount > 0); tex->RefCount++; *ptr = tex; - mtx_unlock(&tex->Mutex); + simple_mtx_unlock(&tex->Mutex); } } @@ -1615,10 +1615,10 @@ bind_texture_object(struct gl_context *ctx, unsigned unit, */ if (targetIndex != TEXTURE_EXTERNAL_INDEX) { bool early_out; - mtx_lock(&ctx->Shared->Mutex); + simple_mtx_lock(&ctx->Shared->Mutex); early_out = ((ctx->Shared->RefCount == 1) && (texObj == texUnit->CurrentTex[targetIndex])); - mtx_unlock(&ctx->Shared->Mutex); + simple_mtx_unlock(&ctx->Shared->Mutex); if (early_out) { return; } diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c index 1377926bbab..c9d20201672 100644 --- a/src/mesa/vbo/vbo_minmax_index.c +++ b/src/mesa/vbo/vbo_minmax_index.c @@ -115,7 +115,7 @@ vbo_get_minmax_cached(struct gl_buffer_object *bufferObj, if (!vbo_use_minmax_cache(bufferObj)) return GL_FALSE; - mtx_lock(&bufferObj->Mutex); + simple_mtx_lock(&bufferObj->Mutex); if (bufferObj->MinMaxCacheDirty) { /* Disable the cache permanently for this BO if the number of hits @@ -166,7 +166,7 @@ out_invalidate: } out_disable: - mtx_unlock(&bufferObj->Mutex); + simple_mtx_unlock(&bufferObj->Mutex); return found; } @@ -184,7 +184,7 @@ vbo_minmax_cache_store(struct gl_context *ctx, if (!vbo_use_minmax_cache(bufferObj)) return; - mtx_lock(&bufferObj->Mutex); + simple_mtx_lock(&bufferObj->Mutex); if (!bufferObj->MinMaxCache) { bufferObj->MinMaxCache = @@ -223,7 +223,7 @@ vbo_minmax_cache_store(struct gl_context *ctx, free(entry); out: - mtx_unlock(&bufferObj->Mutex); + simple_mtx_unlock(&bufferObj->Mutex); }