intel/perf: move get_free_sample_buf into perf
authorMark Janes <mark.a.janes@intel.com>
Fri, 31 May 2019 01:30:25 +0000 (18:30 -0700)
committerMark Janes <mark.a.janes@intel.com>
Thu, 8 Aug 2019 04:33:55 +0000 (21:33 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/perf/gen_perf.c
src/intel/perf/gen_perf.h
src/mesa/drivers/dri/i965/brw_performance_query.c

index 76fe725e3b13b1dcd1e8e145d2016f15977abaea..131fe34abe34f199c067f692b3d0ac816bb0255a 100644 (file)
@@ -824,3 +824,22 @@ gen_perf_query_get_metric_id(struct gen_perf_config *perf,
    }
    return query->oa_metrics_set_id;
 }
+
+struct oa_sample_buf *
+gen_perf_get_free_sample_buf(struct gen_perf_context *perf_ctx)
+{
+   struct exec_node *node = exec_list_pop_head(&perf_ctx->free_sample_buffers);
+   struct oa_sample_buf *buf;
+
+   if (node)
+      buf = exec_node_data(struct oa_sample_buf, node, link);
+   else {
+      buf = ralloc_size(perf_ctx->perf, sizeof(*buf));
+
+      exec_node_init(&buf->link);
+      buf->refcount = 0;
+      buf->len = 0;
+   }
+
+   return buf;
+}
index a759de1fed519881602d01f31543e081dec07e20..05865b8f8129ab37a69f0fac8909a5bc93d699a4 100644 (file)
@@ -504,6 +504,7 @@ void gen_perf_query_register_mdapi_oa_query(const struct gen_device_info *devinf
                                             struct gen_perf_config *perf);
 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);
 
 
 #endif /* GEN_PERF_H */
index 38b8a053377b4a6d241e1c5e8df9f57ab0a68c0b..cb3bebfc743132aa21f8bef39e712b766e6629b4 100644 (file)
@@ -146,25 +146,6 @@ dump_perf_queries(struct brw_context *brw)
 
 /******************************************************************************/
 
-static struct oa_sample_buf *
-get_free_sample_buf(struct brw_context *brw)
-{
-   struct exec_node *node = exec_list_pop_head(&brw->perf_ctx.free_sample_buffers);
-   struct oa_sample_buf *buf;
-
-   if (node)
-      buf = exec_node_data(struct oa_sample_buf, node, link);
-   else {
-      buf = ralloc_size(brw, sizeof(*buf));
-
-      exec_node_init(&buf->link);
-      buf->refcount = 0;
-      buf->len = 0;
-   }
-
-   return buf;
-}
-
 static void
 reap_old_sample_buffers(struct brw_context *brw)
 {
@@ -451,7 +432,7 @@ read_oa_samples_until(struct brw_context *brw,
    uint32_t last_timestamp = tail_buf->last_timestamp;
 
    while (1) {
-      struct oa_sample_buf *buf = get_free_sample_buf(brw);
+      struct oa_sample_buf *buf = gen_perf_get_free_sample_buf(&brw->perf_ctx);
       uint32_t offset;
       int len;
 
@@ -1647,7 +1628,7 @@ brw_init_perf_query_info(struct gl_context *ctx)
     * Begin an OA query we can always take a reference on a buffer
     * in this list.
     */
-   struct oa_sample_buf *buf = get_free_sample_buf(brw);
+   struct oa_sample_buf *buf = gen_perf_get_free_sample_buf(&brw->perf_ctx);
    exec_list_push_head(&brw->perf_ctx.sample_buffers, &buf->link);
 
    brw->perf_ctx.oa_stream_fd = -1;