From: Marek Olšák Date: Thu, 26 Sep 2019 17:37:45 +0000 (-0400) Subject: st/mesa: use simple_mtx_t instead of mtx_t X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5498a8d23c9e9074ab36d2456e16bba66d7e139a;p=mesa.git st/mesa: use simple_mtx_t instead of mtx_t Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c index 44323b4750a..48e7647b602 100644 --- a/src/mesa/state_tracker/st_cb_syncobj.c +++ b/src/mesa/state_tracker/st_cb_syncobj.c @@ -41,7 +41,7 @@ struct st_sync_object { struct gl_sync_object b; struct pipe_fence_handle *fence; - mtx_t mutex; /**< protects "fence" */ + simple_mtx_t mutex; /**< protects "fence" */ }; @@ -49,7 +49,7 @@ static struct gl_sync_object *st_new_sync_object(struct gl_context *ctx) { struct st_sync_object *so = CALLOC_STRUCT(st_sync_object); - mtx_init(&so->mutex, mtx_plain); + simple_mtx_init(&so->mutex, mtx_plain); return &so->b; } @@ -60,7 +60,7 @@ static void st_delete_sync_object(struct gl_context *ctx, struct st_sync_object *so = (struct st_sync_object*)obj; screen->fence_reference(screen, &so->fence, NULL); - mtx_destroy(&so->mutex); + simple_mtx_destroy(&so->mutex); free(so->b.Label); free(so); } @@ -87,9 +87,9 @@ static void st_client_wait_sync(struct gl_context *ctx, struct pipe_fence_handle *fence = NULL; /* If the fence doesn't exist, assume it's signalled. */ - mtx_lock(&so->mutex); + simple_mtx_lock(&so->mutex); if (!so->fence) { - mtx_unlock(&so->mutex); + simple_mtx_unlock(&so->mutex); so->b.StatusFlag = GL_TRUE; return; } @@ -98,7 +98,7 @@ static void st_client_wait_sync(struct gl_context *ctx, * fence_finish unlocked. */ screen->fence_reference(screen, &fence, so->fence); - mtx_unlock(&so->mutex); + simple_mtx_unlock(&so->mutex); /* Section 4.1.2 of OpenGL 4.5 (Compatibility Profile) says: * [...] if ClientWaitSync is called and all of the following are true: @@ -113,9 +113,9 @@ static void st_client_wait_sync(struct gl_context *ctx, * forget to set it. */ if (screen->fence_finish(screen, pipe, fence, timeout)) { - mtx_lock(&so->mutex); + simple_mtx_lock(&so->mutex); screen->fence_reference(screen, &so->fence, NULL); - mtx_unlock(&so->mutex); + simple_mtx_unlock(&so->mutex); so->b.StatusFlag = GL_TRUE; } screen->fence_reference(screen, &fence, NULL); @@ -141,16 +141,16 @@ static void st_server_wait_sync(struct gl_context *ctx, return; /* If the fence doesn't exist, assume it's signalled. */ - mtx_lock(&so->mutex); + simple_mtx_lock(&so->mutex); if (!so->fence) { - mtx_unlock(&so->mutex); + simple_mtx_unlock(&so->mutex); so->b.StatusFlag = GL_TRUE; return; } /* We need a local copy of the fence pointer. */ screen->fence_reference(screen, &fence, so->fence); - mtx_unlock(&so->mutex); + simple_mtx_unlock(&so->mutex); pipe->fence_server_sync(pipe, fence); screen->fence_reference(screen, &fence, NULL); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 17436526c7b..de106144de9 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -302,9 +302,9 @@ st_save_zombie_sampler_view(struct st_context *st, /* We need a mutex since this function may be called from one thread * while free_zombie_resource_views() is called from another. */ - mtx_lock(&st->zombie_sampler_views.mutex); + simple_mtx_lock(&st->zombie_sampler_views.mutex); LIST_ADDTAIL(&entry->node, &st->zombie_sampler_views.list.node); - mtx_unlock(&st->zombie_sampler_views.mutex); + simple_mtx_unlock(&st->zombie_sampler_views.mutex); } @@ -335,9 +335,9 @@ st_save_zombie_shader(struct st_context *st, /* We need a mutex since this function may be called from one thread * while free_zombie_shaders() is called from another. */ - mtx_lock(&st->zombie_shaders.mutex); + simple_mtx_lock(&st->zombie_shaders.mutex); LIST_ADDTAIL(&entry->node, &st->zombie_shaders.list.node); - mtx_unlock(&st->zombie_shaders.mutex); + simple_mtx_unlock(&st->zombie_shaders.mutex); } @@ -353,7 +353,7 @@ free_zombie_sampler_views(struct st_context *st) return; } - mtx_lock(&st->zombie_sampler_views.mutex); + simple_mtx_lock(&st->zombie_sampler_views.mutex); LIST_FOR_EACH_ENTRY_SAFE(entry, next, &st->zombie_sampler_views.list.node, node) { @@ -367,7 +367,7 @@ free_zombie_sampler_views(struct st_context *st) assert(LIST_IS_EMPTY(&st->zombie_sampler_views.list.node)); - mtx_unlock(&st->zombie_sampler_views.mutex); + simple_mtx_unlock(&st->zombie_sampler_views.mutex); } @@ -383,7 +383,7 @@ free_zombie_shaders(struct st_context *st) return; } - mtx_lock(&st->zombie_shaders.mutex); + simple_mtx_lock(&st->zombie_shaders.mutex); LIST_FOR_EACH_ENTRY_SAFE(entry, next, &st->zombie_shaders.list.node, node) { @@ -416,7 +416,7 @@ free_zombie_shaders(struct st_context *st) assert(LIST_IS_EMPTY(&st->zombie_shaders.list.node)); - mtx_unlock(&st->zombie_shaders.mutex); + simple_mtx_unlock(&st->zombie_shaders.mutex); } @@ -762,9 +762,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, LIST_INITHEAD(&st->winsys_buffers); LIST_INITHEAD(&st->zombie_sampler_views.list.node); - mtx_init(&st->zombie_sampler_views.mutex, mtx_plain); + simple_mtx_init(&st->zombie_sampler_views.mutex, mtx_plain); LIST_INITHEAD(&st->zombie_shaders.list.node); - mtx_init(&st->zombie_shaders.mutex, mtx_plain); + simple_mtx_init(&st->zombie_shaders.mutex, mtx_plain); return st; } @@ -1005,8 +1005,8 @@ st_destroy_context(struct st_context *st) st_context_free_zombie_objects(st); - mtx_destroy(&st->zombie_sampler_views.mutex); - mtx_destroy(&st->zombie_shaders.mutex); + simple_mtx_destroy(&st->zombie_sampler_views.mutex); + simple_mtx_destroy(&st->zombie_shaders.mutex); st_reference_fragprog(st, &st->fp, NULL); st_reference_prog(st, &st->gp, NULL); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index f79b7af1088..1142e0f71bd 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -337,12 +337,12 @@ struct st_context struct { struct st_zombie_sampler_view_node list; - mtx_t mutex; + simple_mtx_t mutex; } zombie_sampler_views; struct { struct st_zombie_shader_node list; - mtx_t mutex; + simple_mtx_t mutex; } zombie_shaders; }; diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 62af7ba921b..a21580e539c 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -67,7 +67,7 @@ struct hash_table; struct st_manager_private { struct hash_table *stfbi_ht; /* framebuffer iface objects hash table */ - mtx_t st_mutex; + simple_mtx_t st_mutex; }; @@ -550,9 +550,9 @@ st_framebuffer_iface_lookup(struct st_manager *smapi, assert(smPriv); assert(smPriv->stfbi_ht); - mtx_lock(&smPriv->st_mutex); + simple_mtx_lock(&smPriv->st_mutex); entry = _mesa_hash_table_search(smPriv->stfbi_ht, stfbi); - mtx_unlock(&smPriv->st_mutex); + simple_mtx_unlock(&smPriv->st_mutex); return entry != NULL; } @@ -569,9 +569,9 @@ st_framebuffer_iface_insert(struct st_manager *smapi, assert(smPriv); assert(smPriv->stfbi_ht); - mtx_lock(&smPriv->st_mutex); + simple_mtx_lock(&smPriv->st_mutex); entry = _mesa_hash_table_insert(smPriv->stfbi_ht, stfbi, stfbi); - mtx_unlock(&smPriv->st_mutex); + simple_mtx_unlock(&smPriv->st_mutex); return entry != NULL; } @@ -588,7 +588,7 @@ st_framebuffer_iface_remove(struct st_manager *smapi, if (!smPriv || !smPriv->stfbi_ht) return; - mtx_lock(&smPriv->st_mutex); + simple_mtx_lock(&smPriv->st_mutex); entry = _mesa_hash_table_search(smPriv->stfbi_ht, stfbi); if (!entry) goto unlock; @@ -596,7 +596,7 @@ st_framebuffer_iface_remove(struct st_manager *smapi, _mesa_hash_table_remove(smPriv->stfbi_ht, entry); unlock: - mtx_unlock(&smPriv->st_mutex); + simple_mtx_unlock(&smPriv->st_mutex); } @@ -841,7 +841,7 @@ st_manager_destroy(struct st_manager *smapi) if (smPriv && smPriv->stfbi_ht) { _mesa_hash_table_destroy(smPriv->stfbi_ht, NULL); - mtx_destroy(&smPriv->st_mutex); + simple_mtx_destroy(&smPriv->st_mutex); free(smPriv); smapi->st_manager_private = NULL; } @@ -891,7 +891,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, struct st_manager_private *smPriv; smPriv = CALLOC_STRUCT(st_manager_private); - mtx_init(&smPriv->st_mutex, mtx_plain); + simple_mtx_init(&smPriv->st_mutex, mtx_plain); smPriv->stfbi_ht = _mesa_hash_table_create(NULL, st_framebuffer_iface_hash, st_framebuffer_iface_equal);