[Intel-gfx] [PATCH 2/6] tools/null_state_gen: Add more debug output
Mika Kuoppala
mika.kuoppala at linux.intel.com
Thu Oct 9 18:54:35 CEST 2014
Be more verbose about the state size we generate.
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
tools/null_state_gen/intel_null_state_gen.c | 36 ++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/tools/null_state_gen/intel_null_state_gen.c b/tools/null_state_gen/intel_null_state_gen.c
index c72796b..353556a 100644
--- a/tools/null_state_gen/intel_null_state_gen.c
+++ b/tools/null_state_gen/intel_null_state_gen.c
@@ -32,8 +32,6 @@
#include "intel_batchbuffer.h"
-#define STATE_ALIGN 64
-
extern int gen6_setup_null_render_state(struct intel_batchbuffer *batch);
extern int gen7_setup_null_render_state(struct intel_batchbuffer *batch);
extern int gen8_setup_null_render_state(struct intel_batchbuffer *batch);
@@ -47,36 +45,52 @@ static void print_usage(char *s)
s);
}
+/* Creates the intel_renderstate_genX.c file for the particular
+ * GEN product
+ */
static int print_state(int gen, struct intel_batchbuffer *batch)
{
int i;
+ unsigned long cmds;
+
+ fprintf(stderr, "Generating for gen%d\n", gen);
printf("#include \"intel_renderstate.h\"\n\n");
+ /* Relocation offsets. These are byte offsets in the golden context
+ * batch buffer where the BB graphics address will be added to
+ * the indirect state offset already stored in those locations. The
+ * resulting value will inform the GPU where the indirect states are.
+ */
printf("static const u32 gen%d_null_state_relocs[] = {\n", gen);
for (i = 0; i < batch->cmds->num_items; i++) {
if (intel_batch_is_reloc(batch, i))
printf("\t0x%08x,\n", i * 4);
}
- printf("\t%d,\n", -1);
- printf("};\n\n");
+ printf("\t-1,\n};\n\n");
+ /* GPU commands to execute to set up the RCS golden state. This
+ * state will become the default config.
+ */
printf("static const u32 gen%d_null_state_batch[] = {\n", gen);
for (i = 0; i < intel_batch_num_cmds(batch); i++) {
+ const int offset = i * 4;
const struct bb_item *cmd = intel_batch_cmd_get(batch, i);
printf("\t0x%08x,", cmd->data);
if (debug)
- printf("\t /* 0x%08x %s '%s' */", i * 4,
- intel_batch_type_as_str(cmd), cmd->str);
+ printf("\t /* 0x%08x %s '%s' */", offset,
+ intel_batch_type_as_str(cmd), cmd->str);
- if (i * 4 == batch->cmds_end_offset)
+ if (offset == batch->cmds_end_offset) {
+ cmds = i + 1;
printf("\t /* cmds end */");
+ }
if (intel_batch_is_reloc(batch, i))
printf("\t /* reloc */");
- if (i * 4 == batch->state_start_offset)
+ if (offset == batch->state_start_offset)
printf("\t /* state start */");
if (i == intel_batch_num_cmds(batch) - 1)
@@ -87,9 +101,15 @@ static int print_state(int gen, struct intel_batchbuffer *batch)
printf("};\n\nRO_RENDERSTATE(%d);\n", gen);
+ fprintf(stderr, "Commands %lu (%lu bytes)\n", cmds, cmds * 4);
+ fprintf(stderr, "State %lu (%lu bytes)\n", batch->state->num_items, batch->state->num_items * 4);
+ fprintf(stderr, "Total %lu (%lu bytes)\n", batch->cmds->num_items, batch->cmds->num_items * 4);
+ fprintf(stderr, "\n");
+
return 0;
}
+/* Selects generator function for the given product and executes it. */
static int do_generate(int gen)
{
struct intel_batchbuffer *batch;
--
1.9.1
More information about the Intel-gfx
mailing list