perf->sysfs_dev_dir[0] = '\0';
+ if (unlikely(INTEL_DEBUG & DEBUG_NO_OACONFIG))
+ return true;
+
if (fstat(fd, &sb)) {
DBG("Failed to stat DRM fd\n");
return false;
closedir(metricsdir);
}
+static void
+add_all_metrics(struct gen_perf_config *perf,
+ const struct gen_device_info *devinfo)
+{
+ hash_table_foreach(perf->oa_metrics_table, entry) {
+ const struct gen_perf_query_info *query = entry->data;
+ register_oa_config(perf, devinfo, query, 0);
+ }
+}
+
static bool
kernel_has_dynamic_config_support(struct gen_perf_config *perf, int fd)
{
{
uint64_t min_freq_mhz = 0, max_freq_mhz = 0;
- if (!read_sysfs_drm_device_file_uint64(perf, "gt_min_freq_mhz", &min_freq_mhz))
- return false;
+ if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) {
+ if (!read_sysfs_drm_device_file_uint64(perf, "gt_min_freq_mhz", &min_freq_mhz))
+ return false;
- if (!read_sysfs_drm_device_file_uint64(perf, "gt_max_freq_mhz", &max_freq_mhz))
- return false;
+ if (!read_sysfs_drm_device_file_uint64(perf, "gt_max_freq_mhz", &max_freq_mhz))
+ return false;
+ } else {
+ min_freq_mhz = 300;
+ max_freq_mhz = 1000;
+ }
memset(&perf->sys_vars, 0, sizeof(perf->sys_vars));
perf->sys_vars.gt_min_freq = min_freq_mhz * 1000000;
*/
oa_register(perf);
- if (likely((INTEL_DEBUG & DEBUG_NO_OACONFIG) == 0) &&
- kernel_has_dynamic_config_support(perf, fd))
- init_oa_configs(perf, fd, devinfo);
- else
- enumerate_sysfs_metrics(perf, devinfo);
+ if (likely(!(INTEL_DEBUG & DEBUG_NO_OACONFIG))) {
+ if (kernel_has_dynamic_config_support(perf, fd))
+ init_oa_configs(perf, fd, devinfo);
+ else
+ enumerate_sysfs_metrics(perf, devinfo);
+ } else {
+ add_all_metrics(perf, devinfo);
+ }
build_unique_counter_list(perf);
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;
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;
}
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;
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;
{
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;
}