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:
@@ -563,11 +563,12 @@ anv_physical_device_try_create(struct anv_instance *instance,
|
|||||||
}
|
}
|
||||||
device->master_fd = master_fd;
|
device->master_fd = master_fd;
|
||||||
|
|
||||||
|
device->engine_info = anv_gem_get_engine_info(fd);
|
||||||
anv_physical_device_init_queue_families(device);
|
anv_physical_device_init_queue_families(device);
|
||||||
|
|
||||||
result = anv_init_wsi(device);
|
result = anv_init_wsi(device);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
goto fail_disk_cache;
|
goto fail_engine_info;
|
||||||
|
|
||||||
device->perf = anv_get_perf(&device->info, fd);
|
device->perf = anv_get_perf(&device->info, fd);
|
||||||
|
|
||||||
@@ -581,7 +582,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
|
|||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
|
||||||
fail_disk_cache:
|
fail_engine_info:
|
||||||
|
free(device->engine_info);
|
||||||
anv_physical_device_free_disk_cache(device);
|
anv_physical_device_free_disk_cache(device);
|
||||||
fail_compiler:
|
fail_compiler:
|
||||||
ralloc_free(device->compiler);
|
ralloc_free(device->compiler);
|
||||||
@@ -598,6 +600,7 @@ static void
|
|||||||
anv_physical_device_destroy(struct anv_physical_device *device)
|
anv_physical_device_destroy(struct anv_physical_device *device)
|
||||||
{
|
{
|
||||||
anv_finish_wsi(device);
|
anv_finish_wsi(device);
|
||||||
|
free(device->engine_info);
|
||||||
anv_physical_device_free_disk_cache(device);
|
anv_physical_device_free_disk_cache(device);
|
||||||
ralloc_free(device->compiler);
|
ralloc_free(device->compiler);
|
||||||
ralloc_free(device->perf);
|
ralloc_free(device->perf);
|
||||||
|
|||||||
@@ -681,3 +681,25 @@ anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
|||||||
*buffer_len = item.length;
|
*buffer_len = item.length;
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -252,6 +252,12 @@ anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
|||||||
unreachable("Unused");
|
unreachable("Unused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct drm_i915_query_engine_info *
|
||||||
|
anv_gem_get_engine_info(int fd)
|
||||||
|
{
|
||||||
|
unreachable("Unused");
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
anv_gem_syncobj_wait(struct anv_device *device,
|
anv_gem_syncobj_wait(struct anv_device *device,
|
||||||
const uint32_t *handles, uint32_t num_handles,
|
const uint32_t *handles, uint32_t num_handles,
|
||||||
|
|||||||
@@ -1162,6 +1162,7 @@ struct anv_physical_device {
|
|||||||
struct wsi_device wsi_device;
|
struct wsi_device wsi_device;
|
||||||
int local_fd;
|
int local_fd;
|
||||||
int master_fd;
|
int master_fd;
|
||||||
|
struct drm_i915_query_engine_info * engine_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_app_info {
|
struct anv_app_info {
|
||||||
@@ -1662,6 +1663,7 @@ int anv_gem_syncobj_timeline_query(struct anv_device *device,
|
|||||||
uint32_t num_items);
|
uint32_t num_items);
|
||||||
int anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
int anv_i915_query(int fd, uint64_t query_id, void *buffer,
|
||||||
int32_t *buffer_len);
|
int32_t *buffer_len);
|
||||||
|
struct drm_i915_query_engine_info *anv_gem_get_engine_info(int fd);
|
||||||
|
|
||||||
uint64_t anv_vma_alloc(struct anv_device *device,
|
uint64_t anv_vma_alloc(struct anv_device *device,
|
||||||
uint64_t size, uint64_t align,
|
uint64_t size, uint64_t align,
|
||||||
|
|||||||
Reference in New Issue
Block a user