#include "util/mesa-sha1.h"
-struct gen_perf_config *
-anv_get_perf(const struct gen_device_info *devinfo, int fd)
+void
+anv_physical_device_init_perf(struct anv_physical_device *device, int fd)
{
+ const struct gen_device_info *devinfo = &device->info;
+
+ device->perf = NULL;
+
/* We need self modifying batches. The i915 parser prevents it on
* Gen7.5 :( maybe one day.
*/
if (devinfo->gen < 8)
- return NULL;
+ return;
struct gen_perf_config *perf = gen_perf_new(NULL);
- gen_perf_init_metrics(perf, devinfo, fd, false /* pipeline statistics */);
+ gen_perf_init_metrics(perf, &device->info, fd, false /* pipeline statistics */);
if (!perf->n_queries) {
if (perf->platform_supported)
goto err;
}
- return perf;
+ device->perf = perf;
+
+ /* Compute the number of commands we need to implement a performance
+ * query.
+ */
+ const struct gen_perf_query_field_layout *layout = &perf->query_layout;
+ device->n_perf_query_commands = 0;
+ for (uint32_t f = 0; f < layout->n_fields; f++) {
+ struct gen_perf_query_field *field = &layout->fields[f];
+
+ switch (field->type) {
+ case GEN_PERF_QUERY_FIELD_TYPE_MI_RPC:
+ device->n_perf_query_commands++;
+ break;
+ case GEN_PERF_QUERY_FIELD_TYPE_SRM_PERFCNT:
+ case GEN_PERF_QUERY_FIELD_TYPE_SRM_RPSTAT:
+ case GEN_PERF_QUERY_FIELD_TYPE_SRM_OA_B:
+ case GEN_PERF_QUERY_FIELD_TYPE_SRM_OA_C:
+ device->n_perf_query_commands += field->size / 4;
+ break;
+ }
+ }
+ device->n_perf_query_commands *= 2; /* Begin & End */
+ device->n_perf_query_commands += 1; /* availability */
+
+ return;
err:
ralloc_free(perf);
- return NULL;
}
void
struct brw_compiler * compiler;
struct isl_device isl_dev;
struct gen_perf_config * perf;
+ /*
+ * Number of commands required to implement a performance query begin +
+ * end.
+ */
+ uint32_t n_perf_query_commands;
int cmd_parser_version;
bool has_softpin;
bool has_exec_async;
uint64_t config_id;
};
-struct gen_perf_config *anv_get_perf(const struct gen_device_info *devinfo, int fd);
+void anv_physical_device_init_perf(struct anv_physical_device *device, int fd);
void anv_device_perf_init(struct anv_device *device);
void anv_perf_write_pass_results(struct gen_perf_config *perf,
struct anv_query_pool *pool, uint32_t pass,