#define RADV_SHADER_ALLOC_NUM_FREE_LISTS \
(RADV_SHADER_ALLOC_MAX_SIZE_CLASS - RADV_SHADER_ALLOC_MIN_SIZE_CLASS + 1)
+#define PERF_CTR_MAX_PASSES 512
+#define PERF_CTR_BO_PASS_OFFSET 16
+#define PERF_CTR_BO_LOCK_OFFSET 0
+#define PERF_CTR_BO_FENCE_OFFSET 8
+
#endif /* RADV_CONSTANTS_H */
bool global_bo_list = false;
bool image_2d_view_of_3d = false;
bool primitives_generated_query = false;
+ bool use_perf_counters = false;
/* Check enabled features */
if (pCreateInfo->pEnabledFeatures) {
primitives_generated_query = true;
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR: {
+ const VkPhysicalDevicePerformanceQueryFeaturesKHR *features = (const void *)ext;
+ if (features->performanceCounterQueryPools)
+ use_perf_counters = true;
+ break;
+ }
default:
break;
}
1 << util_logbase2(device->force_aniso));
}
+ if (use_perf_counters) {
+ size_t bo_size = PERF_CTR_BO_PASS_OFFSET + sizeof(uint64_t) * PERF_CTR_MAX_PASSES;
+ result =
+ device->ws->buffer_create(device->ws, bo_size, 4096, RADEON_DOMAIN_GTT,
+ RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
+ RADV_BO_PRIORITY_UPLOAD_BUFFER, 0, &device->perf_counter_bo);
+ if (result != VK_SUCCESS)
+ goto fail_cache;
+ }
+
*pDevice = radv_device_to_handle(device);
return VK_SUCCESS;
+fail_cache:
+ radv_DestroyPipelineCache(radv_device_to_handle(device), pc, NULL);
fail_meta:
radv_device_finish_meta(device);
fail:
radv_trap_handler_finish(device);
radv_finish_trace(device);
+ if (device->perf_counter_bo)
+ device->ws->buffer_destroy(device->ws, device->perf_counter_bo);
if (device->gfx_init)
device->ws->buffer_destroy(device->ws, device->gfx_init);
if (!device)
return;
+ if (device->perf_counter_bo)
+ device->ws->buffer_destroy(device->ws, device->perf_counter_bo);
+
if (device->gfx_init)
device->ws->buffer_destroy(device->ws, device->gfx_init);
simple_mtx_t pstate_mtx;
unsigned pstate_cnt;
+
+ /* BO to contain some performance counter helpers:
+ * - A lock for profiling cmdbuffers.
+ * - a temporary fence for the end query synchronization.
+ * - the pass to use for profiling. (as an array of bools)
+ */
+ struct radeon_winsys_bo *perf_counter_bo;
};
bool radv_device_acquire_performance_counters(struct radv_device *device);