mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
anv: Fix context id or exec queue used to open perf stream
It was always using device->context_id what is not valid in i915 when has_vm_control is true or when running with Xe KMD. But anv_AcquireProfilingLockKHR() don't have the queue information so at least for now we will only support queries in a single queue. And for consistency doing the same in anv_QueueSetPerformanceConfigurationINTEL() although here we have the queue parameter but queries are only supported in render engine so it would only expose other queues if user set some parameters. Cc: 24.2 <mesa-stable> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30652>
This commit is contained in:
parent
c97f79ac0c
commit
c5d79d533a
3 changed files with 46 additions and 6 deletions
|
|
@ -105,13 +105,30 @@ anv_device_perf_close(struct anv_device *device)
|
|||
}
|
||||
|
||||
static int
|
||||
anv_device_perf_open(struct anv_device *device, uint64_t metric_id)
|
||||
anv_device_perf_open(struct anv_device *device, struct anv_queue *queue, uint64_t metric_id)
|
||||
{
|
||||
uint32_t context_or_exec_queue_id;
|
||||
uint64_t period_exponent = 31; /* slowest sampling period */
|
||||
int ret;
|
||||
|
||||
return intel_perf_stream_open(device->physical->perf, device->fd,
|
||||
device->context_id, metric_id,
|
||||
period_exponent, true, true);
|
||||
switch (device->physical->info.kmd_type) {
|
||||
case INTEL_KMD_TYPE_I915:
|
||||
context_or_exec_queue_id = device->physical->has_vm_control ?
|
||||
queue->context_id : device->context_id;
|
||||
break;
|
||||
case INTEL_KMD_TYPE_XE:
|
||||
context_or_exec_queue_id = queue->exec_queue_id;
|
||||
break;
|
||||
default:
|
||||
unreachable("missing");
|
||||
context_or_exec_queue_id = 0;
|
||||
}
|
||||
|
||||
ret = intel_perf_stream_open(device->physical->perf, device->fd,
|
||||
context_or_exec_queue_id, metric_id,
|
||||
period_exponent, true, true);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* VK_INTEL_performance_query */
|
||||
|
|
@ -225,6 +242,20 @@ VkResult anv_ReleasePerformanceConfigurationINTEL(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static struct anv_queue *
|
||||
anv_device_get_perf_queue(struct anv_device *device)
|
||||
{
|
||||
for (uint32_t i = 0; i < device->queue_count; i++) {
|
||||
struct anv_queue *queue = &device->queues[i];
|
||||
const struct anv_queue_family *family = queue->family;
|
||||
|
||||
if (family->supports_perf)
|
||||
return queue;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VkResult anv_QueueSetPerformanceConfigurationINTEL(
|
||||
VkQueue _queue,
|
||||
VkPerformanceConfigurationINTEL _configuration)
|
||||
|
|
@ -233,9 +264,12 @@ VkResult anv_QueueSetPerformanceConfigurationINTEL(
|
|||
ANV_FROM_HANDLE(anv_performance_configuration_intel, config, _configuration);
|
||||
struct anv_device *device = queue->device;
|
||||
|
||||
if (queue != anv_device_get_perf_queue(device))
|
||||
return VK_ERROR_UNKNOWN;
|
||||
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
if (device->perf_fd < 0) {
|
||||
device->perf_fd = anv_device_perf_open(device, config->config_id);
|
||||
device->perf_fd = anv_device_perf_open(device, queue, config->config_id);
|
||||
if (device->perf_fd < 0)
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
} else {
|
||||
|
|
@ -374,7 +408,11 @@ VkResult anv_AcquireProfilingLockKHR(
|
|||
assert(device->perf_fd == -1);
|
||||
|
||||
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
|
||||
fd = anv_device_perf_open(device, first_metric_set->oa_metrics_set_id);
|
||||
struct anv_queue *queue = anv_device_get_perf_queue(device);
|
||||
|
||||
if (queue == NULL)
|
||||
return VK_ERROR_UNKNOWN;
|
||||
fd = anv_device_perf_open(device, queue, first_metric_set->oa_metrics_set_id);
|
||||
if (fd < 0)
|
||||
return VK_TIMEOUT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2148,6 +2148,7 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
|
|||
protected_flag,
|
||||
.queueCount = gc_count,
|
||||
.engine_class = INTEL_ENGINE_CLASS_RENDER,
|
||||
.supports_perf = true,
|
||||
};
|
||||
}
|
||||
if (g_count > 0) {
|
||||
|
|
|
|||
|
|
@ -954,6 +954,7 @@ struct anv_queue_family {
|
|||
uint32_t queueCount;
|
||||
|
||||
enum intel_engine_class engine_class;
|
||||
bool supports_perf;
|
||||
};
|
||||
|
||||
#define ANV_MAX_QUEUE_FAMILIES 5
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue