diff options
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/perf/gen_perf.c | 28 | ||||
-rw-r--r-- | src/intel/perf/gen_perf.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/intel/perf/gen_perf.c b/src/intel/perf/gen_perf.c index c051d064bd6..fe5bbabe3c8 100644 --- a/src/intel/perf/gen_perf.c +++ b/src/intel/perf/gen_perf.c @@ -1501,3 +1501,31 @@ gen_perf_wait_query(struct gen_perf_context *perf_ctx, ; } } + +bool +gen_perf_is_query_ready(struct gen_perf_context *perf_ctx, + struct gen_perf_query_object *query, + void *current_batch) +{ + struct gen_perf_config *perf_cfg = perf_ctx->perf; + + switch (query->queryinfo->kind) { + case GEN_PERF_QUERY_TYPE_OA: + case GEN_PERF_QUERY_TYPE_RAW: + return (query->oa.results_accumulated || + (query->oa.bo && + !perf_cfg->vtbl.batch_references(current_batch, query->oa.bo) && + !perf_cfg->vtbl.bo_busy(query->oa.bo) && + read_oa_samples_for_query(perf_ctx, query, current_batch))); + case GEN_PERF_QUERY_TYPE_PIPELINE: + return (query->pipeline_stats.bo && + !perf_cfg->vtbl.batch_references(current_batch, query->pipeline_stats.bo) && + !perf_cfg->vtbl.bo_busy(query->pipeline_stats.bo)); + + default: + unreachable("Unknown query type"); + break; + } + + return false; +} diff --git a/src/intel/perf/gen_perf.h b/src/intel/perf/gen_perf.h index 597fb1028ea..efb884afe36 100644 --- a/src/intel/perf/gen_perf.h +++ b/src/intel/perf/gen_perf.h @@ -627,5 +627,8 @@ void gen_perf_end_query(struct gen_perf_context *perf_ctx, 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 */ |