The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/multi: Break potential long running tasks into functions for better trace_marker logging

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
b0c9f2a1 95e95ba9

+31 -16
+31 -16
src/xrt/compositor/multi/comp_multi_compositor.c
··· 414 414 return XRT_SUCCESS; 415 415 } 416 416 417 + static void 418 + wait_fence(struct xrt_compositor_fence **xcf_ptr) 419 + { 420 + COMP_TRACE_MARKER(); 421 + xrt_compositor_fence_wait(*xcf_ptr, UINT64_MAX); 422 + xrt_compositor_fence_destroy(xcf_ptr); 423 + } 424 + 425 + static void 426 + wait_for_scheduled_free(struct multi_compositor *mc) 427 + { 428 + COMP_TRACE_MARKER(); 429 + 430 + os_mutex_lock(&mc->slot_lock); 431 + 432 + // Block here if the scheduled slot is not clear. 433 + while (mc->scheduled.active) { 434 + os_mutex_unlock(&mc->slot_lock); 435 + 436 + os_nanosleep(U_TIME_1MS_IN_NS); 437 + 438 + os_mutex_lock(&mc->slot_lock); 439 + } 440 + 441 + slot_move_and_clear(&mc->scheduled, &mc->progress); 442 + 443 + os_mutex_unlock(&mc->slot_lock); 444 + } 445 + 417 446 static xrt_result_t 418 447 multi_compositor_layer_commit(struct xrt_compositor *xc, int64_t frame_id, xrt_graphics_sync_handle_t sync_handle) 419 448 { ··· 444 473 } while (false); // Goto without the labels. 445 474 446 475 if (xcf != NULL) { 447 - xrt_compositor_fence_wait(xcf, UINT64_MAX); 448 - xrt_compositor_fence_destroy(&xcf); 449 - } 450 - 451 - os_mutex_lock(&mc->slot_lock); 452 - 453 - // Block here if the scheduled slot is not clear. 454 - while (mc->scheduled.active) { 455 - os_mutex_unlock(&mc->slot_lock); 456 - 457 - os_nanosleep(U_TIME_1MS_IN_NS); 458 - 459 - os_mutex_lock(&mc->slot_lock); 476 + wait_fence(&xcf); 460 477 } 461 478 462 - slot_move_and_clear(&mc->scheduled, &mc->progress); 463 - 464 - os_mutex_unlock(&mc->slot_lock); 479 + wait_for_scheduled_free(mc); 465 480 466 481 os_mutex_lock(&mc->msc->list_and_timing_lock); 467 482 u_rt_mark_delivered(mc->urt, frame_id);