intel/perf: move close_perf into perf
authorMark Janes <mark.a.janes@intel.com>
Wed, 26 Jun 2019 18:43:20 +0000 (11:43 -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 f6e145627f5aa7f437c58946931ac0be48bebf53..99f9cd7e0976256353feec290757c0c74c92ca2a 100644 (file)
@@ -903,3 +903,18 @@ gen_perf_snapshot_statistics_registers(void *context,
                                       offset_in_bytes + i * sizeof(uint64_t));
    }
 }
+
+void
+gen_perf_close(struct gen_perf_context *perfquery,
+               const struct gen_perf_query_info *query)
+{
+   if (perfquery->oa_stream_fd != -1) {
+      close(perfquery->oa_stream_fd);
+      perfquery->oa_stream_fd = -1;
+   }
+   if (query->kind == GEN_PERF_QUERY_TYPE_RAW) {
+      struct gen_perf_query_info *raw_query =
+         (struct gen_perf_query_info *) query;
+      raw_query->oa_metrics_set_id = 0;
+   }
+}
index 6e69278ccdfd36d53d0008ab3996b338297587e9..a693ec3800fdce492ca08cbb02336602dc9e73da 100644 (file)
@@ -588,4 +588,7 @@ void gen_perf_snapshot_statistics_registers(void *context,
                                             struct gen_perf_query_object *obj,
                                             uint32_t offset_in_bytes);
 
+void gen_perf_close(struct gen_perf_context *perfquery,
+                    const struct gen_perf_query_info *query);
+
 #endif /* GEN_PERF_H */
index 770dcb4a9c6e0c5c3b52eef3b700f378c1e1b733..f4e62de3b7dd1c66fc447cffd333f62579ba0f67 100644 (file)
@@ -695,22 +695,6 @@ open_i915_perf_oa_stream(struct brw_context *brw,
    return true;
 }
 
-static void
-close_perf(struct brw_context *brw,
-           const struct gen_perf_query_info *query)
-{
-   struct gen_perf_context *perf_ctx = &brw->perf_ctx;
-   if (perf_ctx->oa_stream_fd != -1) {
-      close(perf_ctx->oa_stream_fd);
-      perf_ctx->oa_stream_fd = -1;
-   }
-   if (query->kind == GEN_PERF_QUERY_TYPE_RAW) {
-      struct gen_perf_query_info *raw_query =
-         (struct gen_perf_query_info *) query;
-      raw_query->oa_metrics_set_id = 0;
-   }
-}
-
 static void
 capture_frequency_stat_register(struct brw_context *brw,
                                 struct brw_bo *bo,
@@ -817,7 +801,7 @@ brw_begin_perf_query(struct gl_context *ctx,
                 o->Id, perf_ctx->current_oa_metrics_set_id, metric_id);
             return false;
          } else
-            close_perf(brw, query);
+            gen_perf_close(perf_ctx, query);
       }
 
       /* If the OA counters aren't already on, enable them. */
@@ -1384,7 +1368,7 @@ brw_delete_perf_query(struct gl_context *ctx,
     */
    if (--perf_ctx->n_query_instances == 0) {
       gen_perf_free_sample_bufs(perf_ctx);
-      close_perf(brw, obj->queryinfo);
+      gen_perf_close(perf_ctx, obj->queryinfo);
    }
 
    free(obj);