[Mesa-dev] [PATCH 3/7] gallium/util: replace pipe_mutex_init() with mtx_init()
Timothy Arceri
tarceri at itsqueeze.com
Sun Mar 5 01:32:03 UTC 2017
pipe_mutex_init() was made unnecessary with fd33a6bcd7f12.
Replace was done using:
find ./src -type f -exec sed -i -- \
's:pipe_mutex_init(\([^)]*\)):(void) mtx_init(\&\1, mtx_plain):g' {} \;
---
src/gallium/auxiliary/os/os_thread.h | 7 ++-----
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 2 +-
src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 4 ++--
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c | 2 +-
src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c | 2 +-
src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
src/gallium/auxiliary/pipebuffer/pb_cache.c | 2 +-
src/gallium/auxiliary/pipebuffer/pb_slab.c | 2 +-
src/gallium/auxiliary/util/u_debug_flush.c | 2 +-
src/gallium/auxiliary/util/u_debug_refcnt.c | 2 +-
src/gallium/auxiliary/util/u_debug_symbol.c | 2 +-
src/gallium/auxiliary/util/u_queue.c | 4 ++--
src/gallium/auxiliary/util/u_range.h | 2 +-
src/gallium/auxiliary/util/u_ringbuffer.c | 2 +-
src/gallium/drivers/ddebug/dd_context.c | 2 +-
src/gallium/drivers/freedreno/freedreno_screen.c | 2 +-
src/gallium/drivers/llvmpipe/lp_fence.c | 2 +-
src/gallium/drivers/llvmpipe/lp_scene.c | 2 +-
src/gallium/drivers/llvmpipe/lp_screen.c | 2 +-
src/gallium/drivers/nouveau/nv50/nv50_surface.c | 2 +-
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 2 +-
src/gallium/drivers/r300/r300_screen.c | 2 +-
src/gallium/drivers/radeon/r600_pipe_common.c | 4 ++--
src/gallium/drivers/radeonsi/si_pipe.c | 2 +-
src/gallium/drivers/radeonsi/si_state_shaders.c | 4 ++--
src/gallium/drivers/rbug/rbug_context.c | 6 +++---
src/gallium/drivers/rbug/rbug_screen.c | 2 +-
src/gallium/drivers/svga/svga_screen.c | 4 ++--
src/gallium/drivers/svga/svga_screen_cache.c | 2 +-
src/gallium/drivers/vc4/vc4_screen.c | 2 +-
src/gallium/state_trackers/dri/dri2.c | 2 +-
src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +-
src/gallium/state_trackers/nine/nine_queue.c | 4 ++--
src/gallium/state_trackers/nine/nine_state.c | 6 +++---
src/gallium/state_trackers/va/context.c | 2 +-
src/gallium/state_trackers/vdpau/decode.c | 2 +-
src/gallium/state_trackers/vdpau/device.c | 2 +-
src/gallium/targets/haiku-softpipe/GalliumContext.cpp | 2 +-
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 4 ++--
src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 6 +++---
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 10 +++++-----
src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c | 2 +-
src/gallium/winsys/svga/drm/vmw_fence.c | 2 +-
src/gallium/winsys/svga/drm/vmw_screen_svga.c | 2 +-
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 4 ++--
src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c | 2 +-
46 files changed, 65 insertions(+), 68 deletions(-)
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index a6a9fea..cccb531 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -101,23 +101,20 @@ static inline int pipe_thread_is_self( pipe_thread thread )
{
#if defined(HAVE_PTHREAD)
# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
(__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
return pthread_equal(pthread_self(), thread);
# endif
#endif
return 0;
}
-#define pipe_mutex_init(mutex) \
- (void) mtx_init(&(mutex), mtx_plain)
-
#define pipe_mutex_destroy(mutex) \
mtx_destroy(&(mutex))
#define pipe_mutex_lock(mutex) \
(void) mtx_lock(&(mutex))
#define pipe_mutex_unlock(mutex) \
(void) mtx_unlock(&(mutex))
#define pipe_mutex_assert_locked(mutex) \
@@ -174,21 +171,21 @@ typedef struct {
uint64_t sequence;
mtx_t mutex;
pipe_condvar condvar;
} pipe_barrier;
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);
}
static inline void pipe_barrier_destroy(pipe_barrier *barrier)
{
assert(barrier->waiters == 0);
pipe_mutex_destroy(barrier->mutex);
cnd_destroy(&barrier->condvar);
}
@@ -226,21 +223,21 @@ typedef struct
{
mtx_t mutex;
pipe_condvar cond;
int counter;
} pipe_semaphore;
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;
}
static inline void
pipe_semaphore_destroy(pipe_semaphore *sema)
{
pipe_mutex_destroy(sema->mutex);
cnd_destroy(&sema->cond);
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index f5e761b..fefdcef 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -1026,14 +1026,14 @@ fenced_bufmgr_create(struct pb_manager *provider,
fenced_mgr->ops = ops;
fenced_mgr->max_buffer_size = max_buffer_size;
fenced_mgr->max_cpu_total_size = max_cpu_total_size;
LIST_INITHEAD(&fenced_mgr->fenced);
fenced_mgr->num_fenced = 0;
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;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 26ce603..f614abf 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -410,21 +410,21 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
buf->base.vtbl = &pb_debug_buffer_vtbl;
buf->mgr = mgr;
buf->underflow_size = mgr->underflow_size;
buf->overflow_size = buf->buffer->size - buf->underflow_size - size;
debug_backtrace_capture(buf->create_backtrace, 1, PB_DEBUG_CREATE_BACKTRACE);
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);
pipe_mutex_unlock(mgr->mutex);
return &buf->base;
}
static void
@@ -468,21 +468,21 @@ pb_debug_manager_create(struct pb_manager *provider,
if (!mgr)
return NULL;
mgr->base.destroy = pb_debug_manager_destroy;
mgr->base.create_buffer = pb_debug_manager_create_buffer;
mgr->base.flush = pb_debug_manager_flush;
mgr->provider = 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;
}
#else /* !DEBUG */
struct pb_manager *
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index ef7e5ad..52cd115 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -259,21 +259,21 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
if (!mm)
return NULL;
mm->base.destroy = mm_bufmgr_destroy;
mm->base.create_buffer = mm_bufmgr_create_buffer;
mm->base.flush = mm_bufmgr_flush;
mm->size = size;
mm->align2 = align2; /* 64-byte alignment */
- pipe_mutex_init(mm->mutex);
+ (void) mtx_init(&mm->mutex, mtx_plain);
mm->buffer = buffer;
mm->map = pb_map(mm->buffer,
PB_USAGE_CPU_READ |
PB_USAGE_CPU_WRITE, NULL);
if(!mm->map)
goto failure;
mm->heap = u_mmInit(0, (int)size);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index 3bfe720..fe221fc 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -272,21 +272,21 @@ pool_bufmgr_create(struct pb_manager *provider,
pool->base.create_buffer = pool_bufmgr_create_buffer;
pool->base.flush = pool_bufmgr_flush;
LIST_INITHEAD(&pool->free);
pool->numTot = numBufs;
pool->numFree = numBufs;
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)
goto failure;
pool->map = pb_map(pool->buffer,
PB_USAGE_CPU_READ |
PB_USAGE_CPU_WRITE, NULL);
if(!pool->map)
goto failure;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index 54aba98..43313d8 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -466,21 +466,21 @@ pb_slab_manager_create(struct pb_manager *provider,
mgr->base.create_buffer = pb_slab_manager_create_buffer;
mgr->base.flush = pb_slab_manager_flush;
mgr->provider = provider;
mgr->bufSize = bufSize;
mgr->slabSize = slabSize;
mgr->desc = *desc;
LIST_INITHEAD(&mgr->slabs);
- pipe_mutex_init(mgr->mutex);
+ (void) mtx_init(&mgr->mutex, mtx_plain);
return &mgr->base;
}
static struct pb_buffer *
pb_slab_range_manager_create_buffer(struct pb_manager *_mgr,
pb_size size,
const struct pb_desc *desc)
{
diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.c b/src/gallium/auxiliary/pipebuffer/pb_cache.c
index a1ca678..422318c 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_cache.c
@@ -273,21 +273,21 @@ void
pb_cache_init(struct pb_cache *mgr, uint usecs, float size_factor,
unsigned bypass_usage, uint64_t maximum_cache_size,
void (*destroy_buffer)(struct pb_buffer *buf),
bool (*can_reclaim)(struct pb_buffer *buf))
{
unsigned i;
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;
mgr->num_buffers = 0;
mgr->bypass_usage = bypass_usage;
mgr->size_factor = size_factor;
mgr->destroy_buffer = destroy_buffer;
mgr->can_reclaim = can_reclaim;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_slab.c b/src/gallium/auxiliary/pipebuffer/pb_slab.c
index 79529df..6f6664f 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_slab.c
@@ -217,21 +217,21 @@ pb_slabs_init(struct pb_slabs *slabs,
num_groups = slabs->num_orders * slabs->num_heaps;
slabs->groups = CALLOC(num_groups, sizeof(*slabs->groups));
if (!slabs->groups)
return false;
for (i = 0; i < num_groups; ++i) {
struct pb_slab_group *group = &slabs->groups[i];
LIST_INITHEAD(&group->slabs);
}
- pipe_mutex_init(slabs->mutex);
+ (void) mtx_init(&slabs->mutex, mtx_plain);
return true;
}
/* Shutdown the slab manager.
*
* This will free all allocated slabs and internal structures, even if some
* of the slab entries are still in flight (i.e. if can_reclaim would return
* false).
*/
diff --git a/src/gallium/auxiliary/util/u_debug_flush.c b/src/gallium/auxiliary/util/u_debug_flush.c
index d125205..bcce4f4 100644
--- a/src/gallium/auxiliary/util/u_debug_flush.c
+++ b/src/gallium/auxiliary/util/u_debug_flush.c
@@ -109,21 +109,21 @@ struct debug_flush_buf *
debug_flush_buf_create(boolean supports_unsync, unsigned bt_depth)
{
struct debug_flush_buf *fbuf = CALLOC_STRUCT(debug_flush_buf);
if (!fbuf)
goto out_no_buf;
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:
debug_printf("Debug flush buffer creation failed.\n");
debug_printf("Debug flush checking for this buffer will be incomplete.\n");
return NULL;
}
void
debug_flush_buf_reference(struct debug_flush_buf **dst,
diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c
index eda95bb..754ee8b 100644
--- a/src/gallium/auxiliary/util/u_debug_refcnt.c
+++ b/src/gallium/auxiliary/util/u_debug_refcnt.c
@@ -82,21 +82,21 @@ compare_ptr(void *a, void *b)
*/
static boolean
debug_serial(void *p, unsigned *pserial)
{
unsigned serial;
boolean found = TRUE;
#ifdef PIPE_SUBSYSTEM_WINDOWS_USER
static boolean first = TRUE;
if (first) {
- pipe_mutex_init(serials_mutex);
+ (void) mtx_init(&serials_mutex, mtx_plain);
first = FALSE;
}
#endif
pipe_mutex_lock(serials_mutex);
if (!serials_hash)
serials_hash = util_hash_table_create(hash_ptr, compare_ptr);
serial = (unsigned) (uintptr_t) util_hash_table_get(serials_hash, p);
if (!serial) {
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
index cfd354a..9a4eafa 100644
--- a/src/gallium/auxiliary/util/u_debug_symbol.c
+++ b/src/gallium/auxiliary/util/u_debug_symbol.c
@@ -289,21 +289,21 @@ static int compare_ptr(void* a, void* b)
}
const char*
debug_symbol_name_cached(const void *addr)
{
const char* name;
#ifdef PIPE_SUBSYSTEM_WINDOWS_USER
static boolean first = TRUE;
if (first) {
- pipe_mutex_init(symbols_mutex);
+ (void) mtx_init(&symbols_mutex, mtx_plain);
first = FALSE;
}
#endif
pipe_mutex_lock(symbols_mutex);
if(!symbols_hash)
symbols_hash = util_hash_table_create(hash_ptr, compare_ptr);
name = util_hash_table_get(symbols_hash, (void*)addr);
if(!name)
{
diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
index ca637ad..56a9fa8 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -106,21 +106,21 @@ util_queue_fence_wait(struct util_queue_fence *fence)
pipe_mutex_lock(fence->mutex);
while (!fence->signalled)
cnd_wait(&fence->cond, &fence->mutex);
pipe_mutex_unlock(fence->mutex);
}
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;
}
void
util_queue_fence_destroy(struct util_queue_fence *fence)
{
assert(fence->signalled);
cnd_destroy(&fence->cond);
pipe_mutex_destroy(fence->mutex);
@@ -203,21 +203,21 @@ util_queue_init(struct util_queue *queue,
memset(queue, 0, sizeof(*queue));
queue->name = name;
queue->num_threads = num_threads;
queue->max_jobs = max_jobs;
queue->jobs = (struct util_queue_job*)
CALLOC(max_jobs, sizeof(struct util_queue_job));
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);
cnd_init(&queue->has_space_cond);
queue->threads = (pipe_thread*)CALLOC(num_threads, sizeof(pipe_thread));
if (!queue->threads)
goto fail;
/* start threads */
diff --git a/src/gallium/auxiliary/util/u_range.h b/src/gallium/auxiliary/util/u_range.h
index 9055d7b..24c78ba 100644
--- a/src/gallium/auxiliary/util/u_range.h
+++ b/src/gallium/auxiliary/util/u_range.h
@@ -71,21 +71,21 @@ util_ranges_intersect(struct util_range *range, unsigned start, unsigned end)
{
return MAX2(start, range->start) < MIN2(end, range->end);
}
/* Init/deinit */
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);
}
static inline void
util_range_destroy(struct util_range *range)
{
pipe_mutex_destroy(range->write_mutex);
}
#endif
diff --git a/src/gallium/auxiliary/util/u_ringbuffer.c b/src/gallium/auxiliary/util/u_ringbuffer.c
index 19f82f5..fce1133 100644
--- a/src/gallium/auxiliary/util/u_ringbuffer.c
+++ b/src/gallium/auxiliary/util/u_ringbuffer.c
@@ -29,21 +29,21 @@ struct util_ringbuffer *util_ringbuffer_create( unsigned dwords )
assert(util_is_power_of_two(dwords));
ring->buf = MALLOC( dwords * sizeof(unsigned) );
if (ring->buf == NULL)
goto fail;
ring->mask = dwords - 1;
cnd_init(&ring->change);
- pipe_mutex_init(ring->mutex);
+ (void) mtx_init(&ring->mutex, mtx_plain);
return ring;
fail:
FREE(ring->buf);
FREE(ring);
return NULL;
}
void util_ringbuffer_destroy( struct util_ringbuffer *ring )
{
diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c
index ba47b73..1ce4a3b 100644
--- a/src/gallium/drivers/ddebug/dd_context.c
+++ b/src/gallium/drivers/ddebug/dd_context.c
@@ -863,21 +863,21 @@ dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe)
dctx->mapped_fence = pipe_buffer_map(pipe, dctx->fence,
PIPE_TRANSFER_READ_WRITE |
PIPE_TRANSFER_PERSISTENT |
PIPE_TRANSFER_COHERENT,
&dctx->fence_transfer);
if (!dctx->mapped_fence)
goto fail;
*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);
goto fail;
}
}
return &dctx->base;
fail:
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index e667187..3f43b8d 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -698,21 +698,21 @@ fd_screen_create(struct fd_device *dev)
/* NOTE: don't enable reordering on a2xx, since completely untested.
* Also, don't enable if we have too old of a kernel to support
* growable cmdstream buffers, since memory requirement for cmdstream
* buffers would be too much otherwise.
*/
if ((screen->gpu_id >= 300) && (fd_device_version(dev) >= FD_VERSION_UNLIMITED_CMDS))
screen->reorder = !!(fd_mesa_debug & FD_DBG_REORDER);
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;
pscreen->get_paramf = fd_screen_get_paramf;
pscreen->get_shader_param = fd_screen_get_shader_param;
pscreen->get_compiler_options = fd_get_compiler_options;
fd_resource_screen_init(pscreen);
fd_query_screen_init(pscreen);
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 115589f..04c1483 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -45,21 +45,21 @@ struct lp_fence *
lp_fence_create(unsigned rank)
{
static int fence_id;
struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
if (!fence)
return NULL;
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++;
fence->rank = rank;
if (LP_DEBUG & DEBUG_FENCE)
debug_printf("%s %d\n", __FUNCTION__, fence->id);
return fence;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 223be93..0d619ef 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -55,21 +55,21 @@ lp_scene_create( struct pipe_context *pipe )
{
struct lp_scene *scene = CALLOC_STRUCT(lp_scene);
if (!scene)
return NULL;
scene->pipe = 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 */
{
size_t maxBins = TILES_X * TILES_Y;
size_t maxCommandBytes = sizeof(struct cmd_block) * maxBins;
size_t maxCommandPlusData = maxCommandBytes + DATA_BLOCK_SIZE;
/* We'll need at least one command block per bin. Make sure that's
* less than the max allowed scene size.
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 1c94b6e..f5f7e71 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -661,16 +661,16 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
#endif
screen->num_threads = debug_get_num_option("LP_NUM_THREADS", screen->num_threads);
screen->num_threads = MIN2(screen->num_threads, LP_MAX_THREADS);
screen->rast = lp_rast_create(screen->num_threads);
if (!screen->rast) {
lp_jit_screen_cleanup(screen);
FREE(screen);
return NULL;
}
- pipe_mutex_init(screen->rast_mutex);
+ (void) mtx_init(&screen->rast_mutex, mtx_plain);
util_format_s3tc_init();
return &screen->base;
}
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
index 01bf14b..5635e9f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
@@ -1748,21 +1748,21 @@ nv50_flush_resource(struct pipe_context *ctx,
bool
nv50_blitter_create(struct nv50_screen *screen)
{
screen->blitter = CALLOC_STRUCT(nv50_blitter);
if (!screen->blitter) {
NOUVEAU_ERR("failed to allocate blitter struct\n");
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);
return true;
}
void
nv50_blitter_destroy(struct nv50_screen *screen)
{
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
index 96b2b5f..5720937 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
@@ -1657,21 +1657,21 @@ nvc0_flush_resource(struct pipe_context *ctx,
bool
nvc0_blitter_create(struct nvc0_screen *screen)
{
screen->blitter = CALLOC_STRUCT(nvc0_blitter);
if (!screen->blitter) {
NOUVEAU_ERR("failed to allocate blitter struct\n");
return false;
}
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);
return true;
}
void
nvc0_blitter_destroy(struct nvc0_screen *screen)
{
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 903502d..392b0bb 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -744,14 +744,14 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
r300screen->screen.is_video_format_supported = vl_video_buffer_is_format_supported;
r300screen->screen.context_create = r300_create_context;
r300screen->screen.fence_reference = r300_fence_reference;
r300screen->screen.fence_finish = r300_fence_finish;
r300_init_screen_resource_functions(r300screen);
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;
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 5a6f960..2fae5ed 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -1304,22 +1304,22 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
slab_create_parent(&rscreen->pool_transfers, sizeof(struct r600_transfer), 64);
rscreen->force_aniso = MIN2(16, debug_get_num_option("R600_TEX_ANISO", -1));
if (rscreen->force_aniso >= 0) {
printf("radeon: Forcing anisotropy filter to %ix\n",
/* round down to a power of two */
1 << util_logbase2(rscreen->force_aniso));
}
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);
printf("family = %i (%s)\n", rscreen->info.family,
r600_get_chip_name(rscreen));
printf("chip_class = %i\n", rscreen->info.chip_class);
printf("gart_size = %i MB\n", (int)DIV_ROUND_UP(rscreen->info.gart_size, 1024*1024));
printf("vram_size = %i MB\n", (int)DIV_ROUND_UP(rscreen->info.vram_size, 1024*1024));
printf("vram_vis_size = %i MB\n", (int)DIV_ROUND_UP(rscreen->info.vram_vis_size, 1024*1024));
printf("max_alloc_size = %i MB\n",
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index a0e90a8..5494b11 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -827,21 +827,21 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws)
sscreen->b.info.me_fw_version >= 173) ||
(sscreen->b.chip_class == SI &&
sscreen->b.info.pfp_fw_version >= 121 &&
sscreen->b.info.me_fw_version >= 87);
sscreen->has_ds_bpermute = HAVE_LLVM >= 0x0309 &&
sscreen->b.chip_class >= VI;
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 =
HAVE_LLVM < 0x0308 ||
(sscreen->b.debug_flags & DBG_MONOLITHIC_SHADERS) != 0;
sscreen->b.barrier_flags.cp_to_L2 = SI_CONTEXT_INV_SMEM_L1 |
SI_CONTEXT_INV_VMEM_L1 |
SI_CONTEXT_INV_GLOBAL_L2;
sscreen->b.barrier_flags.compute_to_L2 = SI_CONTEXT_CS_PARTIAL_FLUSH;
if (debug_get_bool_option("RADEON_DUMP_SHADERS", false))
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index a82e38e..20410ce 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -292,21 +292,21 @@ static bool si_shader_cache_key_equals(const void *a, const void *b)
}
static void si_destroy_shader_cache_entry(struct hash_entry *entry)
{
FREE((void*)entry->key);
FREE(entry->data);
}
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,
si_shader_cache_key_equals);
return sscreen->shader_cache != NULL;
}
void si_destroy_shader_cache(struct si_screen *sscreen)
{
@@ -1757,21 +1757,21 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
S_02880C_EXEC_ON_NOOP(sel->info.writes_memory);
} else if (sel->info.writes_memory) {
/* Case 2. */
sel->db_shader_control |= S_02880C_Z_ORDER(V_02880C_LATE_Z) |
S_02880C_EXEC_ON_HIER_FAIL(1);
} else {
/* Case 1. */
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) ||
sctx->is_debug ||
r600_can_dump_shader(&sscreen->b, sel->info.processor) ||
!util_queue_is_initialized(&sscreen->shader_compiler_queue))
si_init_shader_selector_async(sel, -1);
else
util_queue_add_job(&sscreen->shader_compiler_queue, sel,
&sel->ready, si_init_shader_selector_async,
diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
index e34278e..4723c49 100644
--- a/src/gallium/drivers/rbug/rbug_context.c
+++ b/src/gallium/drivers/rbug/rbug_context.c
@@ -1196,24 +1196,24 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
struct rbug_context *rb_pipe;
struct rbug_screen *rb_screen = rbug_screen(_screen);
if (!rb_screen)
return NULL;
rb_pipe = CALLOC_STRUCT(rbug_context);
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;
rb_pipe->base.priv = pipe->priv; /* expose wrapped data */
rb_pipe->base.draw = NULL;
rb_pipe->base.stream_uploader = pipe->stream_uploader;
rb_pipe->base.const_uploader = pipe->const_uploader;
rb_pipe->base.destroy = rbug_destroy;
rb_pipe->base.draw_vbo = rbug_draw_vbo;
diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
index 3ed9090..7505dd7 100644
--- a/src/gallium/drivers/rbug/rbug_screen.c
+++ b/src/gallium/drivers/rbug/rbug_screen.c
@@ -272,21 +272,21 @@ rbug_screen_create(struct pipe_screen *screen)
{
struct rbug_screen *rb_screen;
if (!debug_get_option_rbug())
return screen;
rb_screen = CALLOC_STRUCT(rbug_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);
make_empty_list(&rb_screen->transfers);
#define SCR_INIT(_member) \
rb_screen->base._member = screen->_member ? rbug_screen_##_member : NULL
rb_screen->base.destroy = rbug_screen_destroy;
rb_screen->base.get_name = rbug_screen_get_name;
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 90f8e2b..479b6fc 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -1097,22 +1097,22 @@ svga_screen_create(struct svga_winsys_screen *sws)
debug_printf("svga: haveProvokingVertex %u\n",
svgascreen->haveProvokingVertex);
debug_printf("svga: haveLineStip %u "
"haveLineSmooth %u maxLineWidth %f\n",
svgascreen->haveLineStipple, svgascreen->haveLineSmooth,
svgascreen->maxLineWidth);
debug_printf("svga: maxPointSize %g\n", svgascreen->maxPointSize);
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);
return screen;
error2:
FREE(svgascreen);
error1:
return NULL;
}
diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c
index 27c3fbc..514fc00 100644
--- a/src/gallium/drivers/svga/svga_screen_cache.c
+++ b/src/gallium/drivers/svga/svga_screen_cache.c
@@ -401,21 +401,21 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen)
enum pipe_error
svga_screen_cache_init(struct svga_screen *svgascreen)
{
struct svga_host_surface_cache *cache = &svgascreen->cache;
unsigned i;
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]);
LIST_INITHEAD(&cache->unused);
LIST_INITHEAD(&cache->validated);
LIST_INITHEAD(&cache->invalidated);
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 31ab0db..2a12ef8 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -603,21 +603,21 @@ vc4_screen_create(int fd)
pscreen->destroy = vc4_screen_destroy;
pscreen->get_param = vc4_screen_get_param;
pscreen->get_paramf = vc4_screen_get_paramf;
pscreen->get_shader_param = vc4_screen_get_shader_param;
pscreen->context_create = vc4_context_create;
pscreen->is_format_supported = vc4_screen_is_format_supported;
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 =
vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_BRANCHES);
screen->has_etc1 =
vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_ETC1);
screen->has_threaded_fs =
vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_THREADED_FS);
if (!vc4_get_chip_info(screen))
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index c4f2c57..1ad15b5 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1923,21 +1923,21 @@ dri2_init_screen(__DRIscreen * sPriv)
const struct drm_conf_ret *throttle_ret;
const struct drm_conf_ret *dmabuf_ret;
int fd;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
return NULL;
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;
if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
goto free_screen;
if (pipe_loader_drm_probe_fd(&screen->dev, fd))
pscreen = pipe_loader_create_screen(screen->dev);
if (!pscreen)
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 9297b68..92d2cec 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -235,21 +235,21 @@ xmesa_init_display( Display *display )
xmdpy->display = display;
xmdpy->screen = driver.create_pipe_screen(display);
xmdpy->smapi = CALLOC_STRUCT(st_manager);
xmdpy->pipe = NULL;
if (xmdpy->smapi) {
xmdpy->smapi->screen = xmdpy->screen;
xmdpy->smapi->get_param = xmesa_get_param;
}
if (xmdpy->screen && xmdpy->smapi) {
- pipe_mutex_init(xmdpy->mutex);
+ (void) mtx_init(&xmdpy->mutex, mtx_plain);
}
else {
if (xmdpy->screen) {
xmdpy->screen->destroy(xmdpy->screen);
xmdpy->screen = NULL;
}
free(xmdpy->smapi);
xmdpy->smapi = NULL;
xmdpy->display = NULL;
diff --git a/src/gallium/state_trackers/nine/nine_queue.c b/src/gallium/state_trackers/nine/nine_queue.c
index 4724b6b..30b0e30 100644
--- a/src/gallium/state_trackers/nine/nine_queue.c
+++ b/src/gallium/state_trackers/nine/nine_queue.c
@@ -234,24 +234,24 @@ nine_queue_create(void)
if (!ctx)
goto failed;
for (i = 0; i < NINE_CMD_BUFS; i++) {
ctx->pool[i].mem_pool = MALLOC(NINE_QUEUE_SIZE);
if (!ctx->pool[i].mem_pool)
goto failed;
}
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;
return ctx;
failed:
if (ctx) {
for (i = 0; i < NINE_CMD_BUFS; i++) {
if (ctx->pool[i].mem_pool)
FREE(ctx->pool[i].mem_pool);
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 231e422..a331f7c 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -145,23 +145,23 @@ nine_csmt_create( struct NineDevice9 *This )
ctx = CALLOC_STRUCT(csmt_context);
if (!ctx)
return NULL;
ctx->pool = nine_queue_create();
if (!ctx->pool) {
FREE(ctx);
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");
#endif
ctx->device = This;
ctx->worker = pipe_thread_create(nine_csmt_worker, ctx);
if (!ctx->worker) {
nine_queue_delete(ctx->pool);
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index d749e65..84bb805 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -156,21 +156,21 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
goto error_htab;
if (!vl_compositor_init(&drv->compositor, drv->pipe))
goto error_compositor;
if (!vl_compositor_init_state(&drv->cstate, drv->pipe))
goto error_compositor_state;
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;
ctx->version_minor = 1;
*ctx->vtable = vtable;
*ctx->vtable_vpp = vtable_vpp;
ctx->max_profiles = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH - PIPE_VIDEO_PROFILE_UNKNOWN;
ctx->max_entrypoints = 1;
ctx->max_attributes = 1;
ctx->max_image_formats = VL_VA_MAX_IMAGE_FORMATS;
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index f85bce8..628e503 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -129,21 +129,21 @@ vlVdpDecoderCreate(VdpDevice device,
ret = VDP_STATUS_ERROR;
goto error_decoder;
}
*decoder = vlAddDataHTAB(vldecoder);
if (*decoder == 0) {
ret = VDP_STATUS_ERROR;
goto error_handle;
}
- pipe_mutex_init(vldecoder->mutex);
+ (void) mtx_init(&vldecoder->mutex, mtx_plain);
pipe_mutex_unlock(dev->mutex);
return VDP_STATUS_OK;
error_handle:
vldecoder->decoder->destroy(vldecoder->decoder);
error_decoder:
pipe_mutex_unlock(dev->mutex);
DeviceReference(&vldecoder->device, NULL);
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index 4f4ffdf..15652f0 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -126,21 +126,21 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
if (*device == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
}
if (!vl_compositor_init(&dev->compositor, dev->context)) {
ret = VDP_STATUS_ERROR;
goto no_compositor;
}
- pipe_mutex_init(dev->mutex);
+ (void) mtx_init(&dev->mutex, mtx_plain);
*get_proc_address = &vlVdpGetProcAddress;
return VDP_STATUS_OK;
no_compositor:
vlRemoveDataHTAB(*device);
no_handle:
pipe_sampler_view_reference(&dev->dummy_sv, NULL);
no_resource:
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index 1e3874b..df222f6 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -48,21 +48,21 @@ GalliumContext::GalliumContext(ulong options)
fCurrentContext(0)
{
CALLED();
// Make all contexts a known value
for (context_id i = 0; i < CONTEXT_MAX; i++)
fContext[i] = NULL;
CreateScreen();
- pipe_mutex_init(fMutex);
+ (void) mtx_init(&fMutex, mtx_plain);
}
GalliumContext::~GalliumContext()
{
CALLED();
// Destroy our contexts
Lock();
for (context_id i = 0; i < CONTEXT_MAX; i++)
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 546e3e6..1af8e5d 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -592,22 +592,22 @@ amdgpu_winsys_create(int fd, radeon_screen_create_t screen_create)
ws->base.query_info = amdgpu_winsys_query_info;
ws->base.cs_request_feature = amdgpu_cs_request_feature;
ws->base.query_value = amdgpu_query_value;
ws->base.read_registers = amdgpu_read_registers;
amdgpu_bo_init_functions(ws);
amdgpu_cs_init_functions(ws);
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);
pipe_mutex_unlock(dev_tab_mutex);
return NULL;
}
/* Create the screen at the end. The winsys must be initialized
* completely.
*
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 2524339..e54dcac 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -630,21 +630,21 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
pipe_reference_init(&bo->base.reference, 1);
bo->base.alignment = alignment;
bo->base.usage = usage;
bo->base.size = size;
bo->base.vtbl = &radeon_bo_vtbl;
bo->rws = rws;
bo->handle = args.handle;
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);
if (rws->info.has_virtual_memory) {
struct drm_radeon_gem_va va;
unsigned va_gap_size;
va_gap_size = rws->check_vm ? MAX2(4 * alignment, 64 * 1024) : 0;
bo->va = radeon_bomgr_find_va(rws, size + va_gap_size, alignment);
@@ -1069,21 +1069,21 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
pipe_reference_init(&bo->base.reference, 1);
bo->handle = args.handle;
bo->base.alignment = 0;
bo->base.size = size;
bo->base.vtbl = &radeon_bo_vtbl;
bo->rws = ws;
bo->user_ptr = pointer;
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);
pipe_mutex_unlock(ws->bo_handles_mutex);
if (ws->info.has_virtual_memory) {
struct drm_radeon_gem_va va;
bo->va = radeon_bomgr_find_va(ws, bo->base.size, 1 << 20);
@@ -1203,21 +1203,21 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
bo->handle = handle;
/* Initialize it. */
pipe_reference_init(&bo->base.reference, 1);
bo->base.alignment = 0;
bo->base.size = (unsigned) size;
bo->base.vtbl = &radeon_bo_vtbl;
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);
util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
done:
pipe_mutex_unlock(ws->bo_handles_mutex);
if (stride)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 2726237..abab4aa 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -797,29 +797,29 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
ws->base.destroy = radeon_winsys_destroy;
ws->base.query_info = radeon_query_info;
ws->base.cs_request_feature = radeon_cs_request_feature;
ws->base.query_value = radeon_query_value;
ws->base.read_registers = radeon_read_registers;
radeon_drm_bo_init_functions(ws);
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);
/* TTM aligns the BO size to the CPU page size */
ws->info.gart_page_size = sysconf(_SC_PAGESIZE);
if (ws->num_cpus > 1 && debug_get_option_thread())
util_queue_init(&ws->cs_queue, "radeon_cs", 8, 1);
/* Create the screen at the end. The winsys must be initialized
diff --git a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
index 4c5a121..0553662 100644
--- a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
+++ b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c
@@ -834,14 +834,14 @@ simple_fenced_bufmgr_create(struct pb_manager *provider,
fenced_mgr->provider = provider;
fenced_mgr->ops = ops;
LIST_INITHEAD(&fenced_mgr->fenced);
fenced_mgr->num_fenced = 0;
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;
}
diff --git a/src/gallium/winsys/svga/drm/vmw_fence.c b/src/gallium/winsys/svga/drm/vmw_fence.c
index 0fbb078..b18d5bf 100644
--- a/src/gallium/winsys/svga/drm/vmw_fence.c
+++ b/src/gallium/winsys/svga/drm/vmw_fence.c
@@ -414,21 +414,21 @@ vmw_fence_ops_destroy(struct pb_fence_ops *ops)
*/
struct pb_fence_ops *
vmw_fence_ops_create(struct vmw_winsys_screen *vws)
{
struct vmw_fence_ops *ops;
ops = CALLOC_STRUCT(vmw_fence_ops);
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;
ops->base.fence_signalled = &vmw_fence_ops_fence_signalled;
ops->base.fence_finish = &vmw_fence_ops_fence_finish;
ops->vws = vws;
return &ops->base;
}
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 3a936e7..17a1e76 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -149,21 +149,21 @@ vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws,
uint32_t buffer_size;
memset(&desc, 0, sizeof(desc));
surface = CALLOC_STRUCT(vmw_svga_winsys_surface);
if(!surface)
goto no_surface;
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;
/*
* Used for the backing buffer GB surfaces, and to approximate
* when to flush on non-GB hosts.
*/
buffer_size = svga3dsurface_get_serialized_size(format, size, numMipLevels,
numLayers);
if (flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 7353873..b6a4234 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -769,22 +769,22 @@ virgl_drm_winsys_create(int drmFD)
struct virgl_drm_winsys *qdws;
qdws = CALLOC_STRUCT(virgl_drm_winsys);
if (!qdws)
return NULL;
qdws->fd = 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;
qdws->base.transfer_put = virgl_bo_transfer_put;
qdws->base.transfer_get = virgl_bo_transfer_get;
qdws->base.resource_create = virgl_drm_winsys_resource_cache_create;
qdws->base.resource_unref = virgl_drm_winsys_resource_unref;
qdws->base.resource_create_from_handle = virgl_drm_winsys_resource_create_handle;
qdws->base.resource_get_handle = virgl_drm_winsys_resource_get_handle;
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index ce8ac97..a8c874a 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -630,21 +630,21 @@ virgl_vtest_winsys_wrap(struct sw_winsys *sws)
vtws = CALLOC_STRUCT(virgl_vtest_winsys);
if (!vtws)
return NULL;
virgl_vtest_connect(vtws);
vtws->sws = 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;
vtws->base.transfer_put = virgl_vtest_transfer_put;
vtws->base.transfer_get = virgl_vtest_transfer_get;
vtws->base.resource_create = virgl_vtest_winsys_resource_cache_create;
vtws->base.resource_unref = virgl_vtest_winsys_resource_unref;
vtws->base.resource_map = virgl_vtest_resource_map;
vtws->base.resource_wait = virgl_vtest_resource_wait;
--
2.9.3
More information about the mesa-dev
mailing list