intel/perf: rename gen_perf to gen_perf_config
authorMark Janes <mark.a.janes@intel.com>
Tue, 2 Jul 2019 21:11:04 +0000 (14:11 -0700)
committerMark Janes <mark.a.janes@intel.com>
Thu, 8 Aug 2019 04:33:55 +0000 (21:33 -0700)
This structure contains the configurations of the metrics for the
current platform, and the settings needed for the perf subsystem to
query that configuration from the device.  This data is available
without a rendering context, and needed to support MDAPI metrics for
Vulkan.

A gen_perf_context struct will be added later, which holds additional
state from the rendering context necessary for metric data
collection.  The gen_perf struct needs a more precise name to reduce
confusion.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/perf/gen_perf.c
src/intel/perf/gen_perf.h
src/intel/perf/gen_perf.py
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_performance_query.c
src/mesa/drivers/dri/i965/brw_performance_query_mdapi.c

index 648ec46..7583539 100644 (file)
@@ -41,7 +41,7 @@
 #define FILE_DEBUG_FLAG DEBUG_PERFMON
 
 static bool
-get_sysfs_dev_dir(struct gen_perf *perf, int fd)
+get_sysfs_dev_dir(struct gen_perf_config *perf, int fd)
 {
    struct stat sb;
    int min, maj;
@@ -125,7 +125,7 @@ read_file_uint64(const char *file, uint64_t *val)
 }
 
 static bool
