This allows for submissions to be outside the global anv_device mutex.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24744>
iris_measure_frame_end(ice);
}
- u_trace_context_process(&ice->ds.trace_context,
- flags & PIPE_FLUSH_END_OF_FRAME);
+ intel_ds_device_process(&ice->ds, flags & PIPE_FLUSH_END_OF_FRAME);
if (!out_fence)
return;
{
struct intel_ds_flush_data *flush_data = malloc(sizeof(*flush_data));
intel_ds_flush_data_init(flush_data, &batch->ds, submission_id);
- u_trace_flush(&batch->trace, flush_data, false);
+ intel_ds_queue_flush_data(&batch->ds, &batch->trace, flush_data, false);
}
void iris_utrace_init(struct iris_context *ice)
device->iid = get_iid();
device->api = api;
list_inithead(&device->queues);
+ simple_mtx_init(&device->trace_context_mutex, mtx_plain);
}
void
intel_ds_device_fini(struct intel_ds_device *device)
{
u_trace_context_fini(&device->trace_context);
+ simple_mtx_destroy(&device->trace_context_mutex);
}
struct intel_ds_queue *
u_trace_fini(&data->trace);
}
+void intel_ds_queue_flush_data(struct intel_ds_queue *queue,
+ struct u_trace *ut,
+ struct intel_ds_flush_data *data,
+ bool free_data)
+{
+ simple_mtx_lock(&queue->device->trace_context_mutex);
+ u_trace_flush(ut, data, free_data);
+ simple_mtx_unlock(&queue->device->trace_context_mutex);
+}
+
+void intel_ds_device_process(struct intel_ds_device *device,
+ bool eof)
+{
+ simple_mtx_lock(&device->trace_context_mutex);
+ u_trace_context_process(&device->trace_context, eof);
+ simple_mtx_unlock(&device->trace_context_mutex);
+}
+
#ifdef __cplusplus
}
#endif
*/
uint64_t event_id;
+ /* Protects submissions of u_trace data to trace_context */
+ simple_mtx_t trace_context_mutex;
+
struct u_trace_context trace_context;
/* List of intel_ds_queue */
void intel_ds_flush_data_fini(struct intel_ds_flush_data *data);
+void intel_ds_queue_flush_data(struct intel_ds_queue *queue,
+ struct u_trace *ut,
+ struct intel_ds_flush_data *data,
+ bool free_data);
+
+void intel_ds_device_process(struct intel_ds_device *device, bool eof);
+
#ifdef HAVE_PERFETTO
uint64_t intel_ds_begin_submit(struct intel_ds_queue *queue);
/* Take submission ID under lock */
intel_ds_end_submit(&queue->ds, start_ts);
- u_trace_context_process(&device->ds.trace_context, true);
-
pthread_mutex_unlock(&device->mutex);
+ intel_ds_device_process(&device->ds, true);
+
return result;
}
&submit->batch);
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
if (cmd_buffers[i]->usage_flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) {
- u_trace_flush(&cmd_buffers[i]->trace, submit, false);
+ intel_ds_queue_flush_data(&queue->ds, &cmd_buffers[i]->trace,
+ &submit->ds, false);
} else {
u_trace_clone_append(u_trace_begin_iterator(&cmd_buffers[i]->trace),
u_trace_end_iterator(&cmd_buffers[i]->trace),
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
if (cmd_buffers[i]->usage_flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) {
- u_trace_flush(&cmd_buffers[i]->trace, submit, false);
+ intel_ds_queue_flush_data(&queue->ds, &cmd_buffers[i]->trace,
+ &submit->ds, false);
} else {
u_trace_clone_append(u_trace_begin_iterator(&cmd_buffers[i]->trace),
u_trace_end_iterator(&cmd_buffers[i]->trace),
anv_genX(device->info, emit_simple_shader_end)(&submit->simple_state);
}
- u_trace_flush(&submit->ds.trace, submit, true);
+ intel_ds_queue_flush_data(&queue->ds, &submit->ds.trace, &submit->ds, true);
if (submit->batch.status != VK_SUCCESS) {
result = submit->batch.status;
} else {
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
assert(cmd_buffers[i]->usage_flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
- u_trace_flush(&cmd_buffers[i]->trace, submit, i == (cmd_buffer_count - 1));
+ intel_ds_queue_flush_data(&queue->ds, &cmd_buffers[i]->trace,
+ &submit->ds, i == (cmd_buffer_count - 1));
}
}
void
anv_device_utrace_finish(struct anv_device *device)
{
- u_trace_context_process(&device->ds.trace_context, true);
+ intel_ds_device_process(&device->ds, true);
intel_ds_device_fini(&device->ds);
anv_bo_pool_finish(&device->utrace_bo_pool);
}
goto error_reloc_list;
}
- u_trace_flush(&submit->ds.trace, submit, true);
+ intel_ds_queue_flush_data(&queue->ds, &submit->ds.trace, &submit->ds, true);
pthread_mutex_lock(&device->mutex);
device->kmd_backend->queue_exec_trace(queue, submit);
anv_queue_trace(queue, label->pLabelName,
false /* frame */, false /* begin */);
- u_trace_context_process(&queue->device->ds.trace_context, true);
+ intel_ds_device_process(&queue->device->ds, true);
}
vk_common_QueueEndDebugUtilsLabelEXT(_queue);
&flush->batch);
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
if (cmd_buffers[i]->usage_flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) {
- u_trace_flush(&cmd_buffers[i]->trace, flush, false);
+ intel_ds_queue_flush_data(&queue->ds, &cmd_buffers[i]->trace,
+ &flush->ds, false);
} else {
u_trace_clone_append(u_trace_begin_iterator(&cmd_buffers[i]->trace),
u_trace_end_iterator(&cmd_buffers[i]->trace),
}
anv_genX(device->info, emit_so_memcpy_fini)(&flush->memcpy_state);
- u_trace_flush(&flush->ds.trace, flush, true);
+ intel_ds_queue_flush_data(&queue->ds, &flush->ds.trace, &flush->ds, true);
if (flush->batch.status != VK_SUCCESS) {
result = flush->batch.status;
} else {
for (uint32_t i = 0; i < cmd_buffer_count; i++) {
assert(cmd_buffers[i]->usage_flags & VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT);
- u_trace_flush(&cmd_buffers[i]->trace, flush, i == (cmd_buffer_count - 1));
+ intel_ds_queue_flush_data(&queue->ds, &cmd_buffers[i]->trace,
+ &flush->ds, i == (cmd_buffer_count - 1));
}
}
void
anv_device_utrace_finish(struct anv_device *device)
{
- u_trace_context_process(&device->ds.trace_context, true);
+ intel_ds_device_process(&device->ds, true);
intel_ds_device_fini(&device->ds);
anv_bo_pool_finish(&device->utrace_bo_pool);
}
_queue, 0,
pPresentInfo);
- u_trace_context_process(&device->ds.trace_context, true);
+ intel_ds_device_process(&device->ds, true);
return result;
}