llvmpipe: reorganization of binning data structions and funtions

New lp_bins struct contains all bin information.
More move bin-related code into lp_bin.[ch]
Use new/updated bin-access functions to hide implementation details.
The result is more/cleaner separation between the setup and rast components.
This will make double-buffering of the bins easier, etc.
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index a466aec..87e3bfc 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -56,7 +56,8 @@
  * Begin the rasterization phase.
  * Map the framebuffer surfaces.  Initialize the 'rast' state.
  */
-boolean lp_rast_begin( struct lp_rasterizer *rast,
+static boolean
+lp_rast_begin( struct lp_rasterizer *rast,
                        struct pipe_surface *cbuf,
                        struct pipe_surface *zsbuf,
                        boolean write_color,
@@ -121,7 +122,8 @@
  * Finish the rasterization phase.
  * Unmap framebuffer surfaces.
  */
-void lp_rast_end( struct lp_rasterizer *rast )
+static void
+lp_rast_end( struct lp_rasterizer *rast )
 {
    struct pipe_screen *screen = rast->screen;
 
@@ -469,12 +471,13 @@
 
 /**
  * Rasterize commands for a single bin.
+ * \param x, y  position of the bin's tile in the framebuffer
  * Must be called between lp_rast_begin() and lp_rast_end().
  */
-void
-lp_rasterize_bin( struct lp_rasterizer *rast,
-                  const struct cmd_bin *bin,
-                  int x, int y)
+static void
+rasterize_bin( struct lp_rasterizer *rast,
+               const struct cmd_bin *bin,
+               int x, int y)
 {
    const struct cmd_block_list *commands = &bin->commands;
    struct cmd_block *block;
@@ -493,6 +496,42 @@
 }
 
 
+/**
+ * Rasterize/execute all bins.
+ */
+void
+lp_rasterize_bins( struct lp_rasterizer *rast,
+                   struct lp_bins *bins,
+                   unsigned tiles_x, unsigned tiles_y,
+                   const struct pipe_framebuffer_state *fb,
+                   bool write_depth )
+{
+   unsigned i, j;
+
+   LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+
+   lp_rast_begin( rast,
+                  fb->cbufs[0], 
+                  fb->zsbuf,
+                  fb->cbufs[0] != NULL,
+                  fb->zsbuf != NULL && write_depth,
+                  fb->width,
+                  fb->height );
+                       
+   /* loop over tile bins, rasterize each */
+   for (i = 0; i < tiles_x; i++) {
+      for (j = 0; j < tiles_y; j++) {
+         struct cmd_bin *bin = lp_get_bin(bins, i, j);
+         rasterize_bin( rast, bin, i * TILE_SIZE, j * TILE_SIZE );
+      }
+   }
+
+   lp_rast_end( rast );
+
+   LP_DBG(DEBUG_SETUP, "%s done \n", __FUNCTION__);
+}
+
+
 
 /* Shutdown:
  */