Mesa (lp-binning): llvmpipe: use the empty_bins queue now

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 10 13:56:52 PST 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Dec  9 16:02:30 2009 -0700

llvmpipe: use the empty_bins queue now

---

 src/gallium/drivers/llvmpipe/lp_rast.c  |    8 ++++++++
 src/gallium/drivers/llvmpipe/lp_setup.c |   19 +++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 0471ad7..3165128 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -569,6 +569,10 @@ lp_rasterize_bins( struct lp_rasterizer *rast,
       /* no threading */
       lp_bin_iter_begin( bins );
       rasterize_bins( rast, 0, bins, fb, write_depth );
+
+      /* reset bins and put into the empty queue */
+      lp_reset_bins( bins );
+      lp_bins_enqueue( rast->empty_bins, bins);
    }
    else {
       /* threaded rendering! */
@@ -589,6 +593,10 @@ lp_rasterize_bins( struct lp_rasterizer *rast,
       for (i = 0; i < rast->num_threads; i++) {
          pipe_semaphore_wait(&rast->tasks[i].work_done);
       }
+
+      /* reset bins and put into the empty queue */
+      lp_reset_bins( bins );
+      lp_bins_enqueue( rast->empty_bins, bins);
    }
 
    lp_rast_end( rast );
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index c8cdc32..889f92a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -56,7 +56,17 @@ static void set_state( struct setup_context *, unsigned );
 struct lp_bins *
 lp_setup_get_current_bins(struct setup_context *setup)
 {
-   /* XXX eventually get bin from queue */
+   if (!setup->bins) {
+      /* wait for a free/empty bin */
+      setup->bins = lp_bins_dequeue(setup->empty_bins);
+      if(0)lp_reset_bins( setup->bins ); /* XXX temporary? */
+
+      if (setup->fb) {
+         unsigned tiles_x = align(setup->fb->width, TILE_SIZE) / TILE_SIZE;
+         unsigned tiles_y = align(setup->fb->height, TILE_SIZE) / TILE_SIZE;
+         lp_bin_set_num_bins(setup->bins, tiles_x, tiles_y);
+      }
+   }
    return setup->bins;
 }
 
@@ -101,7 +111,8 @@ static void reset_context( struct setup_context *setup )
    setup->fs.stored = NULL;
    setup->dirty = ~0;
 
-   lp_reset_bins( setup->bins );
+   /* no current bin */
+   setup->bins = NULL;
 
    /* Reset some state:
     */
@@ -558,8 +569,6 @@ lp_setup_destroy( struct setup_context *setup )
 
    pipe_buffer_reference(&setup->constants.current, NULL);
 
-   lp_bins_destroy(setup->bins);
-
    /* free the bins in the 'empty' queue */
    while (lp_bins_queue_size(setup->empty_bins) > 0) {
       struct lp_bins *bins = lp_bins_dequeue(setup->empty_bins);
@@ -595,8 +604,6 @@ lp_setup_create( struct pipe_screen *screen )
    if (!setup->rast) 
       goto fail;
 
-   setup->bins = lp_bins_create();
-
    /* create some empty bins */
    for (i = 0; i < MAX_BINS; i++) {
       struct lp_bins *bins = lp_bins_create();



More information about the mesa-commit mailing list