[Mesa-dev] [PATCH 5/5] gallium/util: replace pipe_condvar_broadcast() with cnd_broadcast()
Timothy Arceri
tarceri at itsqueeze.com
Sat Mar 4 23:41:33 UTC 2017
pipe_condvar_broadcast() was made unnecessary with fd33a6bcd7f12.
---
src/gallium/auxiliary/os/os_thread.h | 5 +----
src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 2 +-
src/gallium/auxiliary/util/u_queue.c | 4 ++--
src/gallium/drivers/llvmpipe/lp_fence.c | 2 +-
src/gallium/drivers/rbug/rbug_core.c | 6 +++---
5 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index a8b5d92..6eca2ca 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -141,23 +141,20 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
assert(ret == thrd_busy);
if (ret == thrd_success)
mtx_unlock(mutex);
#endif
}
/* pipe_condvar
*/
typedef cnd_t pipe_condvar;
-#define pipe_condvar_broadcast(cond) \
- cnd_broadcast(&(cond))
-
/*
* pipe_barrier
*/
#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HURD)) && !defined(PIPE_OS_ANDROID)
typedef pthread_barrier_t pipe_barrier;
static inline void pipe_barrier_init(pipe_barrier *barrier, unsigned count)
@@ -211,21 +208,21 @@ static inline void pipe_barrier_wait(pipe_barrier *barrier)
if (barrier->waiters < barrier->count) {
uint64_t sequence = barrier->sequence;
do {
cnd_wait(&barrier->condvar, &barrier->mutex);
} while (sequence == barrier->sequence);
} else {
barrier->waiters = 0;
barrier->sequence++;
- pipe_condvar_broadcast(barrier->condvar);
+ cnd_broadcast(&barrier->condvar);
}
pipe_mutex_unlock(barrier->mutex);
}
#endif
/*
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index 541a6d9..cc42eea 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -239,21 +239,21 @@ pb_slab_buffer_map(struct pb_buffer *_buf,
}
static void
pb_slab_buffer_unmap(struct pb_buffer *_buf)
{
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
--buf->mapCount;
if (buf->mapCount == 0)
- pipe_condvar_broadcast(buf->event);
+ cnd_broadcast(&buf->event);
}
static enum pipe_error
pb_slab_buffer_validate(struct pb_buffer *_buf,
struct pb_validate *vl,
unsigned flags)
{
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
return pb_validate(buf->slab->bo, vl, flags);
diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
index 3cef7d2..c84e0ad 100644
--- a/src/gallium/auxiliary/util/u_queue.c
+++ b/src/gallium/auxiliary/util/u_queue.c
@@ -89,21 +89,21 @@ remove_from_atexit_list(struct util_queue *queue)
/****************************************************************************
* util_queue_fence
*/
static void
util_queue_fence_signal(struct util_queue_fence *fence)
{
pipe_mutex_lock(fence->mutex);
fence->signalled = true;
- pipe_condvar_broadcast(fence->cond);
+ cnd_broadcast(&fence->cond);
pipe_mutex_unlock(fence->mutex);
}
void
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);
@@ -260,21 +260,21 @@ fail:
}
static void
util_queue_killall_and_wait(struct util_queue *queue)
{
unsigned i;
/* Signal all threads to terminate. */
pipe_mutex_lock(queue->lock);
queue->kill_threads = 1;
- pipe_condvar_broadcast(queue->has_queued_cond);
+ cnd_broadcast(&queue->has_queued_cond);
pipe_mutex_unlock(queue->lock);
for (i = 0; i < queue->num_threads; i++)
pipe_thread_wait(queue->threads[i]);
queue->num_threads = 0;
}
void
util_queue_destroy(struct util_queue *queue)
{
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 1a8e365..115589f 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -92,21 +92,21 @@ lp_fence_signal(struct lp_fence *fence)
fence->count++;
assert(fence->count <= fence->rank);
if (LP_DEBUG & DEBUG_FENCE)
debug_printf("%s count=%u rank=%u\n", __FUNCTION__,
fence->count, fence->rank);
/* Wakeup all threads waiting on the mutex:
*/
- pipe_condvar_broadcast(fence->signalled);
+ cnd_broadcast(&fence->signalled);
pipe_mutex_unlock(fence->mutex);
}
boolean
lp_fence_signalled(struct lp_fence *f)
{
return f->count == f->rank;
}
diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c
index dedbc14..3bb781b 100644
--- a/src/gallium/drivers/rbug/rbug_core.c
+++ b/src/gallium/drivers/rbug/rbug_core.c
@@ -402,21 +402,21 @@ rbug_context_draw_step(struct rbug_rbug *tr_rbug, struct rbug_header *header, ui
pipe_mutex_lock(rb_context->draw_mutex);
if (rb_context->draw_blocked & RBUG_BLOCK_RULE) {
if (step->step & RBUG_BLOCK_RULE)
rb_context->draw_blocked &= ~RBUG_BLOCK_MASK;
} else {
rb_context->draw_blocked &= ~step->step;
}
pipe_mutex_unlock(rb_context->draw_mutex);
- pipe_condvar_broadcast(rb_context->draw_cond);
+ cnd_broadcast(&rb_context->draw_cond);
pipe_mutex_unlock(rb_screen->list_mutex);
return 0;
}
static int
rbug_context_draw_unblock(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct rbug_proto_context_draw_unblock *unblock = (struct rbug_proto_context_draw_unblock *)header;
@@ -435,21 +435,21 @@ rbug_context_draw_unblock(struct rbug_rbug *tr_rbug, struct rbug_header *header,
pipe_mutex_lock(rb_context->draw_mutex);
if (rb_context->draw_blocked & RBUG_BLOCK_RULE) {
if (unblock->unblock & RBUG_BLOCK_RULE)
rb_context->draw_blocked &= ~RBUG_BLOCK_MASK;
} else {
rb_context->draw_blocked &= ~unblock->unblock;
}
rb_context->draw_blocker &= ~unblock->unblock;
pipe_mutex_unlock(rb_context->draw_mutex);
- pipe_condvar_broadcast(rb_context->draw_cond);
+ cnd_broadcast(&rb_context->draw_cond);
pipe_mutex_unlock(rb_screen->list_mutex);
return 0;
}
static int
rbug_context_draw_rule(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct rbug_proto_context_draw_rule *rule = (struct rbug_proto_context_draw_rule *)header;
@@ -467,21 +467,21 @@ rbug_context_draw_rule(struct rbug_rbug *tr_rbug, struct rbug_header *header, ui
pipe_mutex_lock(rb_context->draw_mutex);
rb_context->draw_rule.shader[PIPE_SHADER_VERTEX] = U642VOID(rule->vertex);
rb_context->draw_rule.shader[PIPE_SHADER_FRAGMENT] = U642VOID(rule->fragment);
rb_context->draw_rule.texture = U642VOID(rule->texture);
rb_context->draw_rule.surf = U642VOID(rule->surface);
rb_context->draw_rule.blocker = rule->block;
rb_context->draw_blocker |= RBUG_BLOCK_RULE;
pipe_mutex_unlock(rb_context->draw_mutex);
- pipe_condvar_broadcast(rb_context->draw_cond);
+ cnd_broadcast(&rb_context->draw_cond);
pipe_mutex_unlock(rb_screen->list_mutex);
return 0;
}
static int
rbug_context_flush(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
{
struct rbug_proto_context_flush *flush = (struct rbug_proto_context_flush *)header;
--
2.9.3
More information about the mesa-dev
mailing list