llvmpipe: use the empty_bins queue now

This commit is contained in:
Brian Paul 2009-12-09 16:02:30 -07:00
parent 288ea9770a
commit 3bee8c2e7c
2 changed files with 21 additions and 6 deletions

View file

@ -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 );

View file

@ -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();