Lines Matching refs:query

58  * results of an OA metrics query we need to consider all the periodic
76 * These nodes may hold samples for query A:
79 * These nodes may hold samples for query B:
82 * These nodes may hold samples for query C:
108 * When a query starts we take a reference on the current tail of
110 * relate to the newly-started query. A pointer to this node is
111 * also saved in the query object's ->oa.samples_head.
113 * E.g. starting query A while there are two nodes in .sample_buffers:
121 * Moving forward to when the B query starts with no new buffer nodes:
131 * Once a query is finished, after an OA query has become 'Ready',
136 * So when the B query has finished we have:
146 * When the A query finishes: (note there's a new ref for C's samples_head)
159 * query by iterating the sample_buffers list from the head until we
175 * gen representation of a performance query object.
179 * query around all draw calls in a frame.
185 /* See query->kind to know which state below is in use... */
190 * BO containing OA counter snapshots at query Begin/End time.
210 * list at the time that the query started (so we only need
212 * related to this query)
226 * Accumulated OA results between begin and end of the query.
299 /* The total number of query objects so we can relinquish
340 const struct intel_perf_query_info *query)
346 if (query && query->kind == INTEL_PERF_QUERY_TYPE_RAW) {
348 (struct intel_perf_query_info *) query;
427 const struct intel_perf_query_info *query)
430 * loaded upon the first query creation. No need to look them up again.
432 if (query->kind == INTEL_PERF_QUERY_TYPE_OA)
433 return query->oa_metrics_set_id;
435 assert(query->kind == INTEL_PERF_QUERY_TYPE_RAW);
438 * When a raw query is used for the first time it's id is set to a value !=
442 if (query->oa_metrics_set_id != 0) {
443 DBG("Raw query '%s' guid=%s using cached ID: %"PRIu64"\n",
444 query->name, query->guid, query->oa_metrics_set_id);
445 return query->oa_metrics_set_id;
448 struct intel_perf_query_info *raw_query = (struct intel_perf_query_info *)query;
449 if (!intel_perf_load_metric_id(perf, query->guid,
451 DBG("Unable to read query guid=%s ID, falling back to test config\n", query->guid);
454 DBG("Raw query '%s'guid=%s loaded ID: %"PRIu64"\n",
455 query->name, query->guid, query->oa_metrics_set_id);
457 return query->oa_metrics_set_id;
490 * a new query.
517 const struct intel_perf_query_info *query =
520 switch (query->kind) {
536 obj->queryinfo = query;
544 const struct intel_perf_query_info *query)
548 switch (query->kind) {
559 unreachable("Unknown query type");
565 intel_perf_query_info(const struct intel_perf_query_object *query)
567 return query->queryinfo;
613 * Begin an OA query we can always take a reference on a buffer
677 * Add a query to the global list of "unaccumulated queries."
681 * MI_REPORT_PERF_COUNT has landed in query->oa.bo.
702 * pipeline statistics for the performance query object.
710 const struct intel_perf_query_info *query = obj->queryinfo;
711 const int n_counters = query->n_counters;
714 const struct intel_perf_query_counter *counter = &query->counters[i];
726 struct intel_perf_query_object *query,
739 perf_cfg->vtbl.emit_mi_report_perf_count(perf_ctx->ctx, query->oa.bo,
741 query->oa.begin_report_id +
749 perf_cfg->vtbl.store_register_mem(perf_ctx->ctx, query->oa.bo,
761 struct intel_perf_query_object *query)
764 const struct intel_perf_query_info *queryinfo = query->queryinfo;
795 * are generally invisible to the query results. Whether that's a good or a
847 if (query->oa.bo) {
848 perf_cfg->vtbl.bo_unreference(query->oa.bo);
849 query->oa.bo = NULL;
852 query->oa.bo = perf_cfg->vtbl.bo_alloc(perf_ctx->bufmgr,
853 "perf. query OA MI_RPC bo",
857 void *map = perf_cfg->vtbl.bo_map(perf_ctx->ctx, query->oa.bo, MAP_WRITE);
859 perf_cfg->vtbl.bo_unmap(query->oa.bo);
862 query->oa.begin_report_id = perf_ctx->next_query_start_report_id;
865 snapshot_query_layout(perf_ctx, query, false /* end_snapshot */);
869 /* No already-buffered samples can possibly be associated with this query
871 * easily ignore earlier samples when processing this query after
875 query->oa.samples_head = exec_list_get_tail(&perf_ctx->sample_buffers);
878 exec_node_data(struct oa_sample_buf, query->oa.samples_head, link);
881 * buffers (that may relate to this query) can't be freed until
886 intel_perf_query_result_clear(&query->oa.result);
887 query->oa.results_accumulated = false;
889 add_to_unaccumulated_query_list(perf_ctx, query);
894 if (query->pipeline_stats.bo) {
895 perf_cfg->vtbl.bo_unreference(query->pipeline_stats.bo);
896 query->pipeline_stats.bo = NULL;
899 query->pipeline_stats.bo =
901 "perf. query pipeline stats bo",
905 snapshot_statistics_registers(perf_ctx, query, 0);
911 unreachable("Unknown query type");
920 struct intel_perf_query_object *query)
925 * finished before taking our query end counter readings.
932 switch (query->queryinfo->kind) {
936 /* NB: It's possible that the query will have already been marked
941 if (!query->oa.results_accumulated)
942 snapshot_query_layout(perf_ctx, query, true /* end_snapshot */);
946 /* NB: even though the query has now ended, it can't be accumulated
948 * to query->oa.bo
953 snapshot_statistics_registers(perf_ctx, query,
959 unreachable("Unknown query type");
1070 struct intel_perf_query_object *query,
1080 assert(!perf_cfg->vtbl.batch_references(current_batch, query->oa.bo) &&
1081 !perf_cfg->vtbl.bo_busy(query->oa.bo));
1085 if (query->oa.map == NULL)
1086 query->oa.map = perf_cfg->vtbl.bo_map(perf_ctx->ctx, query->oa.bo, MAP_READ);
1088 start = last = query->oa.map;
1089 end = query->oa.map + perf_ctx->perf->query_layout.size;
1091 if (start[0] != query->oa.begin_report_id) {
1095 if (end[0] != (query->oa.begin_report_id + 1)) {
1116 struct intel_perf_query_object *query,
1122 switch (query->queryinfo->kind) {
1125 bo = query->oa.bo;
1129 bo = query->pipeline_stats.bo;
1133 unreachable("Unknown query type");
1151 struct intel_perf_query_object *query,
1156 switch (query->queryinfo->kind) {
1159 return (query->oa.results_accumulated ||
1160 (query->oa.bo &&
1161 !perf_cfg->vtbl.batch_references(current_batch, query->oa.bo) &&
1162 !perf_cfg->vtbl.bo_busy(query->oa.bo)));
1165 return (query->pipeline_stats.bo &&
1166 !perf_cfg->vtbl.batch_references(current_batch, query->pipeline_stats.bo) &&
1167 !perf_cfg->vtbl.bo_busy(query->pipeline_stats.bo));
1170 unreachable("Unknown query type");
1178 * Remove a query from the global list of unaccumulated queries once
1180 * query in accumulate_oa_reports() or when discarding unwanted query
1185 struct intel_perf_query_object *query)
1188 if (perf_ctx->unaccumulated[i] == query) {
1208 exec_node_data(struct oa_sample_buf, query->oa.samples_head, link);
1213 query->oa.samples_head = NULL;
1219 * we don't try and continue accumulating the current query, hoping
1227 struct intel_perf_query_object *query = perf_ctx->unaccumulated[0];
1229 query->oa.results_accumulated = true;
1230 drop_from_unaccumulated_query_list(perf_ctx, query);
1256 * duration of the query.
1267 struct intel_perf_query_object *query)
1277 assert(query->oa.map != NULL);
1279 start = last = query->oa.map;
1280 end = query->oa.map + perf_ctx->perf->query_layout.size;
1282 if (start[0] != query->oa.begin_report_id) {
1286 if (end[0] != (query->oa.begin_report_id + 1)) {
1301 /* N.B. The oa.samples_head was set when the query began and
1303 * the time the query started. Since the buffer existed before the
1306 * associated with the query - so skip ahead one...
1308 first_samples_node = query->oa.samples_head->next;
1384 intel_perf_query_result_accumulate(&query->oa.result,
1385 query->queryinfo,
1390 * query was split.
1392 query->oa.result.query_disjoint = true;
1413 intel_perf_query_result_accumulate(&query->oa.result, query->queryinfo,
1416 query->oa.results_accumulated = true;
1417 drop_from_unaccumulated_query_list(perf_ctx, query);
1429 struct intel_perf_query_object *query)
1433 /* We can assume that the frontend waits for a query to complete
1435 * deleting an in-flight query object.
1437 switch (query->queryinfo->kind) {
1440 if (query->oa.bo) {
1441 if (!query->oa.results_accumulated) {
1442 drop_from_unaccumulated_query_list(perf_ctx, query);
1446 perf_cfg->vtbl.bo_unreference(query->oa.bo);
1447 query->oa.bo = NULL;
1450 query->oa.results_accumulated = false;
1454 if (query->pipeline_stats.bo) {
1455 perf_cfg->vtbl.bo_unreference(query->pipeline_stats.bo);
1456 query->pipeline_stats.bo = NULL;
1461 unreachable("Unknown query type");
1471 intel_perf_close(perf_ctx, query->queryinfo);
1474 free(query);
1479 struct intel_perf_query_object *query,
1484 const struct intel_perf_query_info *queryinfo = query->queryinfo;
1500 &query->oa.result);
1506 &query->oa.result);
1523 struct intel_perf_query_object *query,
1529 const struct intel_perf_query_info *queryinfo = query->queryinfo;
1533 uint64_t *start = perf_cfg->vtbl.bo_map(perf_ctx->ctx, query->pipeline_stats.bo, MAP_READ);
1550 perf_cfg->vtbl.bo_unmap(query->pipeline_stats.bo);
1557 struct intel_perf_query_object *query,
1566 switch (query->queryinfo->kind) {
1569 if (!query->oa.results_accumulated) {
1571 * driver, there can be a 5ms delay between the Mesa seeing the query
1578 while (!read_oa_samples_for_query(perf_ctx, query, current_batch))
1581 uint32_t *begin_report = query->oa.map;
1582 uint32_t *end_report = query->oa.map + perf_cfg->query_layout.size;
1583 intel_perf_query_result_accumulate_fields(&query->oa.result,
1584 query->queryinfo,
1588 accumulate_oa_reports(perf_ctx, query);
1589 assert(query->oa.results_accumulated);
1591 perf_cfg->vtbl.bo_unmap(query->oa.bo);
1592 query->oa.map = NULL;
1594 if (query->queryinfo->kind == INTEL_PERF_QUERY_TYPE_OA) {
1595 written = get_oa_counter_data(perf_ctx, query, data_size, (uint8_t *)data);
1600 devinfo, query->queryinfo,
1601 &query->oa.result);
1606 written = get_pipeline_stats_data(perf_ctx, query, data_size, (uint8_t *)data);
1610 unreachable("Unknown query type");
1643 unreachable("Unknown query type");