gallium/util: replace pipe_mutex_init() with mtx_init()

pipe_mutex_init() was made unnecessary with fd33a6bcd7.

Replace was done using:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_init(\([^)]*\)):(void) mtx_init(\&\1, mtx_plain):g' {} \;

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Timothy Arceri 2017-03-05 12:00:15 +11:00
parent acdcaf9be4
commit 75b47dda0c
46 changed files with 65 additions and 68 deletions

View File

@ -108,9 +108,6 @@ static inline int pipe_thread_is_self( pipe_thread thread )
return 0;
}
#define pipe_mutex_init(mutex) \
(void) mtx_init(&(mutex), mtx_plain)
#define pipe_mutex_destroy(mutex) \
mtx_destroy(&(mutex))
@ -181,7 +178,7 @@ static inline void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
barrier->count = count;
barrier->waiters = 0;
barrier->sequence = 0;
pipe_mutex_init(barrier->mutex);
(void) mtx_init(&barrier->mutex, mtx_plain);
cnd_init(&barrier->condvar);
}
@ -233,7 +230,7 @@ typedef struct
static inline void
pipe_semaphore_init(pipe_semaphore *sema, int init_val)
{
pipe_mutex_init(sema->mutex);
(void) mtx_init(&sema->mutex, mtx_plain);
cnd_init(&sema->cond);
sema->counter = init_val;
}

View File

@ -1033,7 +1033,7 @@ fenced_bufmgr_create(struct pb_manager *provider,
LIST_INITHEAD(&fenced_mgr->unfenced);
fenced_mgr->num_unfenced = 0;
pipe_mutex_init(fenced_mgr->mutex);
(void) mtx_init(&fenced_mgr->mutex, mtx_plain);
return &fenced_mgr->base;
}

View File

