summaryrefslogtreecommitdiffstats
path: root/src/intel/common/gen_batch_decoder.c
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-08-26 13:52:47 +0100
committerLionel Landwerlin <[email protected]>2019-03-07 15:08:31 +0000
commitec526d6ba0bdb996416b7479330a424ff737df81 (patch)
tree6b8787d8b6a816dfc818228b40128b316457ddb6 /src/intel/common/gen_batch_decoder.c
parent3e8d5b5ed48aaa37d8b83c2203f45ce55d557351 (diff)
intel/decoders: add address space indicator to get BOs
Some commands like MI_BATCH_BUFFER_START have this indicator. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rafael Antognolli <[email protected]>
Diffstat (limited to 'src/intel/common/gen_batch_decoder.c')
-rw-r--r--src/intel/common/gen_batch_decoder.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index 916aa3c0897..8eff5d171a5 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -34,6 +34,7 @@ gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
FILE *fp, enum gen_batch_decode_flags flags,
const char *xml_path,
struct gen_batch_decode_bo (*get_bo)(void *,
+ bool,
uint64_t),
unsigned (*get_state_size)(void *, uint32_t),
void *user_data)
@@ -78,7 +79,7 @@ ctx_print_group(struct gen_batch_decode_ctx *ctx,
}
static struct gen_batch_decode_bo
-ctx_get_bo(struct gen_batch_decode_ctx *ctx, uint64_t addr)
+ctx_get_bo(struct gen_batch_decode_ctx *ctx, bool ppgtt, uint64_t addr)
{
if (gen_spec_get_gen(ctx->spec) >= gen_make_gen(8,0)) {
/* On Broadwell and above, we have 48-bit addresses which consume two
@@ -90,7 +91,7 @@ ctx_get_bo(struct gen_batch_decode_ctx *ctx, uint64_t addr)
addr &= (~0ull >> 16);
}
- struct gen_batch_decode_bo bo = ctx->get_bo(ctx->user_data, addr);
+ struct gen_batch_decode_bo bo = ctx->get_bo(ctx->user_data, ppgtt, addr);
if (gen_spec_get_gen(ctx->spec) >= gen_make_gen(8,0))
bo.addr &= (~0ull >> 16);
@@ -130,7 +131,7 @@ ctx_disassemble_program(struct gen_batch_decode_ctx *ctx,
uint32_t ksp, const char *type)
{
uint64_t addr = ctx->instruction_base + ksp;
- struct gen_batch_decode_bo bo = ctx_get_bo(ctx, addr);
+ struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, addr);
if (!bo.map)
return;
@@ -257,7 +258,7 @@ dump_binding_table(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
}
struct gen_batch_decode_bo bind_bo =
- ctx_get_bo(ctx, ctx->surface_base + offset);
+ ctx_get_bo(ctx, true, ctx->surface_base + offset);
if (bind_bo.map == NULL) {
fprintf(ctx->fp, " binding table unavailable\n");
@@ -270,7 +271,7 @@ dump_binding_table(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
continue;
uint64_t addr = ctx->surface_base + pointers[i];
- struct gen_batch_decode_bo bo = ctx_get_bo(ctx, addr);
+ struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, addr);
uint32_t size = strct->dw_length * 4;
if (pointers[i] % 32 != 0 ||
@@ -293,7 +294,7 @@ dump_samplers(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
count = update_count(ctx, offset, strct->dw_length, 4);
uint64_t state_addr = ctx->dynamic_base + offset;
- struct gen_batch_decode_bo bo = ctx_get_bo(ctx, state_addr);
+ struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, state_addr);
const void *state_map = bo.map;
if (state_map == NULL) {
@@ -336,7 +337,7 @@ handle_media_interface_descriptor_load(struct gen_batch_decode_ctx *ctx,
}
uint64_t desc_addr = ctx->dynamic_base + descriptor_offset;
- struct gen_batch_decode_bo bo = ctx_get_bo(ctx, desc_addr);
+ struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, desc_addr);
const void *desc_map = bo.map;
if (desc_map == NULL) {
@@ -405,7 +406,7 @@ handle_3dstate_vertex_buffers(struct gen_batch_decode_ctx *ctx,
} else if (strcmp(vbs_iter.name, "Buffer Pitch") == 0) {
pitch = vbs_iter.raw_value;
} else if (strcmp(vbs_iter.name, "Buffer Starting Address") == 0) {
- vb = ctx_get_bo(ctx, vbs_iter.raw_value);
+ vb = ctx_get_bo(ctx, true, vbs_iter.raw_value);
} else if (strcmp(vbs_iter.name, "Buffer Size") == 0) {
vb_size = vbs_iter.raw_value;
ready = true;
@@ -457,7 +458,7 @@ handle_3dstate_index_buffer(struct gen_batch_decode_ctx *ctx,
if (strcmp(iter.name, "Index Format") == 0) {
format = iter.raw_value;
} else if (strcmp(iter.name, "Buffer Starting Address") == 0) {
- ib = ctx_get_bo(ctx, iter.raw_value);
+ ib = ctx_get_bo(ctx, true, iter.raw_value);
} else if (strcmp(iter.name, "Buffer Size") == 0) {
ib_size = iter.raw_value;
}
@@ -615,7 +616,7 @@ decode_3dstate_constant(struct gen_batch_decode_ctx *ctx, const uint32_t *p)
if (read_length[i] == 0)
continue;
- struct gen_batch_decode_bo buffer = ctx_get_bo(ctx, read_addr[i]);
+ struct gen_batch_decode_bo buffer = ctx_get_bo(ctx, true, read_addr[i]);
if (!buffer.map) {
fprintf(ctx->fp, "constant buffer %d unavailable\n", i);
continue;
@@ -681,7 +682,7 @@ decode_dynamic_state_pointers(struct gen_batch_decode_ctx *ctx,
}
uint64_t state_addr = ctx->dynamic_base + state_offset;
- struct gen_batch_decode_bo bo = ctx_get_bo(ctx, state_addr);
+ struct gen_batch_decode_bo bo = ctx_get_bo(ctx, true, state_addr);
const void *state_map = bo.map;
if (state_map == NULL) {
@@ -864,21 +865,26 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
}
if (strcmp(inst_name, "MI_BATCH_BUFFER_START") == 0) {
- struct gen_batch_decode_bo next_batch = {};
+ uint64_t next_batch_addr;
+ bool ppgtt = false;
bool second_level;
struct gen_field_iterator iter;
gen_field_iterator_init(&iter, inst, p, 0, false);
while (gen_field_iterator_next(&iter)) {
if (strcmp(iter.name, "Batch Buffer Start Address") == 0) {
- next_batch = ctx_get_bo(ctx, iter.raw_value);
+ next_batch_addr = iter.raw_value;
} else if (strcmp(iter.name, "Second Level Batch Buffer") == 0) {
second_level = iter.raw_value;
+ } else if (strcmp(iter.name, "Address Space Indicator") == 0) {
+ ppgtt = iter.raw_value;
}
}
+ struct gen_batch_decode_bo next_batch = ctx_get_bo(ctx, ppgtt, next_batch_addr);
+
if (next_batch.map == NULL) {
fprintf(ctx->fp, "Secondary batch at 0x%08"PRIx64" unavailable\n",
- next_batch.addr);
+ next_batch_addr);
} else {
gen_print_batch(ctx, next_batch.map, next_batch.size,
next_batch.addr);