diff options
author | Lionel Landwerlin <[email protected]> | 2020-04-06 10:42:22 +0300 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2020-05-20 14:02:27 +0300 |
commit | d0e11231a4fa7c7c4da2b4f9aed47a6000687f18 (patch) | |
tree | a28c6b9329009a52fbf1b1cf6d75beebeef6b5ca /src/intel/vulkan | |
parent | 2001a80d4a81f2e8194b29cca301dd1b27be9acb (diff) |
intel/perf: repurpose INTEL_DEBUG=no-oaconfig
We initially used this debug option to mean "don't bother registering
the OA configuration into the kernel".
This change makes this option suppress any interaction with the
i915/perf interface. This is useful when debugging self modifying
batches with performance queries while running on the intel_mi_runner.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2775>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_batch_chain.c | 5 | ||||
-rw-r--r-- | src/intel/vulkan/anv_perf.c | 63 |
2 files changed, 40 insertions, 28 deletions
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index f820a69ceec..acbc07816b1 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -1774,8 +1774,9 @@ anv_queue_execbuf_locked(struct anv_queue *queue, /* Some performance queries just the pipeline statistic HW, no need for * OA in that case, so no need to reconfigure. */ - if (query_info->kind == GEN_PERF_QUERY_TYPE_OA || - query_info->kind == GEN_PERF_QUERY_TYPE_RAW) { + if (likely((INTEL_DEBUG & DEBUG_NO_OACONFIG) == 0) && + (query_info->kind == GEN_PERF_QUERY_TYPE_OA || + query_info->kind == GEN_PERF_QUERY_TYPE_RAW)) { int ret = gen_ioctl(device->perf_fd, I915_PERF_IOCTL_CONFIG, (void *)(uintptr_t) query_info->oa_metrics_set_id); if (ret < 0) { diff --git a/src/intel/vulkan/anv_perf.c b/src/intel/vulkan/anv_perf.c index e8575b1bd70..ff47317fa68 100644 --- a/src/intel/vulkan/anv_perf.c +++ b/src/intel/vulkan/anv_perf.c @@ -180,18 +180,21 @@ VkResult anv_AcquirePerformanceConfigurationINTEL( VkPerformanceConfigurationINTEL* pConfiguration) { ANV_FROM_HANDLE(anv_device, device, _device); - - struct gen_perf_registers *perf_config = - gen_perf_load_configuration(device->physical->perf, device->fd, - GEN_PERF_QUERY_GUID_MDAPI); - if (!perf_config) - return VK_INCOMPLETE; - - int ret = gen_perf_store_configuration(device->physical->perf, device->fd, - perf_config, NULL /* guid */); - if (ret < 0) { - ralloc_free(perf_config); - return VK_INCOMPLETE; + int ret = -1; + + if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) { + struct gen_perf_registers *perf_config = + gen_perf_load_configuration(device->physical->perf, device->fd, + GEN_PERF_QUERY_GUID_MDAPI); + if (!perf_config) + return VK_INCOMPLETE; + + ret = gen_perf_store_configuration(device->physical->perf, device->fd, + perf_config, NULL /* guid */); + if (ret < 0) { + ralloc_free(perf_config); + return VK_INCOMPLETE; + } } *pConfiguration = (VkPerformanceConfigurationINTEL) (uint64_t) ret; @@ -206,7 +209,8 @@ VkResult anv_ReleasePerformanceConfigurationINTEL( ANV_FROM_HANDLE(anv_device, device, _device); uint64_t config = (uint64_t) _configuration; - gen_ioctl(device->fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG, &config); + if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) + gen_ioctl(device->fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG, &config); return VK_SUCCESS; } @@ -219,15 +223,17 @@ VkResult anv_QueueSetPerformanceConfigurationINTEL( struct anv_device *device = queue->device; uint64_t configuration = (uint64_t) _configuration; - if (device->perf_fd < 0) { - device->perf_fd = anv_device_perf_open(device, configuration); - if (device->perf_fd < 0) - return VK_ERROR_INITIALIZATION_FAILED; - } else { - int ret = gen_ioctl(device->perf_fd, I915_PERF_IOCTL_CONFIG, + if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) { + if (device->perf_fd < 0) { + device->perf_fd = anv_device_perf_open(device, configuration); + if (device->perf_fd < 0) + return VK_ERROR_INITIALIZATION_FAILED; + } else { + int ret = gen_ioctl(device->perf_fd, I915_PERF_IOCTL_CONFIG, (void *)(uintptr_t) _configuration); - if (ret < 0) - return anv_device_set_lost(device, "i915-perf config failed: %m"); + if (ret < 0) + return anv_device_set_lost(device, "i915-perf config failed: %m"); + } } return VK_SUCCESS; @@ -342,12 +348,15 @@ VkResult anv_AcquireProfilingLockKHR( ANV_FROM_HANDLE(anv_device, device, _device); struct gen_perf_config *perf = device->physical->perf; struct gen_perf_query_info *first_metric_set = &perf->queries[0]; + int fd = -1; assert(device->perf_fd == -1); - int fd = anv_device_perf_open(device, first_metric_set->oa_metrics_set_id); - if (fd < 0) - return VK_TIMEOUT; + if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) { + fd = anv_device_perf_open(device, first_metric_set->oa_metrics_set_id); + if (fd < 0) + return VK_TIMEOUT; + } device->perf_fd = fd; return VK_SUCCESS; @@ -358,8 +367,10 @@ void anv_ReleaseProfilingLockKHR( { ANV_FROM_HANDLE(anv_device, device, _device); - assert(device->perf_fd >= 0); - close(device->perf_fd); + if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) { + assert(device->perf_fd >= 0); + close(device->perf_fd); + } device->perf_fd = -1; } |