summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-01-13 20:14:04 +0000
committerKeith Whitwell <[email protected]>2010-01-13 20:14:04 +0000
commit4231006e29cbf9fb54c72acf35009f3b18fe62ab (patch)
tree326ca02a3e62103733259b5907756f8db80d35fe /src/gallium/drivers
parent95ee14f147e713bd132dc56a1151232957752c90 (diff)
llvmpipe: add bin debugger
Adjust definition of empty_bin according to what's actually in empty bins. We often have a state packet before/after load commands. Still need to do something about the fence packets.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c57
1 files changed, 52 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 7753f9bb3f6..6c7ece9fdbf 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -608,6 +608,44 @@ rasterize_bin( struct lp_rasterizer *rast,
lp_rast_end_tile( rast, thread_index );
}
+
+#define RAST(x) { lp_rast_##x, #x }
+
+static struct {
+ lp_rast_cmd cmd;
+ const char *name;
+} cmd_names[] =
+{
+ RAST(load_color),
+ RAST(load_zstencil),
+ RAST(clear_color),
+ RAST(clear_zstencil),
+ RAST(triangle),
+ RAST(shade_tile),
+ RAST(set_state),
+ RAST(fence),
+};
+
+static void
+debug_bin( const struct cmd_bin *bin )
+{
+ const struct cmd_block *head = bin->commands.head;
+ int i, j;
+
+ for (i = 0; i < head->count; i++) {
+ debug_printf("%d: ", i);
+ for (j = 0; j < Elements(cmd_names); j++) {
+ if (head->cmd[i] == cmd_names[j].cmd) {
+ debug_printf("%s\n", cmd_names[j].name);
+ break;
+ }
+ }
+ if (j == Elements(cmd_names))
+ debug_printf("...other\n");
+ }
+
+}
+
/* An empty bin is one that just loads the contents of the tile and
* stores them again unchanged. This typically happens when bins have
* been flushed for some reason in the middle of a frame, or when
@@ -620,19 +658,28 @@ is_empty_bin( const struct cmd_bin *bin )
{
const struct cmd_block *head = bin->commands.head;
int i;
-
+
+ if (0)
+ debug_bin(bin);
+
/* We emit at most two load-tile commands at the start of the first
- * command block. If there are more than two commands in the
- * block, we know that the bin is non-empty.
+ * command block. In addition we seem to emit a couple of
+ * set-state commands even in empty bins.
+ *
+ * As a heuristic, if a bin has more than 4 commands, consider it
+ * non-empty.
*/
if (head->next != NULL ||
- head->count > 2)
+ head->count > 4) {
return FALSE;
+ }
for (i = 0; i < head->count; i++)
if (head->cmd[i] != lp_rast_load_color &&
- head->cmd[i] != lp_rast_load_zstencil)
+ head->cmd[i] != lp_rast_load_zstencil &&
+ head->cmd[i] != lp_rast_set_state) {
return FALSE;
+ }
return TRUE;
}