anv: add utrace tracking of frame boundaries
Based on vkQueuePresentKHR calls. It just helps spotting the beginning end of a frame in perfetto when apps are using 3/4 command buffers per frame. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22276>
This commit is contained in:

committed by
Marge Bot

parent
da6842007f
commit
66edd030ab
@@ -535,7 +535,7 @@ void iris_batch_maybe_begin_frame(struct iris_batch *batch)
|
||||
struct iris_context *ice = batch->ice;
|
||||
|
||||
if (ice->tracing_begin_frame != ice->frame) {
|
||||
trace_intel_begin_frame(&batch->trace);
|
||||
trace_intel_begin_frame(&batch->trace, batch);
|
||||
ice->tracing_begin_frame = ice->tracing_end_frame = ice->frame;
|
||||
}
|
||||
}
|
||||
@@ -640,7 +640,7 @@ iris_finish_batch(struct iris_batch *batch)
|
||||
|
||||
struct iris_context *ice = batch->ice;
|
||||
if (ice->tracing_end_frame != ice->frame) {
|
||||
trace_intel_end_frame(&batch->trace, ice->tracing_end_frame);
|
||||
trace_intel_end_frame(&batch->trace, batch, ice->tracing_end_frame);
|
||||
ice->tracing_end_frame = ice->frame;
|
||||
}
|
||||
|
||||
|
@@ -63,10 +63,11 @@ def define_tracepoints(args):
|
||||
end_of_pipe=end_pipelined,
|
||||
need_cs_param=need_cs_param)
|
||||
|
||||
# Frame tracepoints, only for Iris
|
||||
# Frame tracepoints
|
||||
begin_end_tp('frame',
|
||||
tp_args=[Arg(type='uint32_t', var='frame', c_format='%u'),],
|
||||
end_pipelined=False)
|
||||
end_pipelined=False,
|
||||
need_cs_param=True)
|
||||
|
||||
# Annotations for Queue(Begin|End)DebugUtilsLabelEXT
|
||||
begin_end_tp('queue_annotation',
|
||||
|
@@ -1350,6 +1350,9 @@ VkResult anv_queue_submit(struct vk_queue *queue,
|
||||
VkResult anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
struct anv_batch *batch);
|
||||
|
||||
void anv_queue_trace(struct anv_queue *queue, const char *label,
|
||||
bool frame, bool begin);
|
||||
|
||||
void *
|
||||
anv_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
|
||||
uint64_t size, VkMemoryPropertyFlags property_flags);
|
||||
|
@@ -367,8 +367,8 @@ void anv_CmdEndDebugUtilsLabelEXT(VkCommandBuffer _commandBuffer)
|
||||
vk_common_CmdEndDebugUtilsLabelEXT(_commandBuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
anv_queue_trace(struct anv_queue *queue, const VkDebugUtilsLabelEXT *label, bool begin)
|
||||
void
|
||||
anv_queue_trace(struct anv_queue *queue, const char *label, bool frame, bool begin)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
|
||||
@@ -403,13 +403,21 @@ anv_queue_trace(struct anv_queue *queue, const VkDebugUtilsLabelEXT *label, bool
|
||||
(struct anv_address) { .bo = submit->batch_bo, },
|
||||
submit->batch_bo->map, submit->batch_bo->size);
|
||||
|
||||
if (begin) {
|
||||
trace_intel_begin_queue_annotation(&submit->ds.trace, &submit->batch);
|
||||
if (frame) {
|
||||
if (begin)
|
||||
trace_intel_begin_frame(&submit->ds.trace, &submit->batch);
|
||||
else
|
||||
trace_intel_end_frame(&submit->ds.trace, &submit->batch,
|
||||
device->debug_frame_desc->frame_id);
|
||||
} else {
|
||||
trace_intel_end_queue_annotation(&submit->ds.trace,
|
||||
&submit->batch,
|
||||
strlen(label->pLabelName),
|
||||
label->pLabelName);
|
||||
if (begin) {
|
||||
trace_intel_begin_queue_annotation(&submit->ds.trace, &submit->batch);
|
||||
} else {
|
||||
trace_intel_end_queue_annotation(&submit->ds.trace,
|
||||
&submit->batch,
|
||||
strlen(label),
|
||||
label);
|
||||
}
|
||||
}
|
||||
|
||||
anv_batch_emit(&submit->batch, GFX8_MI_BATCH_BUFFER_END, bbs);
|
||||
@@ -448,7 +456,8 @@ anv_QueueBeginDebugUtilsLabelEXT(
|
||||
|
||||
vk_common_QueueBeginDebugUtilsLabelEXT(_queue, pLabelInfo);
|
||||
|
||||
anv_queue_trace(queue, pLabelInfo, true /* begin */);
|
||||
anv_queue_trace(queue, pLabelInfo->pLabelName,
|
||||
false /* frame */, true /* begin */);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -459,7 +468,8 @@ anv_QueueEndDebugUtilsLabelEXT(VkQueue _queue)
|
||||
if (queue->vk.labels.size > 0) {
|
||||
const VkDebugUtilsLabelEXT *label =
|
||||
util_dynarray_top_ptr(&queue->vk.labels, VkDebugUtilsLabelEXT);
|
||||
anv_queue_trace(queue, label, false /* begin */);
|
||||
anv_queue_trace(queue, label->pLabelName,
|
||||
false /* frame */, false /* begin */);
|
||||
|
||||
u_trace_context_process(&queue->device->ds.trace_context, true);
|
||||
}
|
||||
|
@@ -121,6 +121,9 @@ VkResult anv_QueuePresentKHR(
|
||||
#endif
|
||||
}
|
||||
|
||||
if (u_trace_should_process(&device->ds.trace_context))
|
||||
anv_queue_trace(queue, NULL, true /* frame */, false /* begin */);
|
||||
|
||||
result = vk_queue_wait_before_present(&queue->vk, pPresentInfo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
@@ -130,5 +133,8 @@ VkResult anv_QueuePresentKHR(
|
||||
_queue, 0,
|
||||
pPresentInfo);
|
||||
|
||||
if (u_trace_should_process(&device->ds.trace_context))
|
||||
anv_queue_trace(queue, NULL, true /* frame */, true /* begin */);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user