diff options
author | Lionel Landwerlin <[email protected]> | 2018-05-02 00:17:19 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-05-02 17:11:28 +0100 |
commit | ec5df73803f101276973eeb780d1591462e5e0a6 (patch) | |
tree | a77abd6b6025a3ebdcfbdbf72ae39e11003bcc19 /src | |
parent | acbce2ac57d476e2af90a2892341581b76148c11 (diff) |
intel: batch-decoder: iterate VERTEX_BUFFER_STATE fields
The gen_field_iterator only iterates the fields of a given gen_group.
If we want to iterate the fields of another gen_group contained as
field, we need to do it manually.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/tools/gen_batch_decoder.c | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/src/intel/tools/gen_batch_decoder.c b/src/intel/tools/gen_batch_decoder.c index e8d0e11682f..a0d6dbd3e58 100644 --- a/src/intel/tools/gen_batch_decoder.c +++ b/src/intel/tools/gen_batch_decoder.c @@ -322,6 +322,7 @@ handle_3dstate_vertex_buffers(struct gen_batch_decode_ctx *ctx, const uint32_t *p) { struct gen_group *inst = gen_spec_find_instruction(ctx->spec, p); + struct gen_group *vbs = gen_spec_find_struct(ctx->spec, "VERTEX_BUFFER_STATE"); struct gen_batch_decode_bo vb = {}; uint32_t vb_size = 0; @@ -332,43 +333,50 @@ handle_3dstate_vertex_buffers(struct gen_batch_decode_ctx *ctx, struct gen_field_iterator iter; gen_field_iterator_init(&iter, inst, p, 0, false); while (gen_field_iterator_next(&iter)) { - if (strcmp(iter.name, "Vertex Buffer Index") == 0) { - index = iter.raw_value; - } else if (strcmp(iter.name, "Buffer Pitch") == 0) { - pitch = iter.raw_value; - } else if (strcmp(iter.name, "Buffer Starting Address") == 0) { - vb = ctx_get_bo(ctx, iter.raw_value); - } else if (strcmp(iter.name, "Buffer Size") == 0) { - vb_size = iter.raw_value; - ready = true; - } else if (strcmp(iter.name, "End Address") == 0) { - if (vb.map && iter.raw_value >= vb.addr) - vb_size = iter.raw_value - vb.addr; - else - vb_size = 0; - ready = true; - } - - if (!ready) + if (iter.struct_desc != vbs) continue; - fprintf(ctx->fp, "vertex buffer %d, size %d\n", index, vb_size); + struct gen_field_iterator vbs_iter; + gen_field_iterator_init(&vbs_iter, vbs, &iter.p[iter.start_bit / 32], 0, false); + while (gen_field_iterator_next(&vbs_iter)) { + if (strcmp(vbs_iter.name, "Vertex Buffer Index") == 0) { + index = vbs_iter.raw_value; + } 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); + } else if (strcmp(vbs_iter.name, "Buffer Size") == 0) { + vb_size = vbs_iter.raw_value; + ready = true; + } else if (strcmp(vbs_iter.name, "End Address") == 0) { + if (vb.map && vbs_iter.raw_value >= vb.addr) + vb_size = vbs_iter.raw_value - vb.addr; + else + vb_size = 0; + ready = true; + } - if (vb.map == NULL) { - fprintf(ctx->fp, " buffer contents unavailable\n"); - continue; - } + if (!ready) + continue; - if (vb.map == 0 || vb_size == 0) - continue; + fprintf(ctx->fp, "vertex buffer %d, size %d\n", index, vb_size); + + if (vb.map == NULL) { + fprintf(ctx->fp, " buffer contents unavailable\n"); + continue; + } + + if (vb.map == 0 || vb_size == 0) + continue; - ctx_print_buffer(ctx, vb, vb_size, pitch); + ctx_print_buffer(ctx, vb, vb_size, pitch); - vb.map = NULL; - vb_size = 0; - index = -1; - pitch = -1; - ready = false; + vb.map = NULL; + vb_size = 0; + index = -1; + pitch = -1; + ready = false; + } } } |