llvmpipe: struct cmd_bin
authorBrian Paul <brianp@vmware.com>
Fri, 4 Dec 2009 17:41:38 +0000 (10:41 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 4 Dec 2009 17:41:42 +0000 (10:41 -0700)
Just introducing a new structure to represent a per-tile bin.

src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup_context.h

index 1f303d7705eb52543a80b887f0865f2fa1a3d654..fc7f4f6778edb48aa6cf7b40e1ce8aa347a25195 100644 (file)
@@ -111,7 +111,7 @@ static void reset_context( struct setup_context *setup )
     */
    for (i = 0; i < setup->tiles_x; i++) {
       for (j = 0; j < setup->tiles_y; j++) {
-         struct cmd_block_list *list = &setup->tile[i][j];
+         struct cmd_block_list *list = &setup->tile[i][j].commands;
          struct cmd_block *block;
          struct cmd_block *tmp;
          
@@ -173,9 +173,10 @@ static void bin_everywhere( struct setup_context *setup,
 /** Rasterize commands for a single bin */
 static void
 rasterize_bin( struct lp_rasterizer *rast,
-               struct cmd_block_list *commands,
+               const struct cmd_bin *bin,
                int x, int y)
 {
+   const struct cmd_block_list *commands = &bin->commands;
    struct cmd_block *block;
    unsigned k;
 
@@ -666,7 +667,7 @@ lp_setup_destroy( struct setup_context *setup )
 
    for (i = 0; i < TILES_X; i++)
       for (j = 0; j < TILES_Y; j++)
-         FREE(setup->tile[i][j].head);
+         FREE(setup->tile[i][j].commands.head);
 
    FREE(setup->data.head);
 
@@ -691,8 +692,8 @@ lp_setup_create( struct pipe_screen *screen )
 
    for (i = 0; i < TILES_X; i++)
       for (j = 0; j < TILES_Y; j++)
-         setup->tile[i][j].head = 
-            setup->tile[i][j].tail = CALLOC_STRUCT(cmd_block);
+         setup->tile[i][j].commands.head = 
+            setup->tile[i][j].commands.tail = CALLOC_STRUCT(cmd_block);
 
    setup->data.head =
       setup->data.tail = CALLOC_STRUCT(data_block);
index b502f00eea457de801e3604fc083823744510cdb..1715048f7602d25b222176f87247e613aa0dc6a7 100644 (file)
@@ -71,11 +71,20 @@ struct cmd_block_list {
    struct cmd_block *tail;
 };
 
+/**
+ * For each screen tile we have one of these bins.
+ */
+struct cmd_bin {
+   struct cmd_block_list commands;
+   struct lp_rast_state *curr_state;
+};
+   
+
 struct data_block_list {
    struct data_block *head;
    struct data_block *tail;
 };
-   
+
 
 /**
  * Point/line/triangle setup context.
@@ -87,12 +96,12 @@ struct setup_context {
    struct lp_rasterizer *rast;
 
    /**
-    * Per-bin data goes into the 'tile' cmd_block_lists.
+    * Per-bin data goes into the 'tile' bins.
     * Shared bin data goes into the 'data' buffer.
     * When there are multiple threads, will want to double-buffer the
     * bin arrays:
     */
-   struct cmd_block_list tile[TILES_X][TILES_Y];
+   struct cmd_bin tile[TILES_X][TILES_Y];
    struct data_block_list data;
 
    /* size of framebuffer, in tiles */
@@ -212,10 +221,12 @@ static INLINE void *get_data_aligned( struct data_block_list *list,
 
 /* Add a command to a given bin.
  */
-static INLINE void bin_command( struct cmd_block_list *list,
+static INLINE void bin_command( struct cmd_bin *bin,
                                 lp_rast_cmd cmd,
                                 union lp_rast_cmd_arg arg )
 {
+   struct cmd_block_list *list = &bin->commands;
+
    if (list->tail->count == CMD_BLOCK_MAX) {
       lp_setup_new_cmd_block( list );
    }