mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
anv/hasvk: Add intel_perf_get_configuration_id() and replace intel_perf_load_configuration() usage
We have no usage of the information returned by intel_perf_load_configuration(). It is only used to add a copy of the configuration so we have the metric id but we could instead get the metric id from sysfs, that is added by mdapi. Xe KMD don't have a uAPI to query the metrics configuration, so using sysfs also fixes the integration of mdapi with Xe KMD. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Tested-by: Lukasz Stalmirski <lukasz.stalmirski@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32842>
This commit is contained in:
parent
5b39137ba0
commit
132bcbee74
4 changed files with 22 additions and 24 deletions
|
|
@ -788,6 +788,19 @@ intel_perf_load_configuration(struct intel_perf_config *perf_cfg, int fd, const
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
intel_perf_get_configuration_id(struct intel_perf_config *perf_cfg, const char *guid)
|
||||
{
|
||||
char path[512];
|
||||
uint64_t val;
|
||||
|
||||
snprintf(path, sizeof(path), "metrics/%s/id", guid);
|
||||
if (read_sysfs_drm_device_file_uint64(perf_cfg, path, &val))
|
||||
return val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
intel_perf_store_configuration(struct intel_perf_config *perf_cfg, int fd,
|
||||
const struct intel_perf_registers *config,
|
||||
|
|
|
|||
|
|
@ -572,6 +572,11 @@ bool intel_perf_load_metric_id(struct intel_perf_config *perf_cfg,
|
|||
struct intel_perf_registers *intel_perf_load_configuration(struct intel_perf_config *perf_cfg,
|
||||
int fd, const char *guid);
|
||||
|
||||
/** Load a configuration's id from KMD using a guid.
|
||||
*/
|
||||
uint64_t
|
||||
intel_perf_get_configuration_id(struct intel_perf_config *perf_cfg, const char *guid);
|
||||
|
||||
/** Store a configuration into i915 using guid and return a new metric id.
|
||||
*
|
||||
* If guid is NULL, then a generated one will be provided by hashing the
|
||||
|
|
|
|||
|
|
@ -221,18 +221,8 @@ VkResult anv_AcquirePerformanceConfigurationINTEL(
|
|||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
struct intel_perf_registers *metric_config =
|
||||
intel_perf_load_configuration(device->physical->perf, device->fd,
|
||||
INTEL_PERF_QUERY_GUID_MDAPI);
|
||||
if (!metric_config) {
|
||||
vk_object_free(&device->vk, NULL, config);
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
config->config_id =
|
||||
intel_perf_store_configuration(device->physical->perf, device->fd,
|
||||
metric_config, NULL /* guid */);
|
||||
ralloc_free(metric_config);
|
||||
config->config_id = intel_perf_get_configuration_id(device->physical->perf,
|
||||
INTEL_PERF_QUERY_GUID_MDAPI);
|
||||
if (config->config_id == 0) {
|
||||
vk_object_free(&device->vk, NULL, config);
|
||||
return VK_INCOMPLETE;
|
||||
|
|
|
|||
|
|
@ -180,18 +180,8 @@ VkResult anv_AcquirePerformanceConfigurationINTEL(
|
|||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
struct intel_perf_registers *metric_config =
|
||||
intel_perf_load_configuration(device->physical->perf, device->fd,
|
||||
INTEL_PERF_QUERY_GUID_MDAPI);
|
||||
if (!metric_config) {
|
||||
vk_object_free(&device->vk, NULL, config);
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
config->config_id =
|
||||
intel_perf_store_configuration(device->physical->perf, device->fd,
|
||||
metric_config, NULL /* guid */);
|
||||
ralloc_free(metric_config);
|
||||
config->config_id = intel_perf_get_configuration_id(device->physical->perf,
|
||||
INTEL_PERF_QUERY_GUID_MDAPI);
|
||||
if (config->config_id == 0) {
|
||||
vk_object_free(&device->vk, NULL, config);
|
||||
return VK_INCOMPLETE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue