summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c33
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h7
5 files changed, 56 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 7cd046cc390..0471ad7e2f0 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -29,6 +29,7 @@
#include "util/u_math.h"
#include "util/u_cpu_detect.h"
+#include "lp_bin_queue.h"
#include "lp_debug.h"
#include "lp_state.h"
#include "lp_rast.h"
@@ -655,7 +656,13 @@ create_rast_threads(struct lp_rasterizer *rast)
-struct lp_rasterizer *lp_rast_create( struct pipe_screen *screen )
+/**
+ * Create new lp_rasterizer.
+ * \param empty the queue to put empty bins on after we've finished
+ * processing them.
+ */
+struct lp_rasterizer *
+lp_rast_create( struct pipe_screen *screen, struct lp_bins_queue *empty )
{
struct lp_rasterizer *rast;
unsigned i;
@@ -666,6 +673,9 @@ struct lp_rasterizer *lp_rast_create( struct pipe_screen *screen )
rast->screen = screen;
+ rast->empty_bins = empty;
+ rast->full_bins = lp_bins_queue_create();
+
for (i = 0; i < Elements(rast->tasks); i++) {
rast->tasks[i].tile.color = align_malloc( TILE_SIZE*TILE_SIZE*4, 16 );
rast->tasks[i].tile.depth = align_malloc( TILE_SIZE*TILE_SIZE*4, 16 );
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 25e7f8e0086..0000fbc5c71 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -48,6 +48,7 @@
*/
struct lp_rasterizer;
struct lp_bins;
+struct lp_bins_queue;
struct cmd_bin;
struct pipe_screen;
@@ -130,7 +131,8 @@ struct lp_rast_triangle {
-struct lp_rasterizer *lp_rast_create( struct pipe_screen *screen );
+struct lp_rasterizer *lp_rast_create( struct pipe_screen *screen,
+ struct lp_bins_queue *empty );
void lp_rast_destroy( struct lp_rasterizer * );
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 5502419a928..4e4f8b36a7a 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -95,6 +95,10 @@ struct lp_rasterizer
boolean clipped_tile;
boolean check_for_clipped_tiles;
+ struct lp_bins_queue *full_bins;
+ struct lp_bins_queue *empty_bins;
+ pipe_mutex get_bin_mutex;
+
/* Framebuffer stuff
*/
struct pipe_screen *screen;
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;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 782c05122ca..584e37665bc 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -46,6 +46,9 @@
#define LP_SETUP_NEW_BLEND_COLOR 0x04
+struct lp_bins_queue;
+
+
/**
* Point/line/triangle setup context.
* Note: "stored" below indicates data which is stored in the bins,
@@ -55,7 +58,9 @@ struct setup_context {
struct lp_rasterizer *rast;
- struct lp_bins *bins;
+
+ struct lp_bins *bins; /**< current bins */
+ struct lp_bins_queue *empty_bins; /**< queue of empty bins */
boolean ccw_is_frontface;
unsigned cullmode;