From a157f5acb13ec6d62868ad7923ecf1fb3b93d5db Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Tue, 11 Jun 2019 16:04:02 -0700 Subject: [PATCH] intel/perf: move snapshot_statistics_registers into perf Reviewed-by: Kenneth Graunke --- src/intel/perf/gen_perf.c | 26 ++++++++++++++++ src/intel/perf/gen_perf.h | 4 +++ .../drivers/dri/i965/brw_performance_query.c | 31 ++----------------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c index 4a3546cb1ec..f6e145627f5 100644 --- a/src/intel/perf/gen_perf.c +++ b/src/intel/perf/gen_perf.c @@ -877,3 +877,29 @@ gen_perf_free_sample_bufs(struct gen_perf_context *perf_ctx) exec_list_make_empty(&perf_ctx->free_sample_buffers); } + +/******************************************************************************/ + +/** + * Emit MI_STORE_REGISTER_MEM commands to capture all of the + * pipeline statistics for the performance query object. + */ +void +gen_perf_snapshot_statistics_registers(void *context, + struct gen_perf_config *perf, + struct gen_perf_query_object *obj, + uint32_t offset_in_bytes) +{ + const struct gen_perf_query_info *query = obj->queryinfo; + const int n_counters = query->n_counters; + + for (int i = 0; i < n_counters; i++) { + const struct gen_perf_query_counter *counter = &query->counters[i]; + + assert(counter->data_type == GEN_PERF_COUNTER_DATA_TYPE_UINT64); + + perf->vtbl.store_register_mem64(context, obj->pipeline_stats.bo, + counter->pipeline_stat.reg, + offset_in_bytes + i * sizeof(uint64_t)); + } +} diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h index 1c588a121e8..3606748c424 100644 --- a/src/intel/perf/gen_perf.h +++ b/src/intel/perf/gen_perf.h @@ -582,5 +582,9 @@ struct oa_sample_buf * gen_perf_get_free_sample_buf(struct gen_perf_context *per void gen_perf_reap_old_sample_buffers(struct gen_perf_context *perf_ctx); void gen_perf_free_sample_bufs(struct gen_perf_context *perf_ctx); +void gen_perf_snapshot_statistics_registers(void *context, + struct gen_perf_config *perf, + struct gen_perf_query_object *obj, + uint32_t offset_in_bytes); #endif /* GEN_PERF_H */ diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c index 08c1db1b1bc..11c2111e2ba 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -243,31 +243,6 @@ brw_get_perf_counter_info(struct gl_context *ctx, *raw_max = counter->raw_max; } -/******************************************************************************/ - -/** - * Emit MI_STORE_REGISTER_MEM commands to capture all of the - * pipeline statistics for the performance query object. - */ -static void -snapshot_statistics_registers(struct brw_context *brw, - struct gen_perf_query_object *obj, - uint32_t offset_in_bytes) -{ - const struct gen_perf_query_info *query = obj->queryinfo; - const int n_counters = query->n_counters; - - for (int i = 0; i < n_counters; i++) { - const struct gen_perf_query_counter *counter = &query->counters[i]; - - assert(counter->data_type == GEN_PERF_COUNTER_DATA_TYPE_UINT64); - - brw->perf_ctx.perf->vtbl.store_register_mem64(brw, obj->pipeline_stats.bo, - counter->pipeline_stat.reg, - offset_in_bytes + i * sizeof(uint64_t)); - } -} - /** * Add a query to the global list of "unaccumulated queries." * @@ -981,7 +956,7 @@ brw_begin_perf_query(struct gl_context *ctx, STATS_BO_SIZE); /* Take starting snapshots. */ - snapshot_statistics_registers(brw, obj, 0); + gen_perf_snapshot_statistics_registers(brw, perf_cfg, obj, 0); ++brw->perf_ctx.n_active_pipeline_stats_queries; break; @@ -1046,8 +1021,8 @@ brw_end_perf_query(struct gl_context *ctx, break; case GEN_PERF_QUERY_TYPE_PIPELINE: - snapshot_statistics_registers(brw, obj, - STATS_BO_END_OFFSET_BYTES); + gen_perf_snapshot_statistics_registers(brw, perf_cfg, obj, + STATS_BO_END_OFFSET_BYTES); --brw->perf_ctx.n_active_pipeline_stats_queries; break; -- 2.30.2