summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-12-09 16:02:30 -0700
committerBrian Paul <[email protected]>2009-12-09 16:06:04 -0700
commit3bee8c2e7c17893f91f6b62e2db090ef495dca9d (patch)
tree59f438db826c77c9e9a57728558609f0ace6f811
parent288ea9770a2c9323ffa9a4b9f3a818d8aa02acd9 (diff)
llvmpipe: use the empty_bins queue now
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c19
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 0471ad7e2f0..3165128f8f6 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 c8cdc328533..889f92a0d50 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();