Mesa (lp-binning): llvmpipe: rename queue size to count

Keith Whitwell keithw at kemper.freedesktop.org
Sun Dec 13 10:20:54 PST 2009


Module: Mesa
Branch: lp-binning
Commit: 39dd7108bf6014a8430dffc290e98c7b47432cd3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=39dd7108bf6014a8430dffc290e98c7b47432cd3

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sat Dec 12 20:29:39 2009 +0000

llvmpipe: rename queue size to count

---

 src/gallium/drivers/llvmpipe/lp_bin_queue.c |   44 +++++++++++++-------------
 src/gallium/drivers/llvmpipe/lp_bin_queue.h |    4 +-
 src/gallium/drivers/llvmpipe/lp_setup.c     |    2 +-
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bin_queue.c b/src/gallium/drivers/llvmpipe/lp_bin_queue.c
index b4bc439..b39b46b 100644
--- a/src/gallium/drivers/llvmpipe/lp_bin_queue.c
+++ b/src/gallium/drivers/llvmpipe/lp_bin_queue.c
@@ -51,9 +51,9 @@ struct lp_bins_queue
     * probably always be pretty short.
     */
    struct lp_bins *bins[MAX_BINS];
-   unsigned size;
+   unsigned count;
 
-   pipe_condvar size_change;
+   pipe_condvar count_change;
    pipe_mutex mutex;
 };
 
@@ -65,7 +65,7 @@ lp_bins_queue_create(void)
 {
    struct lp_bins_queue *queue = CALLOC_STRUCT(lp_bins_queue);
    if (queue) {
-      pipe_condvar_init(queue->size_change);
+      pipe_condvar_init(queue->count_change);
       pipe_mutex_init(queue->mutex);
    }
    return queue;
@@ -76,7 +76,7 @@ lp_bins_queue_create(void)
 void
 lp_bins_queue_destroy(struct lp_bins_queue *queue)
 {
-   pipe_condvar_destroy(queue->size_change);
+   pipe_condvar_destroy(queue->count_change);
    pipe_mutex_destroy(queue->mutex);
 }
 
@@ -89,24 +89,24 @@ lp_bins_dequeue(struct lp_bins_queue *queue)
    unsigned i;
 
    pipe_mutex_lock(queue->mutex);
-   while (queue->size == 0) {
-      pipe_condvar_wait(queue->size_change, queue->mutex);
+   while (queue->count == 0) {
+      pipe_condvar_wait(queue->count_change, queue->mutex);
    }
 
-   assert(queue->size >= 1);
+   assert(queue->count >= 1);
 
    /* get head */
    bins = queue->bins[0];
 
    /* shift entries */
-   for (i = 0; i < queue->size - 1; i++) {
+   for (i = 0; i < queue->count - 1; i++) {
       queue->bins[i] = queue->bins[i + 1];
    }
 
-   queue->size--;
+   queue->count--;
 
    /* signal size change */
-   pipe_condvar_signal(queue->size_change);
+   pipe_condvar_signal(queue->count_change);
 
    pipe_mutex_unlock(queue->mutex);
 
@@ -120,21 +120,21 @@ lp_bins_enqueue(struct lp_bins_queue *queue, struct lp_bins *bins)
 {
    pipe_mutex_lock(queue->mutex);
 
-   assert(queue->size < MAX_BINS);
+   assert(queue->count < MAX_BINS);
 
    /* debug: check that bins is not already in the queue */
    if (0) {
       unsigned i;
-      for (i = 0; i < queue->size; i++) {
+      for (i = 0; i < queue->count; i++) {
          assert(queue->bins[i] != bins);
       }
    }
 
    /* add to end */
-   queue->bins[queue->size++] = bins;
+   queue->bins[queue->count++] = bins;
 
    /* signal size change */
-   pipe_condvar_signal(queue->size_change);
+   pipe_condvar_signal(queue->count_change);
 
    pipe_mutex_unlock(queue->mutex);
 }
@@ -142,23 +142,23 @@ lp_bins_enqueue(struct lp_bins_queue *queue, struct lp_bins *bins)
 
 /** Return number of entries in the queue */
 unsigned
-lp_bins_queue_size(struct lp_bins_queue *queue)
+lp_bins_queue_count(struct lp_bins_queue *queue)
 {
-   unsigned sz;
+   unsigned count;
    pipe_mutex_lock(queue->mutex);
-   sz = queue->size;
+   count = queue->count;
    pipe_mutex_unlock(queue->mutex);
-   return sz;
+   return count;
 }
 
 
-/** Wait until the queue as 'size' entries */
+/** Wait until the queue has exactly 'count' entries */
 void
-lp_bins_queue_wait_size(struct lp_bins_queue *queue, unsigned size)
+lp_bins_queue_wait_count(struct lp_bins_queue *queue, unsigned count)
 {
    pipe_mutex_lock(queue->mutex);
-   while (queue->size != size) {
-      pipe_condvar_wait(queue->size_change, queue->mutex);
+   while (queue->count != count) {
+      pipe_condvar_wait(queue->count_change, queue->mutex);
    }
    pipe_mutex_unlock(queue->mutex);
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_bin_queue.h b/src/gallium/drivers/llvmpipe/lp_bin_queue.h
index 8946a54..1a0f883 100644
--- a/src/gallium/drivers/llvmpipe/lp_bin_queue.h
+++ b/src/gallium/drivers/llvmpipe/lp_bin_queue.h
@@ -46,10 +46,10 @@ void
 lp_bins_enqueue(struct lp_bins_queue *queue, struct lp_bins *bins);
 
 unsigned
-lp_bins_queue_size(struct lp_bins_queue *queue);
+lp_bins_queue_count(struct lp_bins_queue *queue);
 
 void
-lp_bins_queue_wait_size(struct lp_bins_queue *queue, unsigned size);
+lp_bins_queue_wait_count(struct lp_bins_queue *queue, unsigned size);
 
 
 #endif /* LP_BIN_QUEUE */
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 6d20975..0972c16 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -588,7 +588,7 @@ lp_setup_destroy( struct setup_context *setup )
    pipe_buffer_reference(&setup->constants.current, NULL);
 
    /* free the bins in the 'empty' queue */
-   while (lp_bins_queue_size(setup->empty_bins) > 0) {
+   while (lp_bins_queue_count(setup->empty_bins) > 0) {
       struct lp_bins *bins = lp_bins_dequeue(setup->empty_bins);
       if (!bins)
          break;



More information about the mesa-commit mailing list