aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/common
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-05-01 21:49:17 -0700
committerKenneth Graunke <[email protected]>2018-05-02 09:27:56 -0700
commitbf91b81a0bfc549b861d17caa42eb3ce98db49b5 (patch)
tree08563f0de0a961ca81cb4393f2e2fbf56a979938 /src/intel/common
parent7c22c150c40b3e2da892604d21c749aaec0b3cfd (diff)
intel: Give the batch decoder a callback to ask about state size.
Given an arbitrary batch, we don't always know what the size of certain things are, such as how many entries are in a binding table. But it's easy for the driver to track that information, so with a simple callback we can calculate this correctly for INTEL_DEBUG=bat. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/common')
-rw-r--r--src/intel/common/gen_batch_decoder.c26
-rw-r--r--src/intel/common/gen_decoder.h4
2 files changed, 26 insertions, 4 deletions
diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index a0d6dbd3e58..dd78e07827e 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -33,11 +33,13 @@ gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
const char *xml_path,
struct gen_batch_decode_bo (*get_bo)(void *,
uint64_t),
+ unsigned (*get_state_size)(void *, uint32_t),
void *user_data)
{
memset(ctx, 0, sizeof(*ctx));
ctx->get_bo = get_bo;
+ ctx->get_state_size = get_state_size;
ctx->user_data = user_data;
ctx->fp = fp;
ctx->flags = flags;
@@ -103,6 +105,24 @@ ctx_get_bo(struct gen_batch_decode_ctx *ctx, uint64_t addr)
return bo;
}
+static int
+update_count(struct gen_batch_decode_ctx *ctx,
+ uint32_t offset_from_dsba,
+ unsigned element_dwords,
+ unsigned guess)
+{
+ unsigned size = 0;
+
+ if (ctx->get_state_size)
+ size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
+
+ if (size > 0)
+ return size / (sizeof(uint32_t) * element_dwords);
+
+ /* In the absence of any information, just guess arbitrarily. */
+ return guess;
+}
+
static void
ctx_disassemble_program(struct gen_batch_decode_ctx *ctx,
uint32_t ksp, const char *type)
@@ -196,9 +216,8 @@ dump_binding_table(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
return;
}
- /* If we don't know the actual count, guess. */
if (count < 0)
- count = 8;
+ count = update_count(ctx, offset, 1, 8);
if (ctx->surface_base.map == NULL) {
fprintf(ctx->fp, " binding table unavailable\n");
@@ -233,9 +252,8 @@ dump_samplers(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
{
struct gen_group *strct = gen_spec_find_struct(ctx->spec, "SAMPLER_STATE");
- /* If we don't know the actual count, guess. */
if (count < 0)
- count = 4;
+ count = update_count(ctx, offset, strct->dw_length, 4);
if (ctx->dynamic_base.map == NULL) {
fprintf(ctx->fp, " samplers unavailable\n");
diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h
index 8324ff95696..37f6c3ee989 100644
--- a/src/intel/common/gen_decoder.h
+++ b/src/intel/common/gen_decoder.h
@@ -207,6 +207,8 @@ struct gen_disasm *disasm;
struct gen_batch_decode_ctx {
struct gen_batch_decode_bo (*get_bo)(void *user_data,
uint64_t base_address);
+ unsigned (*get_state_size)(void *user_data,
+ uint32_t offset_from_dynamic_state_base_addr);
void *user_data;
FILE *fp;
@@ -226,6 +228,8 @@ void gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
const char *xml_path,
struct gen_batch_decode_bo (*get_bo)(void *,
uint64_t),
+
+ unsigned (*get_state_size)(void *, uint32_t),
void *user_data);
void gen_batch_decode_ctx_finish(struct gen_batch_decode_ctx *ctx);