gallium/util: replace pipe_condvar_wait() with cnd_wait()
authorTimothy Arceri <tarceri@itsqueeze.com>
Sat, 4 Mar 2017 23:41:31 +0000 (10:41 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 6 Mar 2017 21:23:26 +0000 (08:23 +1100)
pipe_condvar_wait() was made unnecessary with fd33a6bcd7f12.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/os/os_thread.h
src/gallium/auxiliary/util/u_queue.c
src/gallium/auxiliary/util/u_ringbuffer.c
src/gallium/drivers/llvmpipe/lp_fence.c
src/gallium/drivers/rbug/rbug_context.c
src/gallium/state_trackers/nine/nine_queue.c
src/gallium/state_trackers/nine/nine_state.c

index e230d06149e33923059eed4004f76366968caecf..6895f4e97f4c4be53462be5f255ca6663f83d7a2 100644 (file)
@@ -148,9 +148,6 @@ __pipe_mutex_assert_locked(pipe_mutex *mutex)
  */
 typedef cnd_t pipe_condvar;
 
-#define pipe_condvar_wait(cond, mutex) \
-   cnd_wait(&(cond), &(mutex))
-
 #define pipe_condvar_signal(cond) \
    cnd_signal(&(cond))
 
@@ -219,7 +216,7 @@ static inline void pipe_barrier_wait(pipe_barrier *barrier)
       uint64_t sequence = barrier->sequence;
 
       do {
-         pipe_condvar_wait(barrier->condvar, barrier->mutex);
+         cnd_wait(&barrier->condvar, &barrier->mutex);
       } while (sequence == barrier->sequence);
    } else {
       barrier->waiters = 0;
@@ -277,7 +274,7 @@ pipe_semaphore_wait(pipe_semaphore *sema)
 {
    pipe_mutex_lock(sema->mutex);
    while (sema->counter <= 0) {
-      pipe_condvar_wait(sema->cond, sema->mutex);
+      cnd_wait(&sema->cond, &sema->mutex);
    }
    sema->counter--;
    pipe_mutex_unlock(sema->mutex);
index 87f0120d8883004199949fd3087b06f27cae996a..8fc2f3b3bb230d3044a2967e65c1e2c21f009ff8 100644 (file)
@@ -105,7 +105,7 @@ util_queue_fence_wait(struct util_queue_fence *fence)
 {
    pipe_mutex_lock(fence->mutex);
    while (!fence->signalled)
-      pipe_condvar_wait(fence->cond, fence->mutex);
+      cnd_wait(&fence->cond, &fence->mutex);
    pipe_mutex_unlock(fence->mutex);
 }
 
@@ -156,7 +156,7 @@ static PIPE_THREAD_ROUTINE(util_queue_thread_func, input)
 
       /* wait if the queue is empty */
       while (!queue->kill_threads && queue->num_queued == 0)
-         pipe_condvar_wait(queue->has_queued_cond, queue->lock);
+         cnd_wait(&queue->has_queued_cond, &queue->lock);
 
       if (queue->kill_threads) {
          pipe_mutex_unlock(queue->lock);
@@ -305,7 +305,7 @@ util_queue_add_job(struct util_queue *queue,
 
    /* if the queue is full, wait until there is space */
    while (queue->num_queued == queue->max_jobs)
-      pipe_condvar_wait(queue->has_space_cond, queue->lock);
+      cnd_wait(&queue->has_space_cond, &queue->lock);
 
    ptr = &queue->jobs[queue->write_idx];
    assert(ptr->job == NULL);
index 334be6a1d4706df701a1b9111e488b96573db881..adba9ead773021a18a8c89f9843d84b120979502 100644 (file)
@@ -85,7 +85,7 @@ void util_ringbuffer_enqueue( struct util_ringbuffer *ring,
    /* Wait for free space:
     */
    while (util_ringbuffer_space(ring) < packet->dwords)
-      pipe_condvar_wait(ring->change, ring->mutex);
+      cnd_wait(&ring->change, &ring->mutex);
 
    /* Copy data to ring:
     */
@@ -123,7 +123,7 @@ enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring,
     */
    if (wait) {
       while (util_ringbuffer_empty(ring))
-         pipe_condvar_wait(ring->change, ring->mutex);
+         cnd_wait(&ring->change, &ring->mutex);
    }
    else {
       if (util_ringbuffer_empty(ring)) {
index 3b35eb2e9f249e6cf343f2910da669b44bdf00e3..1a8e365f004573473b3bb22a5f7d479d90e245a8 100644 (file)
@@ -119,7 +119,7 @@ lp_fence_wait(struct lp_fence *f)
    pipe_mutex_lock(f->mutex);
    assert(f->issued);
    while (f->count < f->rank) {
-      pipe_condvar_wait(f->signalled, f->mutex);
+      cnd_wait(&f->signalled, &f->mutex);
    }
    pipe_mutex_unlock(f->mutex);
 }
index 9634f88d5f431271250bce6b38cee121313ba36e..e34278e64ff37d66d24e236c0a53674a1784ac86 100644 (file)
@@ -108,7 +108,7 @@ rbug_draw_block_locked(struct rbug_context *rb_pipe, int flag)
    /* wait for rbug to clear the blocked flag */
    while (rb_pipe->draw_blocked & flag) {
       rb_pipe->draw_blocked |= flag;
-      pipe_condvar_wait(rb_pipe->draw_cond, rb_pipe->draw_mutex);
+      cnd_wait(&rb_pipe->draw_cond, &rb_pipe->draw_mutex);
    }
 
 }
index 004d5816b848578b5419cb02920e8281ce792448..fdfbdbb2472940407734dcdbb60a59ae4d4e8293 100644 (file)
@@ -89,7 +89,7 @@ nine_queue_wait_flush(struct nine_queue_pool* ctx)
     while (!cmdbuf->full)
     {
         DBG("waiting for full cmdbuf\n");
-        pipe_condvar_wait(ctx->event_push, ctx->mutex_push);
+        cnd_wait(&ctx->event_push, &ctx->mutex_push);
     }
     DBG("got cmdbuf=%p\n", cmdbuf);
     pipe_mutex_unlock(ctx->mutex_push);
@@ -162,7 +162,7 @@ nine_queue_flush(struct nine_queue_pool* ctx)
     while (cmdbuf->full)
     {
         DBG("waiting for empty cmdbuf\n");
-        pipe_condvar_wait(ctx->event_pop, ctx->mutex_pop);
+        cnd_wait(&ctx->event_pop, &ctx->mutex_pop);
     }
     DBG("got empty cmdbuf=%p\n", cmdbuf);
     pipe_mutex_unlock(ctx->mutex_pop);
index e1a2ff0cf979d8d6888140b04a9cf6b575ff21c6..0a2a0b9c792d2a08a588d47ff46befb2da07a1dc 100644 (file)
@@ -81,7 +81,7 @@ nine_csmt_wait_processed(struct csmt_context *ctx)
 {
     pipe_mutex_lock(ctx->mutex_processed);
     while (!p_atomic_read(&ctx->processed)) {
-        pipe_condvar_wait(ctx->event_processed, ctx->mutex_processed);
+        cnd_wait(&ctx->event_processed, &ctx->mutex_processed);
     }
     pipe_mutex_unlock(ctx->mutex_processed);
 }