diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2019-06-05 11:20:23 +0300 |
---|---|---|
committer | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2019-06-21 19:43:14 +0000 |
commit | 77074659c58f9759e4c3599f02d21355d31b2aa6 (patch) | |
tree | 466937b3a77cd30b6efe527b78e88376010cd5ca | |
parent | 5375846e8d1ea643c13d5809dba55c68f6a9440b (diff) |
intel/perf: improve dynamic loading config detection
We're currently trying to detect dynamic loading config support by
trying to remove to test config (hard coded in the i915 driver) and
checking we get ENOENT.
This can fail if the test config was updated in Mesa but not yet in
i915.
A better way to do this is to pick an invalid ID and check for ENOENT.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit c1621274401b4bd2de7db1f7a813f6bfce8307f8)
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_performance_query.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c index c10108f38f3..dfbf9759f5b 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -1848,23 +1848,10 @@ static bool kernel_has_dynamic_config_support(struct brw_context *brw) { __DRIscreen *screen = brw->screen->driScrnPriv; + uint64_t invalid_config_id = UINT64_MAX; - hash_table_foreach(brw->perfquery.oa_metrics_table, entry) { - struct brw_perf_query_info *query = entry->data; - char config_path[280]; - uint64_t config_id; - - snprintf(config_path, sizeof(config_path), "%s/metrics/%s/id", - brw->perfquery.sysfs_dev_dir, query->guid); - - /* Look for the test config, which we know we can't replace. */ - if (read_file_uint64(config_path, &config_id) && config_id == 1) { - return drmIoctl(screen->fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG, - &config_id) < 0 && errno == ENOENT; - } - } - - return false; + return drmIoctl(screen->fd, DRM_IOCTL_I915_PERF_REMOVE_CONFIG, + &invalid_config_id) < 0 && errno == ENOENT; } static void |