aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-12-09 14:53:33 -0700
committerBrian Paul <[email protected]>2009-12-09 14:53:33 -0700
commitd7dbc666367438ee9efe748505907b36bba6b66a (patch)
treee93804c614614af992b9a4c433575ee61ba60efa /src/gallium/drivers/llvmpipe/lp_setup.c
parentea35993e7479793212529b1db081c84aa71ea4cc (diff)
llvmpipe: checkpoint: begin plugging in bin queue code
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 484a609e6eb..c8cdc328533 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -37,6 +37,8 @@
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_pack_color.h"
+#include "lp_bin.h"
+#include "lp_bin_queue.h"
#include "lp_debug.h"
#include "lp_state.h"
#include "lp_buffer.h"
@@ -44,6 +46,10 @@
#include "lp_setup_context.h"
+/** XXX temporary value, temporary here */
+#define MAX_BINS 2
+
+
static void set_state( struct setup_context *, unsigned );
@@ -554,6 +560,14 @@ lp_setup_destroy( struct setup_context *setup )
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);
+ if (!bins)
+ break;
+ lp_bins_destroy(bins);
+ }
+
lp_rast_destroy( setup->rast );
FREE( setup );
@@ -567,14 +581,28 @@ lp_setup_destroy( struct setup_context *setup )
struct setup_context *
lp_setup_create( struct pipe_screen *screen )
{
+ unsigned i;
struct setup_context *setup = CALLOC_STRUCT(setup_context);
- setup->rast = lp_rast_create( screen );
+ if (!setup)
+ return NULL;
+
+ setup->empty_bins = lp_bins_queue_create();
+ if (!setup->empty_bins)
+ goto fail;
+
+ setup->rast = lp_rast_create( screen, setup->empty_bins );
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();
+ lp_bins_enqueue(setup->empty_bins, bins);
+ }
+
setup->triangle = first_triangle;
setup->line = first_line;
setup->point = first_point;
@@ -584,6 +612,9 @@ lp_setup_create( struct pipe_screen *screen )
return setup;
fail:
+ if (setup->empty_bins)
+ lp_bins_queue_destroy(setup->empty_bins);
+
FREE(setup);
return NULL;
}