From 2f712d21b9913833462031c0a3c52bcf90046e15 Mon Sep 17 00:00:00 2001 From: Mark Janes Date: Mon, 3 Jun 2019 16:11:16 -0700 Subject: [PATCH] intel/perf: move reap_old_sample_buffers into perf Reviewed-by: Kenneth Graunke --- src/intel/perf/gen_perf.c | 24 +++++++++++++++++ src/intel/perf/gen_perf.h | 1 + .../drivers/dri/i965/brw_performance_query.c | 26 +------------------ 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c index 131fe34abe3..9df94512dc6 100644 --- a/src/intel/perf/gen_perf.c +++ b/src/intel/perf/gen_perf.c @@ -843,3 +843,27 @@ gen_perf_get_free_sample_buf(struct gen_perf_context *perf_ctx) return buf; } + +void +gen_perf_reap_old_sample_buffers(struct gen_perf_context *perf_ctx) +{ + struct exec_node *tail_node = + exec_list_get_tail(&perf_ctx->sample_buffers); + struct oa_sample_buf *tail_buf = + exec_node_data(struct oa_sample_buf, tail_node, link); + + /* Remove all old, unreferenced sample buffers walking forward from + * the head of the list, except always leave at least one node in + * the list so we always have a node to reference when we Begin + * a new query. + */ + foreach_list_typed_safe(struct oa_sample_buf, buf, link, + &perf_ctx->sample_buffers) + { + if (buf->refcount == 0 && buf != tail_buf) { + exec_node_remove(&buf->link); + exec_list_push_head(&perf_ctx->free_sample_buffers, &buf->link); + } else + return; + } +} diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h index 05865b8f812..a41414a662c 100644 --- a/src/intel/perf/gen_perf.h +++ b/src/intel/perf/gen_perf.h @@ -505,6 +505,7 @@ void gen_perf_query_register_mdapi_oa_query(const struct gen_device_info *devinf uint64_t gen_perf_query_get_metric_id(struct gen_perf_config *perf, const struct gen_perf_query_info *query); struct oa_sample_buf * gen_perf_get_free_sample_buf(struct gen_perf_context *perf); +void gen_perf_reap_old_sample_buffers(struct gen_perf_context *perf_ctx); #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 cb3bebfc743..f60f0317bf1 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -146,30 +146,6 @@ dump_perf_queries(struct brw_context *brw) /******************************************************************************/ -static void -reap_old_sample_buffers(struct brw_context *brw) -{ - struct exec_node *tail_node = - exec_list_get_tail(&brw->perf_ctx.sample_buffers); - struct oa_sample_buf *tail_buf = - exec_node_data(struct oa_sample_buf, tail_node, link); - - /* Remove all old, unreferenced sample buffers walking forward from - * the head of the list, except always leave at least one node in - * the list so we always have a node to reference when we Begin - * a new query. - */ - foreach_list_typed_safe(struct oa_sample_buf, buf, link, - &brw->perf_ctx.sample_buffers) - { - if (buf->refcount == 0 && buf != tail_buf) { - exec_node_remove(&buf->link); - exec_list_push_head(&brw->perf_ctx.free_sample_buffers, &buf->link); - } else - return; - } -} - static void free_sample_bufs(struct brw_context *brw) { @@ -363,7 +339,7 @@ drop_from_unaccumulated_query_list(struct brw_context *brw, obj->oa.samples_head = NULL; - reap_old_sample_buffers(brw); + gen_perf_reap_old_sample_buffers(&brw->perf_ctx); } static bool -- 2.30.2