result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"failed to stat DRM primary node %s",
drm_device->nodes[DRM_NODE_PRIMARY]);
- goto fail_disk_cache;
+ goto fail_perfcounters;
}
device->primary_devid = primary_stat.st_rdev;
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
"failed to stat DRM render node %s",
drm_device->nodes[DRM_NODE_RENDER]);
- goto fail_disk_cache;
+ goto fail_perfcounters;
}
device->render_devid = render_stat.st_rdev;
}
radv_physical_device_init_queue_table(device);
+ /* We don't check the error code, but later check if it is initialized. */
+ ac_init_perfcounters(&device->rad_info, false, false, &device->ac_perfcounters);
+
/* The WSI is structured as a layer on top of the driver, so this has
* to be the last part of initialization (at least until we get other
* semi-layers).
result = radv_init_wsi(device);
if (result != VK_SUCCESS) {
vk_error(instance, result);
- goto fail_disk_cache;
+ goto fail_perfcounters;
}
device->gs_table_depth =
return VK_SUCCESS;
-fail_disk_cache:
+fail_perfcounters:
+ ac_destroy_perfcounters(&device->ac_perfcounters);
disk_cache_destroy(device->disk_cache);
#ifdef ENABLE_SHADER_CACHE
fail_wsi:
radv_physical_device_destroy(struct radv_physical_device *device)
{
radv_finish_wsi(device);
+ ac_destroy_perfcounters(&device->ac_perfcounters);
device->ws->destroy(device->ws);
disk_cache_destroy(device->disk_cache);
if (device->local_fd != -1)
struct ac_hs_info hs;
struct ac_task_info task_info;
+
+ /* Performance counters. */
+ struct ac_perfcounters ac_perfcounters;
};
struct radv_instance {
/* SPM. */
struct ac_spm_trace_data spm_trace;
- /* Performance counters. */
- struct ac_perfcounters perfcounters;
-
/* Trap handler. */
struct radv_trap_handler_shader *trap_handler_shader;
struct radeon_winsys_bo *tma_bo; /* Trap Memory Address */
radv_spm_init(struct radv_device *device)
{
const struct radeon_info *info = &device->physical_device->rad_info;
- struct ac_perfcounters *pc = &device->perfcounters;
+ struct ac_perfcounters *pc = &device->physical_device->ac_perfcounters;
struct ac_spm_counter_create_info spm_counters[] = {
{TCP, 0, 0x9}, /* Number of L2 requests. */
{TCP, 0, 0x12}, /* Number of L2 misses. */
{GL2C, 0, info->gfx_level >= GFX10_3 ? 0x2b : 0x23}, /* Number of GL2C misses. */
};
- if (!ac_init_perfcounters(info, false, false, pc))
+ /* We failed to initialize the performance counters. */
+ if (!pc->blocks)
return false;
if (!ac_init_spm(info, pc, ARRAY_SIZE(spm_counters), spm_counters, &device->spm_trace))
}
ac_destroy_spm(&device->spm_trace);
- ac_destroy_perfcounters(&device->perfcounters);
}