2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #ifndef BRW_PERFORMANCE_QUERY_H
25 #define BRW_PERFORMANCE_QUERY_H
29 #include "brw_context.h"
31 struct gen_perf_query_info
;
34 * When currently allocate only one page for pipeline statistics queries. Here
35 * we derived the maximum number of counters for that amount.
37 #define STATS_BO_SIZE 4096
38 #define STATS_BO_END_OFFSET_BYTES (STATS_BO_SIZE / 2)
39 #define MAX_STAT_COUNTERS (STATS_BO_END_OFFSET_BYTES / 8)
42 * The largest OA formats we can use include:
44 * 1 timestamp, 45 A counters, 8 B counters and 8 C counters.
46 * 1 timestamp, 1 clock, 36 A counters, 8 B counters and 8 C counters
48 #define MAX_OA_REPORT_COUNTERS 62
51 * i965 representation of a performance query object.
53 * NB: We want to keep this structure relatively lean considering that
54 * applications may expect to allocate enough objects to be able to
55 * query around all draw calls in a frame.
57 struct brw_perf_query_object
59 struct gl_perf_query_object base
;
61 const struct gen_perf_query_info
*query
;
63 /* See query->kind to know which state below is in use... */
68 * BO containing OA counter snapshots at query Begin/End time.
73 * Address of mapped of @bo
78 * The MI_REPORT_PERF_COUNT command lets us specify a unique
79 * ID that will be reflected in the resulting OA report
80 * that's written by the GPU. This is the ID we're expecting
81 * in the begin report and the the end report should be
82 * @begin_report_id + 1.
87 * Reference the head of the brw->perfquery.sample_buffers
88 * list at the time that the query started (so we only need
89 * to look at nodes after this point when looking for samples
90 * related to this query)
92 * (See struct brw_oa_sample_buf description for more details)
94 struct exec_node
*samples_head
;
97 * Storage for the final accumulated OA counters.
99 uint64_t accumulator
[MAX_OA_REPORT_COUNTERS
];
102 * Hw ID used by the context on which the query was running.
107 * false while in the unaccumulated_elements list, and set to
108 * true when the final, end MI_RPC snapshot has been
111 bool results_accumulated
;
114 * Number of reports accumulated to produce the results.
116 uint32_t reports_accumulated
;
119 * Frequency of the GT at begin and end of the query.
121 uint64_t gt_frequency
[2];
124 * Frequency in the slices of the GT at the begin and end of the
127 uint64_t slice_frequency
[2];
130 * Frequency in the unslice of the GT at the begin and end of the
133 uint64_t unslice_frequency
[2];
138 * BO containing starting and ending snapshots for the
139 * statistics counters.
146 int brw_perf_query_get_mdapi_oa_data(struct brw_context
*brw
,
147 struct brw_perf_query_object
*obj
,
150 void brw_perf_query_register_mdapi_oa_query(struct brw_context
*brw
);
151 void brw_perf_query_register_mdapi_statistic_query(struct brw_context
*brw
);
153 #endif /* BRW_PERFORMANCE_QUERY_H */