intel/perf: move is_query_ready to gen_perf
[mesa.git] / src / intel / perf / gen_perf.h
index 0f2fdc9d9f67811951ae83e0095be93bcfe18cca..efb884afe36f770f2359db7ebae581b698484f6b 100644 (file)
@@ -219,6 +219,9 @@ struct gen_perf_config {
       void (*bo_unreference)(void *bo);
       void *(*bo_map)(void *ctx, void *bo, unsigned flags);
       void (*bo_unmap)(void *bo);
+      bool (*batch_references)(void *batch, void *bo);
+      void (*bo_wait_rendering)(void *bo);
+      int (*bo_busy)(void *bo);
       void (*emit_mi_flush)(void *ctx);
       void (*emit_mi_report_perf_count)(void *ctx,
                                         void *bo,
@@ -428,6 +431,13 @@ struct gen_perf_query_object
 struct gen_perf_context {
    struct gen_perf_config *perf;
 
+   void * ctx;  /* driver context (eg, brw_context) */
+   void * bufmgr;
+   const struct gen_device_info *devinfo;
+
+   uint32_t hw_ctx;
+   int drm_fd;
+
    /* The i915 perf stream we open to setup + enable the OA counters */
    int oa_stream_fd;
 
@@ -483,6 +493,14 @@ struct gen_perf_context {
    int n_query_instances;
 };
 
+void gen_perf_init_context(struct gen_perf_context *perf_ctx,
+                           struct gen_perf_config *perf_cfg,
+                           void * ctx,  /* driver context (eg, brw_context) */
+                           void * bufmgr,  /* eg brw_bufmgr */
+                           const struct gen_device_info *devinfo,
+                           uint32_t hw_ctx,
+                           int drm_fd);
+
 static inline size_t
 gen_perf_query_counter_get_size(const struct gen_perf_query_counter *counter)
 {
@@ -602,4 +620,15 @@ bool gen_perf_open(struct gen_perf_context *perfquery,
 bool gen_perf_inc_n_users(struct gen_perf_context *perfquery);
 void gen_perf_dec_n_users(struct gen_perf_context *perfquery);
 
+bool gen_perf_begin_query(struct gen_perf_context *perf_ctx,
+                          struct gen_perf_query_object *query);
+void gen_perf_end_query(struct gen_perf_context *perf_ctx,
+                        struct gen_perf_query_object *query);
+void gen_perf_wait_query(struct gen_perf_context *perf_ctx,
+                         struct gen_perf_query_object *query,
+                         void *current_batch);
+bool gen_perf_is_query_ready(struct gen_perf_context *perf_ctx,
+                             struct gen_perf_query_object *query,
+                             void *current_batch);
+
 #endif /* GEN_PERF_H */