@ -417,7 +417,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
pb_debug_buffer_fill(buf);
pipe_mutex_init(buf->mutex);
(void) mtx_init(&buf->mutex, mtx_plain);
pipe_mutex_lock(mgr->mutex);
LIST_ADDTAIL(&buf->head, &mgr->list);
@ -475,7 +475,7 @@ pb_debug_manager_create(struct pb_manager *provider,
mgr->underflow_size = underflow_size;
mgr->overflow_size = overflow_size;
pipe_mutex_init(mgr->mutex);
(void) mtx_init(&mgr->mutex, mtx_plain);
LIST_INITHEAD(&mgr->list);
return &mgr->base;

View File

@ -266,7 +266,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
mm->size = size;
mm->align2 = align2; /* 64-byte alignment */
pipe_mutex_init(mm->mutex);
(void) mtx_init(&mm->mutex, mtx_plain);
mm->buffer = buffer;

View File

@ -279,7 +279,7 @@ pool_bufmgr_create(struct pb_manager *provider,
pool->bufSize = bufSize;
pool->bufAlign = desc->alignment;
pipe_mutex_init(pool->mutex);
(void) mtx_init(&pool->mutex, mtx_plain);
pool->buffer = provider->create_buffer(provider, numBufs*bufSize, desc);
if (!pool->buffer)

View File

@ -473,7 +473,7 @@ pb_slab_manager_create(struct pb_manager *provider,
LIST_INITHEAD(&mgr->slabs);
pipe_mutex_init(mgr->mutex);
(void) mtx_init(&mgr->mutex, mtx_plain);
return &mgr->base;
}

View File

@ -280,7 +280,7 @@ pb_cache_init(struct pb_cache *mgr, uint usecs, float size_factor,
for (i = 0; i < ARRAY_SIZE(mgr->buckets); i++)
LIST_INITHEAD(&mgr->buckets[i]);
pipe_mutex_init(mgr->mutex);
(void) mtx_init(&mgr->mutex, mtx_plain);
mgr->cache_size = 0;
mgr->max_cache_size = maximum_cache_size;
mgr->usecs = usecs;

View File

@ -224,7 +224,7 @@ pb_slabs_init(struct pb_slabs *slabs,
LIST_INITHEAD(&group->slabs);
}
pipe_mutex_init(slabs->mutex);
(void) mtx_init(&slabs->mutex, mtx_plain);
return true;
}

View File

@ -116,7 +116,7 @@ debug_flush_buf_create(boolean supports_unsync, unsigned bt_depth)
fbuf->supports_unsync = supports_unsync;
fbuf->bt_depth = bt_depth;
pipe_reference_init(&fbuf->reference, 1);
pipe_mutex_init(fbuf->mutex);
(void) mtx_init(&fbuf->mutex, mtx_plain);
return fbuf;
out_no_buf:

View File

@ -89,7 +89,7 @@ debug_serial(void *p, unsigned *pserial)
static boolean first = TRUE;
if (first) {
pipe_mutex_init(serials_mutex);
(void) mtx_init(&serials_mutex, mtx_plain);
first = FALSE;
}
#endif

View File

@ -296,7 +296,7 @@ debug_symbol_name_cached(const void *addr)
static boolean first = TRUE;
if (first) {
pipe_mutex_init(symbols_mutex);
(void) mtx_init(&symbols_mutex, mtx_plain);
first = FALSE;
}
#endif

View File

@ -113,7 +113,7 @@ void
util_queue_fence_init(struct util_queue_fence *fence)
{
memset(fence, 0, sizeof(*fence));
pipe_mutex_init(fence->mutex);
(void) mtx_init(&fence->mutex, mtx_plain);
cnd_init(&fence->cond);
fence->signalled = true;
}
@ -210,7 +210,7 @@ util_queue_init(struct util_queue *queue,
if (!queue->jobs)
goto fail;
pipe_mutex_init(queue->lock);
(void) mtx_init(&queue->lock, mtx_plain);
queue->num_queued = 0;
cnd_init(&queue->has_queued_cond);

View File

@ -78,7 +78,7 @@ util_ranges_intersect(struct util_range *range, unsigned start, unsigned end)
static inline void
util_range_init(struct util_range *range)
{
pipe_mutex_init(range->write_mutex);
(void) mtx_init(&range->write_mutex, mtx_plain);
util_range_set_empty(range);
}

View File

@ -36,7 +36,7 @@ struct util_ringbuffer *util_ringbuffer_create( unsigned dwords )
ring->mask = dwords - 1;
cnd_init(&ring->change);
pipe_mutex_init(ring->mutex);
(void) mtx_init(&ring->mutex, mtx_plain);
return ring;
fail:

View File

@ -870,7 +870,7 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe)
*dctx->mapped_fence = 0;
pipe_mutex_init(dctx->mutex);
(void) mtx_init(&dctx->mutex, mtx_plain);
dctx->thread = pipe_thread_create(dd_thread_pipelined_hang_detect, dctx);
if (!dctx->thread) {
pipe_mutex_destroy(dctx->mutex);

View File

@ -705,7 +705,7 @@ fd_screen_create(struct fd_device *dev)
fd_bc_init(&screen->batch_cache);
pipe_mutex_init(screen->lock);
(void) mtx_init(&screen->lock, mtx_plain);
pscreen->destroy = fd_screen_destroy;
pscreen->get_param = fd_screen_get_param;

View File

@ -52,7 +52,7 @@ lp_fence_create(unsigned rank)
pipe_reference_init(&fence->reference, 1);
pipe_mutex_init(fence->mutex);
(void) mtx_init(&fence->mutex, mtx_plain);
cnd_init(&fence->signalled);
fence->id = fence_id++;

View File

@ -62,7 +62,7 @@ lp_scene_create( struct pipe_context *pipe )
scene->data.head =
CALLOC_STRUCT(data_block);
pipe_mutex_init(scene->mutex);
(void) mtx_init(&scene->mutex, mtx_plain);
#ifdef DEBUG
/* Do some scene limit sanity checks here */

View File

@ -668,7 +668,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
FREE(screen);
return NULL;
}
pipe_mutex_init(screen->rast_mutex);
(void) mtx_init(&screen->rast_mutex, mtx_plain);
util_format_s3tc_init();

View File

@ -1755,7 +1755,7 @@ nv50_blitter_create(struct nv50_screen *screen)
return false;
}
pipe_mutex_init(screen->blitter->mutex);
(void) mtx_init(&screen->blitter->mutex, mtx_plain);
nv50_blitter_make_vp(screen->blitter);
nv50_blitter_make_sampler(screen->blitter);

View File

@ -1664,7 +1664,7 @@ nvc0_blitter_create(struct nvc0_screen *screen)
}
screen->blitter->screen = screen;
pipe_mutex_init(screen->blitter->mutex);
(void) mtx_init(&screen->blitter->mutex, mtx_plain);
nvc0_blitter_make_vp(screen->blitter);
nvc0_blitter_make_sampler(screen->blitter);