-read_sysfs_drm_device_file_uint64(struct gen_perf *perf,
+read_sysfs_drm_device_file_uint64(struct gen_perf_config *perf,
                                   const char *file,
                                   uint64_t *value)
 {
@@ -142,7 +142,7 @@ read_sysfs_drm_device_file_uint64(struct gen_perf *perf,
 }
 
 static void
-register_oa_config(struct gen_perf *perf,
+register_oa_config(struct gen_perf_config *perf,
                    const struct gen_perf_query_info *query,
                    uint64_t config_id)
 {
@@ -156,7 +156,7 @@ register_oa_config(struct gen_perf *perf,
 }
 
 static void
-enumerate_sysfs_metrics(struct gen_perf *perf)
+enumerate_sysfs_metrics(struct gen_perf_config *perf)
 {
    DIR *metricsdir = NULL;
    struct dirent *metric_entry;
@@ -210,7 +210,7 @@ enumerate_sysfs_metrics(struct gen_perf *perf)
 }
 
 static bool
-kernel_has_dynamic_config_support(struct gen_perf *perf, int fd)
+kernel_has_dynamic_config_support(struct gen_perf_config *perf, int fd)
 {
    uint64_t invalid_config_id = UINT64_MAX;
 
@@ -219,7 +219,7 @@ kernel_has_dynamic_config_support(struct gen_perf *perf, int fd)
 }
 
 bool
-gen_perf_load_metric_id(struct gen_perf *perf, const char *guid,
+gen_perf_load_metric_id(struct gen_perf_config *perf, const char *guid,
                         uint64_t *metric_id)
 {
    char config_path[280];
@@ -232,7 +232,7 @@ gen_perf_load_metric_id(struct gen_perf *perf, const char *guid,
 }
 
 static void
-init_oa_configs(struct gen_perf *perf, int fd)
+init_oa_configs(struct gen_perf_config *perf, int fd)
 {
    hash_table_foreach(perf->oa_metrics_table, entry) {
       const struct gen_perf_query_info *query = entry->data;
@@ -272,7 +272,7 @@ init_oa_configs(struct gen_perf *perf, int fd)
 }
 
 static void
-compute_topology_builtins(struct gen_perf *perf,
+compute_topology_builtins(struct gen_perf_config *perf,
                           const struct gen_device_info *devinfo)
 {
    perf->sys_vars.slice_mask = devinfo->slice_masks;
@@ -308,7 +308,7 @@ compute_topology_builtins(struct gen_perf *perf,
 }
 
 static bool
-init_oa_sys_vars(struct gen_perf *perf, const struct gen_device_info *devinfo)
+init_oa_sys_vars(struct gen_perf_config *perf, const struct gen_device_info *devinfo)
 {
    uint64_t min_freq_mhz = 0, max_freq_mhz = 0;
 
@@ -328,7 +328,7 @@ init_oa_sys_vars(struct gen_perf *perf, const struct gen_device_info *devinfo)
    return true;
 }
 
-typedef void (*perf_register_oa_queries_t)(struct gen_perf *);
+typedef void (*perf_register_oa_queries_t)(struct gen_perf_config *);
 
 static perf_register_oa_queries_t
 get_register_queries_function(const struct gen_device_info *devinfo)
@@ -372,7 +372,7 @@ get_register_queries_function(const struct gen_device_info *devinfo)
 }
 
 bool
-gen_perf_load_oa_metrics(struct gen_perf *perf, int fd,
+gen_perf_load_oa_metrics(struct gen_perf_config *perf, int fd,
                          const struct gen_device_info *devinfo)
 {
    perf_register_oa_queries_t oa_register = get_register_queries_function(devinfo);
index 64db89e..cb2768e 100644 (file)
@@ -35,7 +35,7 @@
 
 struct gen_device_info;
 
-struct gen_perf;
+struct gen_perf_config;
 struct gen_perf_query_info;
 
 enum gen_perf_counter_type {
@@ -108,10 +108,10 @@ struct gen_perf_query_counter {
    size_t offset;
 
    union {
-      uint64_t (*oa_counter_read_uint64)(struct gen_perf *perf,
+      uint64_t (*oa_counter_read_uint64)(struct gen_perf_config *perf,
                                          const struct gen_perf_query_info *query,
                                          const uint64_t *accumulator);
-      float (*oa_counter_read_float)(struct gen_perf *perf,
+      float (*oa_counter_read_float)(struct gen_perf_config *perf,
                                      const struct gen_perf_query_info *query,
                                      const uint64_t *accumulator);
       struct gen_pipeline_stat pipeline_stat;
@@ -158,7 +158,7 @@ struct gen_perf_query_info {
    uint32_t n_b_counter_regs;
 };
 
-struct gen_perf {
+struct gen_perf_config {
    struct gen_perf_query_info *queries;
    int n_queries;
 
@@ -212,7 +212,7 @@ gen_perf_query_counter_get_size(const struct gen_perf_query_counter *counter)
 }
 
 static inline struct gen_perf_query_info *
-gen_perf_query_append_query_info(struct gen_perf *perf, int max_counters)
+gen_perf_query_append_query_info(struct gen_perf_config *perf, int max_counters)
 {
    struct gen_perf_query_info *query;
 
@@ -263,19 +263,19 @@ gen_perf_query_info_add_basic_stat_reg(struct gen_perf_query_info *query,
    gen_perf_query_info_add_stat_reg(query, reg, 1, 1, name, name);
 }
 
-static inline struct gen_perf *
+static inline struct gen_perf_config *
 gen_perf_new(void *ctx, int (*ioctl_cb)(int, unsigned long, void *))
 {
-   struct gen_perf *perf = rzalloc(ctx, struct gen_perf);
+   struct gen_perf_config *perf = rzalloc(ctx, struct gen_perf_config);
 
    perf->ioctl = ioctl_cb;
 
    return perf;
 }
 
-bool gen_perf_load_oa_metrics(struct gen_perf *perf, int fd,
+bool gen_perf_load_oa_metrics(struct gen_perf_config *perf, int fd,
                               const struct gen_device_info *devinfo);
-bool gen_perf_load_metric_id(struct gen_perf *perf, const char *guid,
+bool gen_perf_load_metric_id(struct gen_perf_config *perf, const char *guid,
                              uint64_t *metric_id);
 
 void gen_perf_query_result_read_frequencies(struct gen_perf_query_result *result,
index ef3aca6..6f42c04 100644 (file)
@@ -278,7 +278,7 @@ def output_counter_read(gen, set, counter):
         read_eq = counter.get('equation')
 
         c("static " + ret_type)
-        c(counter.read_sym + "(UNUSED struct gen_perf *perf,\n")
+        c(counter.read_sym + "(UNUSED struct gen_perf_config *perf,\n")
         c_indent(len(counter.read_sym) + 1)
         c("const struct gen_perf_query_info *query,\n")
         c("const uint64_t *accumulator)\n")
@@ -313,7 +313,7 @@ def output_counter_max(gen, set, counter):
             ret_type = "uint64_t"
 
         c("static " + ret_type)
-        c(counter.max_sym() + "(struct gen_perf *perf)\n")
+        c(counter.max_sym() + "(struct gen_perf_config *perf)\n")
         c("{")
         c_indent(3)
         output_rpn_equation_code(set, counter, max_eq)
@@ -611,7 +611,7 @@ def main():
     h(textwrap.dedent("""\
         #pragma once
 
-        struct gen_perf;
+        struct gen_perf_config;
 
         """))
 
@@ -700,7 +700,7 @@ def main():
             c("};\n")
 
             c("\nstatic void\n")
-            c("{0}_register_{1}_counter_query(struct gen_perf *perf)\n".format(gen.chipset, set.underscore_name))
+            c("{0}_register_{1}_counter_query(struct gen_perf_config *perf)\n".format(gen.chipset, set.underscore_name))
             c("{\n")
             c_indent(3)
 
@@ -731,10 +731,10 @@ def main():
             c_outdent(3)
             c("}\n")
 
-        h("void gen_oa_register_queries_" + gen.chipset + "(struct gen_perf *perf);\n")
+        h("void gen_oa_register_queries_" + gen.chipset + "(struct gen_perf_config *perf);\n")
 
         c("\nvoid")
-        c("gen_oa_register_queries_" + gen.chipset + "(struct gen_perf *perf)")
+        c("gen_oa_register_queries_" + gen.chipset + "(struct gen_perf_config *perf)")
         c("{")
         c_indent(3)
 
index 25ae25e..fa266e7 100644 (file)
@@ -1162,7 +1162,7 @@ struct brw_context
    } predicate;
 
    struct {
-      struct gen_perf *perf;
+      struct gen_perf_config *perf;
 
       /* The i915 perf stream we open to setup + enable the OA counters */
       int oa_stream_fd;
index ea84d4a..eb2830a 100644 (file)
@@ -1383,7 +1383,7 @@ get_oa_counter_data(struct brw_context *brw,
                     size_t data_size,
                     uint8_t *data)
 {
-   struct gen_perf *perf = brw->perfquery.perf;
+   struct gen_perf_config *perf = brw->perfquery.perf;
    const struct gen_perf_query_info *query = obj->query;
    int n_counters = query->n_counters;
    int written = 0;
@@ -1599,7 +1599,7 @@ static void
 init_pipeline_statistic_query_registers(struct brw_context *brw)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   struct gen_perf *perf = brw->perfquery.perf;
+   struct gen_perf_config *perf = brw->perfquery.perf;
    struct gen_perf_query_info *query =
       gen_perf_query_append_query_info(perf, MAX_STAT_COUNTERS);
 
index 379515d..a324209 100644 (file)
@@ -67,7 +67,7 @@ void
 brw_perf_query_register_mdapi_oa_query(struct brw_context *brw)
 {
    const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   struct gen_perf *perf = brw->perfquery.perf;
+   struct gen_perf_config *perf = brw->perfquery.perf;
    struct gen_perf_query_info *query = NULL;
 
    /* MDAPI requires different structures for pretty much every generation