intel/perf: create a vtable entry for capture_frequency_stat_register
authorMark Janes <mark.a.janes@intel.com>
Fri, 24 May 2019 22:35:34 +0000 (15:35 -0700)
committerMark Janes <mark.a.janes@intel.com>
Thu, 8 Aug 2019 04:33:55 +0000 (21:33 -0700)
In preparation for calling both Iris and i965 implementions from perf.

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

index 7e28e632420bf88f5b951ccba4eb3cbf0d37db9d..e9b6913ad21e5636b8a39c7941940f17f38ee3f2 100644 (file)
@@ -198,6 +198,8 @@ struct gen_perf_config {
                                         uint32_t report_id);
       void (*batchbuffer_flush)(void *ctx,
                                 const char *file, int line);
+      void (*capture_frequency_stat_register)(void *ctx, void *bo,
+                                              uint32_t bo_offset);
    } vtbl;
 };
 
index 0815d1ffef4433ad361a1047c051369255551d29..5dc47dcf5600579035ea8a7e75dfdd55adc9565f 100644 (file)
@@ -1149,7 +1149,8 @@ brw_begin_perf_query(struct gl_context *ctx,
       /* Take a starting OA counter snapshot. */
       brw->perfquery.perf->vtbl.emit_mi_report_perf_count(brw, obj->oa.bo, 0,
                                                           obj->oa.begin_report_id);
-      capture_frequency_stat_register(brw, obj->oa.bo, MI_FREQ_START_OFFSET_BYTES);
+      perf_cfg->vtbl.capture_frequency_stat_register(brw, obj->oa.bo,
+                                                     MI_FREQ_START_OFFSET_BYTES);
 
       ++brw->perfquery.n_active_oa_queries;
 
@@ -1214,6 +1215,7 @@ brw_end_perf_query(struct gl_context *ctx,
 {
    struct brw_context *brw = brw_context(ctx);
    struct brw_perf_query_object *obj = brw_perf_query(o);
+   struct gen_perf_config *perf_cfg = brw->perfquery.perf;
 
    DBG("End(%d)\n", o->Id);
 
@@ -1236,7 +1238,8 @@ brw_end_perf_query(struct gl_context *ctx,
        */
       if (!obj->oa.results_accumulated) {
          /* Take an ending OA counter snapshot. */
-         capture_frequency_stat_register(brw, obj->oa.bo, MI_FREQ_END_OFFSET_BYTES);
+         perf_cfg->vtbl.capture_frequency_stat_register(brw, obj->oa.bo,
+                                                        MI_FREQ_END_OFFSET_BYTES);
          brw->vtbl.emit_mi_report_perf_count(brw, obj->oa.bo,
                                              MI_RPC_BO_END_OFFSET_BYTES,
                                              obj->oa.begin_report_id + 1);
@@ -1757,6 +1760,8 @@ brw_oa_batchbuffer_flush(void *c, const char *file, int line)
    _intel_batchbuffer_flush_fence(ctx, -1, NULL, file,  line);
 }
 
+typedef void (*capture_frequency_stat_register_t)(void *, void *, uint32_t );
+
 static unsigned
 brw_init_perf_query_info(struct gl_context *ctx)
 {
@@ -1775,6 +1780,8 @@ brw_init_perf_query_info(struct gl_context *ctx)
    perf_cfg->vtbl.emit_mi_report_perf_count =
       (emit_mi_report_t)brw_oa_emit_mi_report_perf_count;
    perf_cfg->vtbl.batchbuffer_flush = brw_oa_batchbuffer_flush;
+   perf_cfg->vtbl.capture_frequency_stat_register =
+      (capture_frequency_stat_register_t) capture_frequency_stat_register;
 
    init_pipeline_statistic_query_registers(brw);
    brw_perf_query_register_mdapi_statistic_query(brw);