summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-09 12:22:12 -0700
committerBrian Paul <brianp@vmware.com>2009-12-09 12:22:12 -0700
commit88e62b33dc5ed4a4ab0c668e627c7e85991c74a1 (patch)
tree4ecd6b73e844784fccc19eaed707a9cebcd77918 /src
parent7f457acabcbeea6a27b4f375f55e318fff52445f (diff)
llvmpipe: more bin functions for create/destroy/queries
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bin.c47
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bin.h9
2 files changed, 56 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bin.c b/src/gallium/drivers/llvmpipe/lp_bin.c
index 3e294e5799..f2d3c2df4d 100644
--- a/src/gallium/drivers/llvmpipe/lp_bin.c
+++ b/src/gallium/drivers/llvmpipe/lp_bin.c
@@ -29,6 +29,25 @@
#include "lp_bin.h"
+struct lp_bins *
+lp_bins_create(void)
+{
+ struct lp_bins *bins = CALLOC_STRUCT(lp_bins);
+ if (bins)
+ lp_init_bins(bins);
+ return bins;
+}
+
+
+void
+lp_bins_destroy(struct lp_bins *bins)
+{
+ lp_reset_bins(bins);
+ lp_free_bin_data(bins);
+ FREE(bins);
+}
+
+
void
lp_init_bins(struct lp_bins *bins)
{
@@ -147,6 +166,34 @@ lp_bin_new_data_block( struct data_block_list *list )
}
+/** Return number of bytes used for bin data */
+unsigned
+lp_bin_data_size( const struct lp_bins *bins )
+{
+ unsigned size = 0;
+ const struct data_block *block;
+ for (block = bins->data.head; block; block = block->next) {
+ size += block->used;
+ }
+ return size;
+}
+
+
+/** Return number of bytes used for a tile bin */
+unsigned
+lp_bin_cmd_size( const struct lp_bins *bins, unsigned x, unsigned y )
+{
+ struct cmd_bin *bin = lp_get_bin((struct lp_bins *) bins, x, y);
+ const struct cmd_block *cmd;
+ unsigned size = 0;
+ for (cmd = bin->commands.head; cmd; cmd = cmd->next) {
+ size += (cmd->count *
+ (sizeof(lp_rast_cmd) + sizeof(union lp_rast_cmd_arg)));
+ }
+ return size;
+}
+
+
/**
* Return last command in the bin
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_bin.h b/src/gallium/drivers/llvmpipe/lp_bin.h
index b07ff64e62..c49b0264d6 100644
--- a/src/gallium/drivers/llvmpipe/lp_bin.h
+++ b/src/gallium/drivers/llvmpipe/lp_bin.h
@@ -120,6 +120,11 @@ struct lp_bins {
+struct lp_bins *lp_bins_create(void);
+
+void lp_bins_destroy(struct lp_bins *bins);
+
+
void lp_init_bins(struct lp_bins *bins);
void lp_reset_bins(struct lp_bins *bins );
@@ -134,6 +139,10 @@ void lp_bin_new_data_block( struct data_block_list *list );
void lp_bin_new_cmd_block( struct cmd_block_list *list );
+unsigned lp_bin_data_size( const struct lp_bins *bins );
+
+unsigned lp_bin_cmd_size( const struct lp_bins *bins, unsigned x, unsigned y );
+
/**
* Allocate space for a command/data in the bin's data buffer.