diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 9664768bb0d..627fd67ed78 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -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; } diff --git a/src/intel/ds/intel_tracepoints.py b/src/intel/ds/intel_tracepoints.py index 8dd55b3edb9..f88236e962b 100644 --- a/src/intel/ds/intel_tracepoints.py +++ b/src/intel/ds/intel_tracepoints.py @@ -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', diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ff424053df0..2c341c2e28e 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -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); diff --git a/src/intel/vulkan/anv_utrace.c b/src/intel/vulkan/anv_utrace.c index 5c3110f9026..393cc2811bc 100644 --- a/src/intel/vulkan/anv_utrace.c +++ b/src/intel/vulkan/anv_utrace.c @@ -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); } diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 0087ab041dc..f25ff91053a 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -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; }