+ enum gen_batch_decode_flags batch_flags = 0;
+ if (option_color == COLOR_ALWAYS)
+ batch_flags |= GEN_BATCH_DECODE_IN_COLOR;
+ if (option_full_decode)
+ batch_flags |= GEN_BATCH_DECODE_FULL;
+ if (option_print_offsets)
+ batch_flags |= GEN_BATCH_DECODE_OFFSETS;
+ batch_flags |= GEN_BATCH_DECODE_FLOATS;
+
+ struct gen_batch_decode_ctx batch_ctx;
+ gen_batch_decode_ctx_init(&batch_ctx, &devinfo, stdout, batch_flags,
+ xml_path, get_gen_batch_bo, NULL, NULL);
+
+
+ for (int s = 0; s < num_sections; s++) {
+ enum drm_i915_gem_engine_class class;
+ ring_name_to_class(sections[s].ring_name, &class);
+
+ printf("--- %s (%s) at 0x%08x %08x\n",
+ sections[s].buffer_name, sections[s].ring_name,
+ (unsigned) (sections[s].gtt_offset >> 32),
+ (unsigned) sections[s].gtt_offset);
+
+ bool is_ring_buffer = strcmp(sections[s].buffer_name, "ring buffer") == 0;
+ if (option_print_all_bb || is_ring_buffer ||
+ strcmp(sections[s].buffer_name, "batch buffer") == 0 ||
+ strcmp(sections[s].buffer_name, "HW Context") == 0) {
+ if (is_ring_buffer && ring_wraps)
+ batch_ctx.flags &= ~GEN_BATCH_DECODE_OFFSETS;
+ batch_ctx.engine = class;
+ uint8_t *data = (uint8_t *)sections[s].data + sections[s].data_offset;
+ uint64_t batch_addr = sections[s].gtt_offset + sections[s].data_offset;
+ gen_print_batch(&batch_ctx, (uint32_t *)data,
+ sections[s].dword_count * 4, batch_addr,
+ is_ring_buffer);
+ batch_ctx.flags = batch_flags;
+ }