diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2020-09-15 11:22:17 +0300 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-02-02 13:25:55 +0000 |
commit | 76bba61e0be7c0e4448e3a4bd732e1e62645843d (patch) | |
tree | 15d8919f440b3768a2ee8411c26e6e5e10fd5ed1 /src/intel | |
parent | 185df6ac9cfb8cad9c925bfba249f8479890cdad (diff) |
anv: compute commands required to implement perf queries
We'll use this later to try to limit the number of NOOPs emitted for
self modifying batches.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6518>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 2 | ||||
-rw-r--r-- | src/intel/vulkan/anv_perf.c | 40 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 7 |
3 files changed, 41 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 0332471f56f..037641ae690 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -603,7 +603,7 @@ anv_physical_device_try_create(struct anv_instance *instance, if (result != VK_SUCCESS) goto fail_engine_info; - device->perf = anv_get_perf(&device->info, fd); + anv_physical_device_init_perf(device, fd); anv_measure_device_init(device); diff --git a/src/intel/vulkan/anv_perf.c b/src/intel/vulkan/anv_perf.c index 35bd2468f67..1a80793e571 100644 --- a/src/intel/vulkan/anv_perf.c +++ b/src/intel/vulkan/anv_perf.c @@ -33,18 +33,22 @@ #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) @@ -61,11 +65,35 @@ anv_get_perf(const struct gen_device_info *devinfo, int fd) 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 diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 5fd4582a1cd..1775236b339 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -991,6 +991,11 @@ struct anv_physical_device { 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; @@ -4432,7 +4437,7 @@ struct anv_performance_configuration_intel { 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, |