mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
radv: Allow triggering thread traces by file.
Makes it actually feasible to trace games and not just demos/apitraces. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6537>
This commit is contained in:
parent
0d862da170
commit
00973542ff
3 changed files with 23 additions and 2 deletions
|
|
@ -591,7 +591,20 @@ radv_handle_thread_trace(VkQueue _queue)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -2488,7 +2488,8 @@ radv_get_int_debug_option(const char *name, int default_value)
|
|||
|
||||
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
|
||||
|
|
@ -2822,6 +2823,10 @@ VkResult radv_CreateDevice(
|
|||
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;
|
||||
}
|
||||
|
|
@ -2918,6 +2923,7 @@ fail:
|
|||
radv_bo_list_finish(&device->bo_list);
|
||||
|
||||
radv_thread_trace_finish(device);
|
||||
free(device->thread_trace_trigger_file);
|
||||
|
||||
radv_trap_handler_finish(device);
|
||||
|
||||
|
|
@ -2977,6 +2983,7 @@ void radv_DestroyDevice(
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -846,6 +846,7 @@ struct radv_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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue