return current_offset + sizeof(c_type)
+register_types = {
+ 'FLEX': 'flex_regs',
+ 'NOA': 'mux_regs',
+ 'OA': 'b_counter_regs',
+}
+
+def compute_register_lengths(set):
+ register_lengths = {}
+ register_configs = set.findall('register_config')
+ for register_config in register_configs:
+ t = register_types[register_config.get('type')]
+ if t not in register_lengths:
+ register_lengths[t] = len(register_config.findall('register'))
+ else:
+ register_lengths[t] += len(register_config.findall('register'))
+
+ return register_lengths
+
+
+def generate_register_configs(set):
+ register_configs = set.findall('register_config')
+ for register_config in register_configs:
+ t = register_types[register_config.get('type')]
+
+ availability = register_config.get('availability')
+ if availability:
+ output_availability(set, availability, register_config.get('type') + ' register config')
+ c_indent(3)
+
+ for register in register_config.findall('register'):
+ c("query->%s[query->n_%s++] = (struct brw_perf_query_register_prog) { .reg = %s, .val = %s };" %
+ (t, t, register.get('address'), register.get('value')))
+
+ if availability:
+ c_outdent(3)
+ c("}")
+ c("\n")
+
+
def main():
global c_file
global header_file
max_values[counter.get('symbol_name')] = output_counter_max(set, counter, empty_vars)
counter_vars["$" + counter.get('symbol_name')] = counter
+ c("\n")
+ register_lengths = compute_register_lengths(set);
+ for reg_type, reg_length in register_lengths.iteritems():
+ c("static struct brw_perf_query_register_prog {0}_{1}_{2}[{3}];".format(chipset,
+ set.get('underscore_name'),
+ reg_type, reg_length))
c("\nstatic struct brw_perf_query_counter {0}_{1}_query_counters[{2}];\n".format(chipset, set.get('underscore_name'), len(counters)))
c("static struct brw_perf_query_info " + chipset + "_" + set.get('underscore_name') + "_query = {\n")
.c_offset = 46,
"""))
+ for reg_type, reg_length in register_lengths.iteritems():
+ c(".{0} = {1}_{2}_{3},".format(reg_type, chipset, set.get('underscore_name'), reg_type))
+ c(".n_{0} = 0, /* Determined at runtime */".format(reg_type))
+
c_outdent(3)
c("};\n")
c("\nif (!query->data_size) {")
c_indent(3)
+ generate_register_configs(set)
+
offset = 0
for counter in counters:
offset = output_counter_report(set, counter, offset)