anv: Gather engine info from i915 if available

v2 (Jason Ekstrand):
 - Don't take an anv_physical_device in anv_gem_get_engine_info()
 - Return the engine info from anv_gem_get_engine_info()
 - Free the engine info in anv_physical_device_destroy()

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8667>
This commit is contained in:
Jordan Justen
2019-03-23 00:28:24 -07:00
committed by Marge Bot
parent c0d07c838a
commit 5d84c764fd
4 changed files with 35 additions and 2 deletions

View File

@@ -681,3 +681,25 @@ anv_i915_query(int fd, uint64_t query_id, void *buffer,
*buffer_len = item.length;
return ret;
}
struct drm_i915_query_engine_info *
anv_gem_get_engine_info(int fd)
{
int32_t length = 0;
int ret = anv_i915_query(fd, DRM_I915_QUERY_ENGINE_INFO, NULL, &length);
assert(ret == 0);
if (ret == -1 && errno == EINVAL)
return NULL;
struct drm_i915_query_engine_info *info = calloc(1, length);
ret = anv_i915_query(fd, DRM_I915_QUERY_ENGINE_INFO, info, &length);
assert(ret == 0);
if (ret != 0) {
free(info);
return NULL;
}
return info;
}