if (radv_get_thread_trace(queue, &thread_trace))
radv_dump_thread_trace(queue->device, &thread_trace);
} else {
- if (num_frames == queue->device->thread_trace_start_frame) {
+ bool frame_trigger = num_frames == queue->device->thread_trace_start_frame;
+ bool file_trigger = false;
+ if (queue->device->thread_trace_trigger_file &&
+ access(queue->device->thread_trace_trigger_file, W_OK) == 0) {
+ if (unlink(queue->device->thread_trace_trigger_file) == 0) {
+ file_trigger = true;
+ } else {
+ /* Do not enable tracing if we cannot remove the file,
+ * because by then we'll trace every frame ... */
+ fprintf(stderr, "RADV: could not remove thread trace trigger file, ignoring\n");
+ }
+ }
+
+ if (frame_trigger || file_trigger) {
radv_begin_thread_trace(queue);
assert(!thread_trace_enabled);
thread_trace_enabled = true;
static bool radv_thread_trace_enabled()
{
- return radv_get_int_debug_option("RADV_THREAD_TRACE", -1) >= 0;
+ return radv_get_int_debug_option("RADV_THREAD_TRACE", -1) >= 0 ||
+ getenv("RADV_THREAD_TRACE_TRIGGER");
}
static void
radv_get_int_debug_option("RADV_THREAD_TRACE_BUFFER_SIZE", 1024 * 1024);
device->thread_trace_start_frame = radv_get_int_debug_option("RADV_THREAD_TRACE", -1);
+ const char *trigger_file = getenv("RADV_THREAD_TRACE_TRIGGER");
+ if (trigger_file)
+ device->thread_trace_trigger_file = strdup(trigger_file);
+
if (!radv_thread_trace_init(device))
goto fail;
}
radv_bo_list_finish(&device->bo_list);
radv_thread_trace_finish(device);
+ free(device->thread_trace_trigger_file);
radv_trap_handler_finish(device);
pthread_cond_destroy(&device->timeline_cond);
radv_bo_list_finish(&device->bo_list);
+ free(device->thread_trace_trigger_file);
radv_thread_trace_finish(device);
vk_free(&device->vk.alloc, device);
void *thread_trace_ptr;
uint32_t thread_trace_buffer_size;
int thread_trace_start_frame;
+ char *thread_trace_trigger_file;
/* Trap handler. */
struct radv_shader_variant *trap_handler_shader;