View File

@ -751,7 +751,7 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
slab_create_parent(&r300screen->pool_transfers, sizeof(struct pipe_transfer), 64);
util_format_s3tc_init();
pipe_mutex_init(r300screen->cmask_mutex);
(void) mtx_init(&r300screen->cmask_mutex, mtx_plain);
return &r300screen->screen;
}

View File

@ -1311,8 +1311,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
}
util_format_s3tc_init();
pipe_mutex_init(rscreen->aux_context_lock);
pipe_mutex_init(rscreen->gpu_load_mutex);
(void) mtx_init(&rscreen->aux_context_lock, mtx_plain);
(void) mtx_init(&rscreen->gpu_load_mutex, mtx_plain);
if (rscreen->debug_flags & DBG_INFO) {
printf("pci_id = 0x%x\n", rscreen->info.pci_id);

View File

@ -826,7 +826,7 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
sscreen->b.has_cp_dma = true;
sscreen->b.has_streamout = true;
pipe_mutex_init(sscreen->shader_parts_mutex);
(void) mtx_init(&sscreen->shader_parts_mutex, mtx_plain);
sscreen->use_monolithic_shaders =
(sscreen->b.debug_flags & DBG_MONOLITHIC_SHADERS) != 0;

View File

@ -299,7 +299,7 @@ static void si_destroy_shader_cache_entry(struct hash_entry *entry)
bool si_init_shader_cache(struct si_screen *sscreen)
{
pipe_mutex_init(sscreen->shader_cache_mutex);
(void) mtx_init(&sscreen->shader_cache_mutex, mtx_plain);
sscreen->shader_cache =
_mesa_hash_table_create(NULL,
si_shader_cache_key_hash,
@ -1764,7 +1764,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
sel->db_shader_control |= S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
}
pipe_mutex_init(sel->mutex);
(void) mtx_init(&sel->mutex, mtx_plain);
util_queue_fence_init(&sel->ready);
if ((sctx->b.debug.debug_message && !sctx->b.debug.async) ||

View File

@ -1203,10 +1203,10 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
if (!rb_pipe)
return NULL;
pipe_mutex_init(rb_pipe->draw_mutex);
(void) mtx_init(&rb_pipe->draw_mutex, mtx_plain);
cnd_init(&rb_pipe->draw_cond);
pipe_mutex_init(rb_pipe->call_mutex);
pipe_mutex_init(rb_pipe->list_mutex);
(void) mtx_init(&rb_pipe->call_mutex, mtx_plain);
(void) mtx_init(&rb_pipe->list_mutex, mtx_plain);
make_empty_list(&rb_pipe->shaders);
rb_pipe->base.screen = _screen;

View File

@ -279,7 +279,7 @@ rbug_screen_create(struct pipe_screen *screen)
if (!rb_screen)
return screen;
pipe_mutex_init(rb_screen->list_mutex);
(void) mtx_init(&rb_screen->list_mutex, mtx_plain);
make_empty_list(&rb_screen->contexts);
make_empty_list(&rb_screen->resources);
make_empty_list(&rb_screen->surfaces);

View File

@ -1104,8 +1104,8 @@ svga_screen_create(struct svga_winsys_screen *sws)
debug_printf("svga: msaa samples mask: 0x%x\n", svgascreen->ms_samples);
}
pipe_mutex_init(svgascreen->tex_mutex);
pipe_mutex_init(svgascreen->swc_mutex);
(void) mtx_init(&svgascreen->tex_mutex, mtx_plain);
(void) mtx_init(&svgascreen->swc_mutex, mtx_plain);
svga_screen_cache_init(svgascreen);

View File

@ -408,7 +408,7 @@ svga_screen_cache_init(struct svga_screen *svgascreen)
assert(cache->total_size == 0);
pipe_mutex_init(cache->mutex);
(void) mtx_init(&cache->mutex, mtx_plain);
for (i = 0; i < SVGA_HOST_SURFACE_CACHE_BUCKETS; ++i)
LIST_INITHEAD(&cache->bucket[i]);

View File

@ -610,7 +610,7 @@ vc4_screen_create(int fd)
screen->fd = fd;
list_inithead(&screen->bo_cache.time_list);
pipe_mutex_init(screen->bo_handles_mutex);
(void) mtx_init(&screen->bo_handles_mutex, mtx_plain);
screen->bo_handles = util_hash_table_create(handle_hash, handle_compare);
screen->has_control_flow =

View File

@ -1930,7 +1930,7 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
pipe_mutex_init(screen->opencl_func_mutex);
(void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
sPriv->driverPrivate = (void *)screen;

View File

@ -242,7 +242,7 @@ xmesa_init_display( Display *display )
}
if (xmdpy->screen && xmdpy->smapi) {
pipe_mutex_init(xmdpy->mutex);
(void) mtx_init(&xmdpy->mutex, mtx_plain);
}
else {
if (xmdpy->screen) {

View File

@ -241,10 +241,10 @@ nine_queue_create(void)
}
cnd_init(&ctx->event_pop);
pipe_mutex_init(ctx->mutex_pop);
(void) mtx_init(&ctx->mutex_pop, mtx_plain);
cnd_init(&ctx->event_push);
pipe_mutex_init(ctx->mutex_push);
(void) mtx_init(&ctx->mutex_push, mtx_plain);
/* Block until first cmdbuf has been flushed. */
ctx->worker_wait = TRUE;

View File

@ -152,9 +152,9 @@ nine_csmt_create( struct NineDevice9 *This )
return NULL;
}
cnd_init(&ctx->event_processed);
pipe_mutex_init(ctx->mutex_processed);
pipe_mutex_init(ctx->thread_running);
pipe_mutex_init(ctx->thread_resume);
(void) mtx_init(&ctx->mutex_processed, mtx_plain);
(void) mtx_init(&ctx->thread_running, mtx_plain);
(void) mtx_init(&ctx->thread_resume, mtx_plain);
#if DEBUG
pipe_thread_setname("Main thread");

View File

@ -163,7 +163,7 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_BT_601, NULL, true, &drv->csc);
if (!vl_compositor_set_csc_matrix(&drv->cstate, (const vl_csc_matrix *)&drv->csc, 1.0f, 0.0f))
goto error_csc_matrix;
pipe_mutex_init(drv->mutex);
(void) mtx_init(&drv->mutex, mtx_plain);
ctx->pDriverData = (void *)drv;
ctx->version_major = 0;

View File

@ -136,7 +136,7 @@ vlVdpDecoderCreate(VdpDevice device,
goto error_handle;
}
pipe_mutex_init(vldecoder->mutex);
(void) mtx_init(&vldecoder->mutex, mtx_plain);
pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;

View File

@ -133,7 +133,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
goto no_compositor;
}
pipe_mutex_init(dev->mutex);
(void) mtx_init(&dev->mutex, mtx_plain);
*get_proc_address = &vlVdpGetProcAddress;

