anv: Add anv_device_perf_close()

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/31026>
This commit is contained in:
José Roberto de Souza
2024-08-19 11:20:03 -07:00
parent 2d216c12fa
commit ca13e35304
2 changed files with 13 additions and 9 deletions

View File

@@ -94,6 +94,16 @@ anv_device_perf_init(struct anv_device *device)
device->perf_fd = -1;
}
void
anv_device_perf_close(struct anv_device *device)
{
if (device->perf_fd == -1)
return;
close(device->perf_fd);
device->perf_fd = -1;
}
static int
anv_device_perf_open(struct anv_device *device, uint64_t metric_id)
{
@@ -245,10 +255,7 @@ void anv_UninitializePerformanceApiINTEL(
{
ANV_FROM_HANDLE(anv_device, device, _device);
if (device->perf_fd >= 0) {
close(device->perf_fd);
device->perf_fd = -1;
}
anv_device_perf_close(device);
}
/* VK_KHR_performance_query */
@@ -381,11 +388,7 @@ void anv_ReleaseProfilingLockKHR(
{
ANV_FROM_HANDLE(anv_device, device, _device);
if (!INTEL_DEBUG(DEBUG_NO_OACONFIG)) {
assert(device->perf_fd >= 0);
close(device->perf_fd);
}
device->perf_fd = -1;
anv_device_perf_close(device);
}
void

View File

@@ -6173,6 +6173,7 @@ struct anv_performance_configuration_intel {
void anv_physical_device_init_va_ranges(struct anv_physical_device *device);
void anv_physical_device_init_perf(struct anv_physical_device *device, int fd);
void anv_device_perf_init(struct anv_device *device);
void anv_device_perf_close(struct anv_device *device);
void anv_perf_write_pass_results(struct intel_perf_config *perf,
struct anv_query_pool *pool, uint32_t pass,
const struct intel_perf_query_result *accumulated_results,