{
uint64_t qw = 0;
- int field_start = iter->bit;
- int field_end = iter->bit + (iter->field->end - iter->field->start);
+ int field_start = iter->p_bit + iter->bit;
+ int field_end = field_start + (iter->field->end - iter->field->start);
const uint32_t *p = iter->p + (iter->bit / 32);
if ((field_end - field_start) > 32) {
void
gen_field_iterator_init(struct gen_field_iterator *iter,
struct gen_group *group,
- const uint32_t *p,
+ const uint32_t *p, int p_bit,
bool print_colors)
{
memset(iter, 0, sizeof(*iter));
else
iter->field = group->next->fields;
iter->p = p;
+ iter->p_bit = p_bit;
iter->p_end = &p[gen_group_get_length(iter->group, iter->p)];
iter->print_colors = print_colors;
}
void
-gen_print_group(FILE *outfile, struct gen_group *group,
- uint64_t offset, const uint32_t *p, bool color)
+gen_print_group(FILE *outfile, struct gen_group *group, uint64_t offset,
+ const uint32_t *p, int p_bit, bool color)
{
struct gen_field_iterator iter;
int last_dword = -1;
- gen_field_iterator_init(&iter, group, p, color);
+ gen_field_iterator_init(&iter, group, p, p_bit, color);
do {
int iter_dword = iter.bit / 32;
if (last_dword != iter_dword) {
if (iter.struct_desc) {
uint64_t struct_offset = offset + 4 * iter_dword;
gen_print_group(outfile, iter.struct_desc, struct_offset,
- &p[iter_dword], color);
+ &p[iter_dword], iter.bit % 32, color);
}
}
} while (gen_field_iterator_next(&iter));
char value[128];
struct gen_group *struct_desc;
const uint32_t *p;
+ int p_bit; /**< bit offset into p */
const uint32_t *p_end;
int bit; /**< current field starts at this bit offset into p */
void gen_field_iterator_init(struct gen_field_iterator *iter,
struct gen_group *group,
- const uint32_t *p,
+ const uint32_t *p, int p_bit,
bool print_colors);
bool gen_field_iterator_next(struct gen_field_iterator *iter);
void gen_print_group(FILE *out,
struct gen_group *group,
- uint64_t offset, const uint32_t *p,
+ uint64_t offset, const uint32_t *p, int p_bit,
bool color);
#ifdef __cplusplus
{
uint64_t offset = option_print_offsets ? (void *) p - gtt : 0;
- gen_print_group(outfile, strct, offset, p, option_color == COLOR_ALWAYS);
+ gen_print_group(outfile, strct, offset, p, 0, option_color == COLOR_ALWAYS);
}
static void
{
struct gen_group *reg_spec = gen_spec_find_register_by_name(spec, name);
- if (reg_spec)
- gen_print_group(stdout, reg_spec, 0, ®, option_color == COLOR_ALWAYS);
+ if (reg_spec) {
+ gen_print_group(stdout, reg_spec, 0, ®, 0,
+ option_color == COLOR_ALWAYS);
+ }
}
struct ring_register_mapping {
printf("%s0x%08"PRIx64": 0x%08x: %-80s%s\n",
color, offset, p[0], gen_group_get_name(inst), reset_color);
- gen_print_group(stdout, inst, offset, p,
+ gen_print_group(stdout, inst, offset, p, 0,
option_color == COLOR_ALWAYS);
if (strcmp(inst->name, "MI_BATCH_BUFFER_END") == 0)
if (strcmp(inst->name, "STATE_BASE_ADDRESS") == 0) {
struct gen_field_iterator iter;
- gen_field_iterator_init(&iter, inst, p, false);
+ gen_field_iterator_init(&iter, inst, p, 0, false);
do {
if (strcmp(iter.name, "Instruction Base Address") == 0) {
strcmp(inst->name, "3DSTATE_PS") == 0 ||
strcmp(inst->name, "3DSTATE_WM") == 0) {
struct gen_field_iterator iter;
- gen_field_iterator_init(&iter, inst, p, false);
+ gen_field_iterator_init(&iter, inst, p, 0, false);
uint64_t ksp[3] = {0, 0, 0};
bool enabled[3] = {false, false, false};
strcmp(inst->name, "3DSTATE_GS") == 0 ||
strcmp(inst->name, "3DSTATE_VS") == 0) {
struct gen_field_iterator iter;
- gen_field_iterator_init(&iter, inst, p, false);
+ gen_field_iterator_init(&iter, inst, p, 0, false);
uint64_t ksp = 0;
bool is_simd8 = false; /* vertex shaders on Gen8+ only */
bool is_enabled = true;
}
} else if (strcmp(inst->name, "MEDIA_INTERFACE_DESCRIPTOR_LOAD") == 0) {
struct gen_field_iterator iter;
- gen_field_iterator_init(&iter, inst, p, false);
+ gen_field_iterator_init(&iter, inst, p, 0, false);
uint64_t interface_offset = 0;
do {
if (strcmp(iter.name, "Interface Descriptor Data Start Address") == 0) {
gen_spec_find_struct(spec, "INTERFACE_DESCRIPTOR_DATA");
uint32_t *desc_p =
((void *)current_dynamic_state_buffer->data) + interface_offset;
- gen_field_iterator_init(&iter, desc, desc_p, false);
+ gen_field_iterator_init(&iter, desc, desc_p, 0, false);
do {
if (strcmp(iter.name, "Kernel Start Pointer") == 0) {
uint64_t ksp = strtol(iter.value, NULL, 16);
fprintf(stderr, "%s\n", struct_name);
gen_print_group(stderr, group, gtt_offset + offset,
- &data[offset / 4], color);
+ &data[offset / 4], 0, color);
}
static void
for (int i = 0; i < entries; i++) {
fprintf(stderr, "%s %d\n", struct_name, i);
gen_print_group(stderr, group, gtt_offset + offset,
- &data[(offset + i * struct_size) / 4], color);
+ &data[(offset + i * struct_size) / 4], 0, color);
}
}
fprintf(stderr, "%s0x%08"PRIx64": 0x%08x: %-80s%s\n", header_color,
offset, p[0], gen_group_get_name(inst), reset_color);
- gen_print_group(stderr, inst, offset, p, color);
+ gen_print_group(stderr, inst, offset, p, 0, color);
switch (gen_group_get_opcode(inst) >> 16) {
case _3DSTATE_PIPELINED_POINTERS:
for (int i = 0; i < bt_entries; i++) {
fprintf(stderr, "SURFACE_STATE - BTI = %d\n", i);
gen_print_group(stderr, group, state_gtt_offset + bt_pointers[i],
- &state[bt_pointers[i] / 4], color);
+ &state[bt_pointers[i] / 4], 0, color);
}
break;
}
for (int i = 0; i < bt_entries; i++) {
fprintf(stderr, "SURFACE_STATE - BTI = %d\n", i);
gen_print_group(stderr, group, state_gtt_offset + bt_pointers[i],
- &state[bt_pointers[i] / 4], color);
+ &state[bt_pointers[i] / 4], 0, color);
}
break;
}