View File

@ -55,7 +55,7 @@ GalliumContext::GalliumContext(ulong options)
CreateScreen();
pipe_mutex_init(fMutex);
(void) mtx_init(&fMutex, mtx_plain);
}

View File

@ -591,8 +591,8 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
amdgpu_surface_init_functions(ws);
LIST_INITHEAD(&ws->global_bo_list);
pipe_mutex_init(ws->global_bo_list_lock);
pipe_mutex_init(ws->bo_fence_lock);
(void) mtx_init(&ws->global_bo_list_lock, mtx_plain);
(void) mtx_init(&ws->bo_fence_lock, mtx_plain);
if (!util_queue_init(&ws->cs_queue, "amdgpu_cs", 8, 1)) {
amdgpu_winsys_destroy(&ws->base);

View File

@ -637,7 +637,7 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
bo->va = 0;
bo->initial_domain = initial_domains;
bo->hash = __sync_fetch_and_add(&rws->next_bo_hash, 1);
pipe_mutex_init(bo->u.real.map_mutex);
(void) mtx_init(&bo->u.real.map_mutex, mtx_plain);
pb_cache_init_entry(&rws->bo_cache, &bo->u.real.cache_entry, &bo->base,
pb_cache_bucket);
@ -1076,7 +1076,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
bo->va = 0;
bo->initial_domain = RADEON_DOMAIN_GTT;
bo->hash = __sync_fetch_and_add(&ws->next_bo_hash, 1);
pipe_mutex_init(bo->u.real.map_mutex);
(void) mtx_init(&bo->u.real.map_mutex, mtx_plain);
util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
@ -1210,7 +1210,7 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
bo->rws = ws;
bo->va = 0;
bo->hash = __sync_fetch_and_add(&ws->next_bo_hash, 1);
pipe_mutex_init(bo->u.real.map_mutex);
(void) mtx_init(&bo->u.real.map_mutex, mtx_plain);
if (bo->flink_name)
util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);

