From: Lionel Landwerlin Date: Fri, 19 Oct 2018 17:25:13 +0000 (+0100) Subject: intel/perf: extract register configuration X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1d5d752572cc7017f1b4efdedfcf7b56f11044a;p=mesa.git intel/perf: extract register configuration We want to query the content of register configurations from the kernel. Let's pull this out of the query. Signed-off-by: Lionel Landwerlin Reviewed-by: Rafael Antognolli --- diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c index 01ee19b5e57..61bf8329d2c 100644 --- a/src/intel/perf/gen_perf.c +++ b/src/intel/perf/gen_perf.c @@ -616,14 +616,14 @@ init_oa_configs(struct gen_perf_config *perf, int fd) memcpy(config.uuid, query->guid, sizeof(config.uuid)); - config.n_mux_regs = query->n_mux_regs; - config.mux_regs_ptr = (uintptr_t) query->mux_regs; + config.n_mux_regs = query->config.n_mux_regs; + config.mux_regs_ptr = (uintptr_t) query->config.mux_regs; - config.n_boolean_regs = query->n_b_counter_regs; - config.boolean_regs_ptr = (uintptr_t) query->b_counter_regs; + config.n_boolean_regs = query->config.n_b_counter_regs; + config.boolean_regs_ptr = (uintptr_t) query->config.b_counter_regs; - config.n_flex_regs = query->n_flex_regs; - config.flex_regs_ptr = (uintptr_t) query->flex_regs; + config.n_flex_regs = query->config.n_flex_regs; + config.flex_regs_ptr = (uintptr_t) query->config.flex_regs; ret = gen_ioctl(fd, DRM_IOCTL_I915_PERF_ADD_CONFIG, &config); if (ret < 0) { diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h index c79db7cfa44..5385607b956 100644 --- a/src/intel/perf/gen_perf.h +++ b/src/intel/perf/gen_perf.h @@ -164,6 +164,18 @@ struct gen_perf_query_register_prog { uint32_t val; }; +/* Register programming for a given query */ +struct gen_perf_configuration { + struct gen_perf_query_register_prog *flex_regs; + uint32_t n_flex_regs; + + struct gen_perf_query_register_prog *mux_regs; + uint32_t n_mux_regs; + + struct gen_perf_query_register_prog *b_counter_regs; + uint32_t n_b_counter_regs; +}; + struct gen_perf_query_info { enum gen_perf_query_type { GEN_PERF_QUERY_TYPE_OA, @@ -188,15 +200,7 @@ struct gen_perf_query_info { int b_offset; int c_offset; - /* Register programming for a given query */ - struct gen_perf_query_register_prog *flex_regs; - uint32_t n_flex_regs; - - struct gen_perf_query_register_prog *mux_regs; - uint32_t n_mux_regs; - - struct gen_perf_query_register_prog *b_counter_regs; - uint32_t n_b_counter_regs; + struct gen_perf_configuration config; }; struct gen_perf_config { diff --git a/src/intel/perf/gen_perf.py b/src/intel/perf/gen_perf.py index 6f42c04dab8..8e05a8e472b 100644 --- a/src/intel/perf/gen_perf.py +++ b/src/intel/perf/gen_perf.py @@ -419,7 +419,7 @@ def generate_register_configs(set): c_indent(3) for register in register_config.findall('register'): - c("query->%s[query->n_%s++] = (struct gen_perf_query_register_prog) { .reg = %s, .val = %s };" % + c("query->config.%s[query->config.n_%s++] = (struct gen_perf_query_register_prog) { .reg = %s, .val = %s };" % (t, t, register.get('address'), register.get('value'))) if availability: @@ -692,9 +692,13 @@ def main(): .c_offset = 46, """)) + c(".config = {") + c_indent(3) for reg_type, reg_length in register_lengths.items(): c(".{0} = {1}_{2}_{3},".format(reg_type, gen.chipset, set.underscore_name, reg_type)) c(".n_{0} = 0, /* Determined at runtime */".format(reg_type)) + c_outdent(3) + c("},") c_outdent(3) c("};\n")