diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c index 2b7833a15..ea382d47f 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c @@ -49,6 +49,7 @@ #include "util/u_misc.h" #include "util/u_time.h" #include "util/u_debug.h" +#include "util/u_trace_marker.h" #include "util/u_distortion_mesh.h" #include "main/comp_compositor.h" @@ -117,6 +118,8 @@ compositor_wait_frame(struct xrt_compositor *xc, uint64_t *out_predicted_display_time_ns, uint64_t *out_predicted_display_period_ns) { + COMP_TRACE_MARKER(); + struct comp_compositor *c = comp_compositor(xc); // A little bit easier to read. @@ -340,6 +343,8 @@ compositor_layer_equirect2(struct xrt_compositor *xc, static xrt_result_t compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id, xrt_graphics_sync_handle_t sync_handle) { + COMP_TRACE_MARKER(); + struct comp_compositor *c = comp_compositor(xc); COMP_SPEW(c, "LAYER_COMMIT at %8.3fms", ts_ms()); @@ -444,6 +449,7 @@ compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id, xrt_graphic // Now is a good point to garbage collect. comp_compositor_garbage_collect(c); + return XRT_SUCCESS; } diff --git a/src/xrt/compositor/main/comp_layer_renderer.c b/src/xrt/compositor/main/comp_layer_renderer.c index b3202f743..79d1a16bb 100644 --- a/src/xrt/compositor/main/comp_layer_renderer.c +++ b/src/xrt/compositor/main/comp_layer_renderer.c @@ -573,6 +573,8 @@ _render_pass_begin(struct vk_bundle *vk, static void _render_stereo(struct comp_layer_renderer *self, struct vk_bundle *vk, VkCommandBuffer cmd_buffer) { + COMP_TRACE_MARKER(); + VkViewport viewport = { 0.0f, 0.0f, self->extent.width, self->extent.height, 0.0f, 1.0f, }; @@ -596,6 +598,8 @@ _render_stereo(struct comp_layer_renderer *self, struct vk_bundle *vk, VkCommand void comp_layer_renderer_draw(struct comp_layer_renderer *self) { + COMP_TRACE_MARKER(); + struct vk_bundle *vk = self->vk; VkCommandBuffer cmd_buffer; diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index 2e7256353..fe44c13d6 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -15,6 +15,7 @@ #include "math/m_space.h" #include "util/u_misc.h" +#include "util/u_trace_marker.h" #include "util/u_distortion_mesh.h" #include "main/comp_layer_renderer.h" @@ -148,6 +149,8 @@ renderer_create(struct comp_renderer *r, struct comp_compositor *c) static void renderer_wait_gpu_idle(struct comp_renderer *r) { + COMP_TRACE_MARKER(); + os_mutex_lock(&r->c->vk.queue_mutex); r->c->vk.vkDeviceWaitIdle(r->c->vk.device); os_mutex_unlock(&r->c->vk.queue_mutex); @@ -156,6 +159,8 @@ renderer_wait_gpu_idle(struct comp_renderer *r) static void renderer_submit_queue(struct comp_renderer *r) { + COMP_TRACE_MARKER(); + struct vk_bundle *vk = &r->c->vk; VkResult ret; @@ -365,6 +370,8 @@ renderer_create_fences(struct comp_renderer *r) static void renderer_get_view_projection(struct comp_renderer *r) { + COMP_TRACE_MARKER(); + struct xrt_space_relation relation; xrt_device_get_tracked_pose(r->c->xdev, XRT_INPUT_GENERIC_HEAD_POSE, r->c->last_next_display_time, &relation); @@ -624,6 +631,8 @@ comp_renderer_set_equirect2_layer(struct comp_renderer *r, void comp_renderer_draw(struct comp_renderer *r) { + COMP_TRACE_MARKER(); + struct comp_target *ct = r->c->target; struct comp_compositor *c = r->c; @@ -751,6 +760,8 @@ renderer_resize(struct comp_renderer *r) static void renderer_acquire_swapchain_image(struct comp_renderer *r) { + COMP_TRACE_MARKER(); + VkResult ret; ret = comp_target_acquire(r->c->target, r->semaphores.present_complete, &r->current_buffer); @@ -772,6 +783,8 @@ renderer_acquire_swapchain_image(struct comp_renderer *r) static void renderer_present_swapchain_image(struct comp_renderer *r, uint64_t desired_present_time_ns, uint64_t present_slop_ns) { + COMP_TRACE_MARKER(); + VkResult ret; ret = comp_target_present(r->c->target, r->queue, r->current_buffer, r->semaphores.render_complete, @@ -821,11 +834,15 @@ renderer_destroy(struct comp_renderer *r) void comp_renderer_allocate_layers(struct comp_renderer *self, uint32_t num_layers) { + COMP_TRACE_MARKER(); + comp_layer_renderer_allocate_layers(self->lr, num_layers); } void comp_renderer_destroy_layers(struct comp_renderer *self) { + COMP_TRACE_MARKER(); + comp_layer_renderer_destroy_layers(self->lr); } diff --git a/src/xrt/compositor/main/comp_target.h b/src/xrt/compositor/main/comp_target.h index 44e6f6d03..b5a67d4b4 100644 --- a/src/xrt/compositor/main/comp_target.h +++ b/src/xrt/compositor/main/comp_target.h @@ -14,6 +14,8 @@ #include "vk/vk_helpers.h" +#include "util/u_trace_marker.h" + #ifdef __cplusplus extern "C" { @@ -181,6 +183,8 @@ struct comp_target static inline bool comp_target_init_pre_vulkan(struct comp_target *ct) { + COMP_TRACE_MARKER(); + return ct->init_pre_vulkan(ct); } @@ -193,6 +197,8 @@ comp_target_init_pre_vulkan(struct comp_target *ct) static inline bool comp_target_init_post_vulkan(struct comp_target *ct, uint32_t preferred_width, uint32_t preferred_height) { + COMP_TRACE_MARKER(); + return ct->init_post_vulkan(ct, preferred_width, preferred_height); } @@ -210,6 +216,8 @@ comp_target_create_images(struct comp_target *ct, VkColorSpaceKHR preferred_color_space, VkPresentModeKHR present_mode) { + COMP_TRACE_MARKER(); + ct->create_images(ct, preferred_width, preferred_height, preferred_color_format, preferred_color_space, present_mode); } @@ -223,6 +231,8 @@ comp_target_create_images(struct comp_target *ct, static inline VkResult comp_target_acquire(struct comp_target *ct, VkSemaphore semaphore, uint32_t *out_index) { + COMP_TRACE_MARKER(); + return ct->acquire(ct, semaphore, out_index); } @@ -241,6 +251,8 @@ comp_target_present(struct comp_target *ct, uint64_t present_slop_ns) { + COMP_TRACE_MARKER(); + return ct->present( // ct, // queue, // @@ -259,6 +271,8 @@ comp_target_present(struct comp_target *ct, static inline void comp_target_flush(struct comp_target *ct) { + COMP_TRACE_MARKER(); + ct->flush(ct); } @@ -276,6 +290,8 @@ comp_target_calc_frame_timings(struct comp_target *ct, uint64_t *out_present_slop_ns, uint64_t *out_predicted_display_time_ns) { + COMP_TRACE_MARKER(); + ct->calc_frame_timings( // ct, // out_frame_id, // @@ -295,6 +311,8 @@ comp_target_calc_frame_timings(struct comp_target *ct, static inline void comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, uint64_t when_woke_ns) { + COMP_TRACE_MARKER(); + ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_WAKE_UP, frame_id, when_woke_ns); } @@ -308,6 +326,8 @@ comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, uint64_t when static inline void comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, uint64_t when_began_ns) { + COMP_TRACE_MARKER(); + ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_BEGIN, frame_id, when_began_ns); } @@ -321,6 +341,8 @@ comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, uint64_t when_b static inline void comp_target_mark_submit(struct comp_target *ct, int64_t frame_id, uint64_t when_submitted_ns) { + COMP_TRACE_MARKER(); + ct->mark_timing_point(ct, COMP_TARGET_TIMING_POINT_SUBMIT, frame_id, when_submitted_ns); } @@ -333,6 +355,8 @@ comp_target_mark_submit(struct comp_target *ct, int64_t frame_id, uint64_t when_ static inline VkResult comp_target_update_timings(struct comp_target *ct) { + COMP_TRACE_MARKER(); + return ct->update_timings(ct); } @@ -345,6 +369,8 @@ comp_target_update_timings(struct comp_target *ct) static inline void comp_target_set_title(struct comp_target *ct, const char *title) { + COMP_TRACE_MARKER(); + ct->set_title(ct, title); }