intel/perf: create a vtable entry for emit_report_count
authorMark Janes <mark.a.janes@intel.com>
Fri, 2 Aug 2019 23:33:25 +0000 (16:33 -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 2e50345c1dbdfd8dd6b59da04f60a61de4bba591..2d092d087ec861fb077c81b37a8fe8e3c05461d4 100644 (file)
@@ -192,6 +192,10 @@ struct gen_perf_config {
    struct {
       void *(*bo_alloc)(void *bufmgr, const char *name, uint64_t size);
       void (*bo_unreference)(void *bo);
+      void (*emit_mi_report_perf_count)(void *ctx,
+                                        void *bo,
+                                        uint32_t offset_in_bytes,
+                                        uint32_t report_id);
    } vtbl;
 };
 
index 980a042fc4940a32d9c36ff629da2ccdbc5c2628..8c689aaf497eba2547801156c719e918261a35ce 100644 (file)
@@ -1146,8 +1146,8 @@ brw_begin_perf_query(struct gl_context *ctx,
       intel_batchbuffer_flush(brw);
 
       /* Take a starting OA counter snapshot. */
-      brw->vtbl.emit_mi_report_perf_count(brw, obj->oa.bo, 0,
-                                          obj->oa.begin_report_id);
+      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);
 
       ++brw->perfquery.n_active_oa_queries;
@@ -1732,7 +1732,21 @@ brw_oa_bo_alloc(void *bufmgr, const char *name, uint64_t size)
    return brw_bo_alloc(bufmgr, name, size, BRW_MEMZONE_OTHER);
 }
 
+static void
+brw_oa_emit_mi_report_perf_count(void *c,
+                                 void *bo,
+                                 uint32_t offset_in_bytes,
+                                 uint32_t report_id)
+{
+   struct brw_context *ctx = c;
+   ctx->vtbl.emit_mi_report_perf_count(ctx,
+                                       bo,
+                                       offset_in_bytes,
+                                       report_id);
+}
+
 typedef void (*bo_unreference_t)(void *);
+typedef void (* emit_mi_report_t)(void *, void *, uint32_t, uint32_t);
 
 static unsigned
 brw_init_perf_query_info(struct gl_context *ctx)
@@ -1749,6 +1763,8 @@ brw_init_perf_query_info(struct gl_context *ctx)
    struct gen_perf_config *perf_cfg = brw->perfquery.perf;
    perf_cfg->vtbl.bo_alloc = brw_oa_bo_alloc;
    perf_cfg->vtbl.bo_unreference = (bo_unreference_t)brw_bo_unreference;
+   perf_cfg->vtbl.emit_mi_report_perf_count =
+      (emit_mi_report_t)brw_oa_emit_mi_report_perf_count;
 
    init_pipeline_statistic_query_registers(brw);
    brw_perf_query_register_mdapi_statistic_query(brw);