View File

@ -804,15 +804,15 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
radeon_drm_cs_init_functions(ws);
radeon_surface_init_functions(ws);
pipe_mutex_init(ws->hyperz_owner_mutex);
pipe_mutex_init(ws->cmask_owner_mutex);
(void) mtx_init(&ws->hyperz_owner_mutex, mtx_plain);
(void) mtx_init(&ws->cmask_owner_mutex, mtx_plain);
ws->bo_names = util_hash_table_create(handle_hash, handle_compare);
ws->bo_handles = util_hash_table_create(handle_hash, handle_compare);
ws->bo_vas = util_hash_table_create(handle_hash, handle_compare);
pipe_mutex_init(ws->bo_handles_mutex);
pipe_mutex_init(ws->bo_va_mutex);
pipe_mutex_init(ws->bo_fence_lock);
(void) mtx_init(&ws->bo_handles_mutex, mtx_plain);
(void) mtx_init(&ws->bo_va_mutex, mtx_plain);
(void) mtx_init(&ws->bo_fence_lock, mtx_plain);
ws->va_offset = ws->va_start;
list_inithead(&ws->va_holes);

View File

@ -841,7 +841,7 @@ simple_fenced_bufmgr_create(struct pb_manager *provider,
LIST_INITHEAD(&fenced_mgr->unfenced);
fenced_mgr->num_unfenced = 0;
pipe_mutex_init(fenced_mgr->mutex);
(void) mtx_init(&fenced_mgr->mutex, mtx_plain);
return &fenced_mgr->base;
}

View File

@ -421,7 +421,7 @@ vmw_fence_ops_create(struct vmw_winsys_screen *vws)
if(!ops)
return NULL;
pipe_mutex_init(ops->mutex);
(void) mtx_init(&ops->mutex, mtx_plain);
LIST_INITHEAD(&ops->not_signaled);
ops->base.destroy = &vmw_fence_ops_destroy;
ops->base.fence_reference = &vmw_fence_ops_fence_reference;

View File

@ -156,7 +156,7 @@ vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws,
pipe_reference_init(&surface->refcnt, 1);
p_atomic_set(&surface->validated, 0);
surface->screen = vws;
pipe_mutex_init(surface->mutex);
(void) mtx_init(&surface->mutex, mtx_plain);
surface->shared = !!(usage & SVGA_SURFACE_USAGE_SHARED);
provider = (surface->shared) ? vws->pools.gmr : vws->pools.mob_fenced;

View File

@ -776,8 +776,8 @@ virgl_drm_winsys_create(int drmFD)
qdws->num_delayed = 0;
qdws->usecs = 1000000;
LIST_INITHEAD(&qdws->delayed);
pipe_mutex_init(qdws->mutex);
pipe_mutex_init(qdws->bo_handles_mutex);
(void) mtx_init(&qdws->mutex, mtx_plain);
(void) mtx_init(&qdws->bo_handles_mutex, mtx_plain);
qdws->bo_handles = util_hash_table_create(handle_hash, handle_compare);
qdws->bo_names = util_hash_table_create(handle_hash, handle_compare);
qdws->base.destroy = virgl_drm_winsys_destroy;

View File

@ -637,7 +637,7 @@ virgl_vtest_winsys_wrap(struct sw_winsys *sws)
vtws->usecs = 1000000;
LIST_INITHEAD(&vtws->delayed);
pipe_mutex_init(vtws->mutex);
(void) mtx_init(&vtws->mutex, mtx_plain);
vtws->base.destroy = virgl_vtest_winsys_destroy;