From 44f48abf8a0580c75dfdc351d73d8891b3d8d21b Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Fri, 13 Sep 2024 00:54:57 +0900 Subject: [PATCH] update monado --- CMakeLists.txt | 3 +- flatpak/io.github.wivrn.wivrn.yml | 2 +- ...multi-disable-dropping-of-old-frames.patch | 6 +- ...03-c-multi-Don-t-log-frame-time-diff.patch | 6 +- ...requested-time-for-FB_face_tracking2.patch | 51 ------- ...08-Use-mipmaps-for-distortion-shader.patch | 125 +++++++----------- server/CMakeLists.txt | 1 + server/driver/hand_joints_list.cpp | 2 +- server/driver/hand_joints_list.h | 2 +- server/driver/history.h | 2 +- server/driver/pose_list.cpp | 2 +- server/driver/pose_list.h | 2 +- server/driver/view_list.cpp | 2 +- server/driver/view_list.h | 2 +- server/driver/wivrn_comp_target.cpp | 36 +++-- server/driver/wivrn_controller.cpp | 18 +-- server/driver/wivrn_controller.h | 6 +- server/driver/wivrn_eye_tracker.cpp | 6 +- server/driver/wivrn_eye_tracker.h | 2 +- server/driver/wivrn_fb_face2_tracker.cpp | 9 +- server/driver/wivrn_fb_face2_tracker.h | 2 +- server/driver/wivrn_hmd.cpp | 12 +- server/driver/wivrn_hmd.h | 4 +- server/driver/wivrn_pacer.cpp | 18 +-- server/driver/wivrn_pacer.h | 28 ++-- server/driver/wivrn_session.cpp | 2 +- server/driver/wivrn_session.h | 2 +- 27 files changed, 137 insertions(+), 216 deletions(-) delete mode 100644 patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 23cdf5b8..81f93392 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,8 @@ FetchContent_Declare(imgui EXCLUDE_FROM_ALL URL https://github.com/ocorn # Server dependencies FetchContent_Declare(monado GIT_REPOSITORY https://gitlab.freedesktop.org/monado/monado - GIT_TAG 825de0ec09cae3998cbcd891fc3fd45c6642ddff + # also change in flatpak/io.github.wivrn.wivrn.yml !!! + GIT_TAG bcbe19ddd795f182df42051e5495e9727db36c1c PATCH_COMMAND ${CMAKE_CURRENT_LIST_DIR}/patches/apply.sh ${CMAKE_CURRENT_LIST_DIR}/patches/monado/ EXCLUDE_FROM_ALL ) diff --git a/flatpak/io.github.wivrn.wivrn.yml b/flatpak/io.github.wivrn.wivrn.yml index e755a14e..318ce419 100644 --- a/flatpak/io.github.wivrn.wivrn.yml +++ b/flatpak/io.github.wivrn.wivrn.yml @@ -161,7 +161,7 @@ modules: sha256: 6f490ec1383de5855dcf801c23f0a967f888eb6e1440b6ca0bf36c12d4ae7ac7 - type: git url: https://gitlab.freedesktop.org/monado/monado - tag: 2d3978b1b0d0f1ce9fc20f435c7080a07124362a + tag: bcbe19ddd795f182df42051e5495e9727db36c1c dest: deps/monado-src - type: shell commands: diff --git a/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch b/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch index 0a9baa91..7bc6604f 100644 --- a/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch +++ b/patches/monado/0001-c-multi-disable-dropping-of-old-frames.patch @@ -8,12 +8,12 @@ Subject: [PATCH] c/multi: disable dropping of old frames 1 file changed, 7 deletions(-) diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c -index 5ddb3da64..4f517cf9c 100644 +index 00e056b33..68d042914 100644 --- a/src/xrt/compositor/multi/comp_multi_compositor.c +++ b/src/xrt/compositor/multi/comp_multi_compositor.c -@@ -182,13 +182,6 @@ wait_for_scheduled_free(struct multi_compositor *mc) +@@ -181,13 +181,6 @@ wait_for_scheduled_free(struct multi_compositor *mc) while (v_mc->scheduled.active) { - uint64_t now_ns = os_monotonic_get_ns(); + int64_t now_ns = os_monotonic_get_ns(); - // This frame is for the next frame, drop the old one no matter what. - if (time_is_within_half_ms(mc->progress.data.display_time_ns, mc->slot_next_frame_display)) { diff --git a/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch b/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch index 758791fc..f4d01b2d 100644 --- a/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch +++ b/patches/monado/0003-c-multi-Don-t-log-frame-time-diff.patch @@ -8,15 +8,15 @@ Subject: [PATCH 3/3] c/multi: Don't log frame time diff 1 file changed, 5 deletions(-) diff --git a/src/xrt/compositor/multi/comp_multi_compositor.c b/src/xrt/compositor/multi/comp_multi_compositor.c -index 4f517cf9c..f947e1209 100644 +index 68d042914..d3e244f2b 100644 --- a/src/xrt/compositor/multi/comp_multi_compositor.c +++ b/src/xrt/compositor/multi/comp_multi_compositor.c -@@ -917,11 +917,6 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa +@@ -915,11 +915,6 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, int64_t display if (time_is_greater_then_or_within_half_ms(display_time_ns, mc->scheduled.data.display_time_ns)) { slot_move_and_clear_locked(mc, &mc->delivered, &mc->scheduled); - -- uint64_t frame_time_ns = mc->delivered.data.display_time_ns; +- int64_t frame_time_ns = mc->delivered.data.display_time_ns; - if (!time_is_within_half_ms(frame_time_ns, display_time_ns)) { - log_frame_time_diff(frame_time_ns, display_time_ns); - } diff --git a/patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch b/patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch deleted file mode 100644 index c4c9ebd3..00000000 --- a/patches/monado/0007-pass-requested-time-for-FB_face_tracking2.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 1f781690a7d24551c18a6696f8c6a141cc3565c0 Mon Sep 17 00:00:00 2001 -From: galister <3123227-galister@users.noreply.gitlab.com> -Date: Mon, 19 Aug 2024 18:51:45 +0900 -Subject: [PATCH] st/oxr: pass requested time for FB_face_tracking2 - ---- - src/xrt/include/xrt/xrt_defines.h | 4 ++++ - src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c | 5 ++++- - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h -index 14f9004ad8..5e0ee4aa4d 100644 ---- a/src/xrt/include/xrt/xrt_defines.h -+++ b/src/xrt/include/xrt/xrt_defines.h -@@ -1638,6 +1638,10 @@ struct xrt_facial_expression_set2_fb - float confidences[XRT_FACE_CONFIDENCE2_COUNT_FB]; - - enum xrt_face_tracking_data_source2_fb data_source; -+ -+ // initially set to the value requested via OXR. -+ // the implementer shall ensure that the data is valid for the time provided, -+ // either by extrapolation or by overriding the time value. - uint64_t sample_time_ns; - - bool is_valid; -diff --git a/src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c b/src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c -index 9e7077106e..62c4ca2394 100644 ---- a/src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c -+++ b/src/xrt/state_trackers/oxr/oxr_face_tracking2_fb.c -@@ -115,6 +115,10 @@ oxr_get_face_expression_weights2_fb(struct oxr_logger *log, - } - struct xrt_facial_expression_set result = {0}; - -+ const struct oxr_instance *inst = face_tracker2_fb->sess->sys->inst; -+ result.face_expression_set2_fb.sample_time_ns = -+ time_state_ts_to_monotonic_ns(inst->timekeeping, expression_info->time); -+ - // spec: visual is allowed to use both camera and audio - enum xrt_input_name ft_input_name = - face_tracker2_fb->visual_enabled ? XRT_INPUT_FB_FACE_TRACKING2_VISUAL : XRT_INPUT_FB_FACE_TRACKING2_AUDIO; -@@ -132,7 +136,6 @@ oxr_get_face_expression_weights2_fb(struct oxr_logger *log, - expression_weights->isEyeFollowingBlendshapesValid = - result.face_expression_set2_fb.is_eye_following_blendshapes_valid; - -- const struct oxr_instance *inst = face_tracker2_fb->sess->sys->inst; - expression_weights->time = - time_state_monotonic_to_ts_ns(inst->timekeeping, result.face_expression_set2_fb.sample_time_ns); - --- -GitLab - diff --git a/patches/monado/0008-Use-mipmaps-for-distortion-shader.patch b/patches/monado/0008-Use-mipmaps-for-distortion-shader.patch index 81f304d2..8a6c52e3 100644 --- a/patches/monado/0008-Use-mipmaps-for-distortion-shader.patch +++ b/patches/monado/0008-Use-mipmaps-for-distortion-shader.patch @@ -14,7 +14,7 @@ Subject: [PATCH] Use mipmaps for distortion shader .../nvpro_pyramid/srgba8_mipmap_preamble.glsl | 128 +++ src/xrt/auxiliary/vk/vk_helpers.c | 1 + src/xrt/compositor/CMakeLists.txt | 6 +- - src/xrt/compositor/main/comp_renderer.c | 82 +- + src/xrt/compositor/main/comp_renderer.c | 60 +- src/xrt/compositor/main/comp_settings.c | 6 + src/xrt/compositor/main/comp_settings.h | 3 + src/xrt/compositor/render/render_compute.c | 14 + @@ -30,7 +30,7 @@ Subject: [PATCH] Use mipmaps for distortion shader src/xrt/compositor/util/comp_render_helpers.h | 26 +- src/xrt/compositor/util/comp_scratch.c | 69 +- src/xrt/compositor/util/comp_scratch.h | 7 +- - 26 files changed, 2081 insertions(+), 88 deletions(-) + 26 files changed, 2072 insertions(+), 75 deletions(-) create mode 100644 src/external/nvpro_pyramid/CMakeLists.txt create mode 100644 src/external/nvpro_pyramid/LICENSE create mode 100644 src/external/nvpro_pyramid/nvpro_pyramid.glsl @@ -1685,7 +1685,7 @@ index f7086b489..b61e42e10 100644 ret = vk->vkCreateSampler(vk->device, &info, NULL, &sampler); diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt -index 08a4b2d09..c840caa40 100644 +index f1c54ed4d..3bc9302f7 100644 --- a/src/xrt/compositor/CMakeLists.txt +++ b/src/xrt/compositor/CMakeLists.txt @@ -127,7 +127,7 @@ if(XRT_HAVE_VULKAN) @@ -1703,10 +1703,10 @@ index 08a4b2d09..c840caa40 100644 util/comp_base.c + util/comp_mipmap.h + util/comp_mipmap.cpp + util/comp_layer_accum.h + util/comp_layer_accum.c util/comp_render.h - util/comp_render_cs.c - util/comp_render_gfx.c -@@ -164,7 +166,7 @@ if(XRT_HAVE_VULKAN) +@@ -166,7 +168,7 @@ if(XRT_HAVE_VULKAN) target_link_libraries( comp_util PUBLIC xrt-interfaces @@ -1716,30 +1716,20 @@ index 08a4b2d09..c840caa40 100644 target_include_directories(comp_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) endif() diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c -index 1b295a324..e29b79b03 100644 +index 7dc8ae182..e59988b7c 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c -@@ -366,12 +366,13 @@ renderer_build_rendering_target_resources(struct comp_renderer *r, +@@ -366,6 +366,9 @@ renderer_build_rendering_target_resources(struct comp_renderer *r, VkImageView image_view = r->c->target->images[index].view; VkExtent2D extent = {r->c->target->width, r->c->target->height}; -- render_gfx_target_resources_init( // -- rtr, // -- &c->nr, // -- &r->target_render_pass, // -- image_view, // -- extent); // -+ if (!r->settings->use_compute) -+ render_gfx_target_resources_init( // -+ rtr, // -+ &c->nr, // -+ &r->target_render_pass, // -+ image_view, // -+ extent); // - } - - /*! -@@ -574,7 +575,8 @@ renderer_init(struct comp_renderer *r, struct comp_compositor *c, VkExtent2D scr ++ if (r->settings->use_compute) ++ return; ++ + render_gfx_target_resources_init( // + rtr, // + &c->nr, // +@@ -574,12 +577,16 @@ renderer_init(struct comp_renderer *r, struct comp_compositor *c, VkExtent2D scr VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); // final_layout for (uint32_t i = 0; i < c->nr.view_count; i++) { @@ -1749,36 +1739,15 @@ index 1b295a324..e29b79b03 100644 if (!bret) { COMP_ERROR(c, "comp_scratch_single_images_ensure: false"); assert(false && "Whelp, can't return an error. But should never really fail."); -@@ -583,12 +585,13 @@ renderer_init(struct comp_renderer *r, struct comp_compositor *c, VkExtent2D scr + } + ++ if (r->settings->use_compute) ++ continue; ++ for (uint32_t k = 0; k < COMP_SCRATCH_NUM_IMAGES; k++) { struct render_scratch_color_image *rsci = &c->scratch.views[i].images[k]; -- render_gfx_target_resources_init( // -- &r->scratch.views[i].targets[k], // -- &r->c->nr, // -- &r->scratch_render_pass, // -- rsci->srgb_view, // -- scratch_extent); // -+ if (!r->settings->use_compute) -+ render_gfx_target_resources_init( // -+ &r->scratch.views[i].targets[k], // -+ &r->c->nr, // -+ &r->scratch_render_pass, // -+ rsci->srgb_view, // -+ scratch_extent); // - } - } - -@@ -829,7 +832,7 @@ renderer_fini(struct comp_renderer *r) - } - } - -- // Do this after the layer renderer and targert resources. -+ // Do this after the layer renderer and target resources. - render_gfx_render_pass_close(&r->scratch_render_pass); - } - -@@ -919,18 +922,19 @@ dispatch_graphics(struct comp_renderer *r, +@@ -919,18 +926,19 @@ dispatch_graphics(struct comp_renderer *r, // Scratch image covers the whole image. struct xrt_normalized_rect layer_norm_rect = {.x = 0.0f, .y = 0.0f, .w = 1.0f, .h = 1.0f}; @@ -1794,32 +1763,32 @@ index 1b295a324..e29b79b03 100644 - rsci->srgb_view, // srgb_view - &vertex_rots[i], // vertex_rot - &viewport_datas[i]); // target_viewport_data -+ comp_render_gfx_add_view( // -+ &data, // data -+ &world_poses[i], // world_pose -+ &eye_poses[i], // eye_pose -+ &fovs[i], // fov -+ rsci_rtr, // rtr -+ &layer_viewport_data, // layer_viewport_data -+ &layer_norm_rect, // layer_norm_rect -+ rsci->image, // image -+ rsci->srgb_view, // srgb_view -+ scratch_view->info.mip_count, // mip_count -+ &vertex_rots[i], // vertex_rot -+ &viewport_datas[i]); // target_viewport_data ++ comp_render_gfx_add_view( // ++ &data, // data ++ &world_poses[i], // world_pose ++ &eye_poses[i], // eye_pose ++ &fovs[i], // fov ++ rsci_rtr, // rtr ++ &layer_viewport_data, // layer_viewport_data ++ &layer_norm_rect, // layer_norm_rect ++ rsci->image, // image ++ rsci->srgb_view, // srgb_view ++ scratch_view->info.mip_count, // mip_count ++ &vertex_rots[i], // vertex_rot ++ &viewport_datas[i]); // target_viewport_data if (layer_count == 0) { crss->views[i].used = false; -@@ -984,7 +988,7 @@ dispatch_compute(struct comp_renderer *r, +@@ -984,7 +992,7 @@ dispatch_compute(struct comp_renderer *r, // Basics - const struct comp_layer *layers = c->base.slot.layers; - uint32_t layer_count = c->base.slot.layer_count; -- bool fast_path = c->base.slot.one_projection_layer_fast_path; -+ bool fast_path = c->base.slot.one_projection_layer_fast_path && r->settings->mip_levels == 1; + const struct comp_layer *layers = c->base.layer_accum.layers; + uint32_t layer_count = c->base.layer_accum.layer_count; +- bool fast_path = c->base.frame_params.one_projection_layer_fast_path; ++ bool fast_path = c->base.frame_params.one_projection_layer_fast_path && r->settings->mip_levels == 1; bool do_timewarp = !c->debug.atw_off; // Device view information. -@@ -1037,17 +1041,19 @@ dispatch_compute(struct comp_renderer *r, +@@ -1037,17 +1045,19 @@ dispatch_compute(struct comp_renderer *r, // Scratch image covers the whole image. struct xrt_normalized_rect layer_norm_rect = {.x = 0.0f, .y = 0.0f, .w = 1.0f, .h = 1.0f}; @@ -1882,7 +1851,7 @@ index 4b2106a7d..41fa02d47 100644 s->display = debug_get_num_option_xcb_display(); diff --git a/src/xrt/compositor/main/comp_settings.h b/src/xrt/compositor/main/comp_settings.h -index 1496367c8..78b31e342 100644 +index dcb479a51..8c36902d5 100644 --- a/src/xrt/compositor/main/comp_settings.h +++ b/src/xrt/compositor/main/comp_settings.h @@ -108,6 +108,9 @@ struct comp_settings @@ -2416,10 +2385,10 @@ index 653cc0e3d..da717aa91 100644 /*! diff --git a/src/xrt/compositor/util/comp_render_cs.c b/src/xrt/compositor/util/comp_render_cs.c -index 8201407ae..e85cd511a 100644 +index 25e4a17b4..fe5a480de 100644 --- a/src/xrt/compositor/util/comp_render_cs.c +++ b/src/xrt/compositor/util/comp_render_cs.c -@@ -23,6 +23,7 @@ +@@ -25,6 +25,7 @@ #include "render/render_interface.h" @@ -2427,7 +2396,7 @@ index 8201407ae..e85cd511a 100644 #include "util/comp_render.h" #include "util/comp_render_helpers.h" #include "util/comp_base.h" -@@ -336,6 +337,92 @@ do_cs_clear(struct render_compute *crc, const struct comp_render_dispatch_data * +@@ -356,6 +357,92 @@ do_cs_clear(struct render_compute *crc, const struct comp_render_dispatch_data * target_viewport_datas); // views } @@ -2520,7 +2489,7 @@ index 8201407ae..e85cd511a 100644 static void do_cs_distortion_from_scratch(struct render_compute *crc, const struct comp_render_dispatch_data *d) { -@@ -352,6 +439,8 @@ do_cs_distortion_from_scratch(struct render_compute *crc, const struct comp_rend +@@ -372,6 +459,8 @@ do_cs_distortion_from_scratch(struct render_compute *crc, const struct comp_rend struct xrt_normalized_rect src_norm_rects[XRT_MAX_VIEWS]; for (uint32_t i = 0; i < d->view_count; i++) { @@ -2529,7 +2498,7 @@ index 8201407ae..e85cd511a 100644 // Data to be filled in. struct render_viewport_data viewport_data; VkImageView src_image_view; -@@ -733,6 +822,8 @@ comp_render_cs_dispatch(struct render_compute *crc, +@@ -753,6 +842,8 @@ comp_render_cs_dispatch(struct render_compute *crc, vds, // vds d); // d } else if (layer_count > 0) { @@ -2799,5 +2768,5 @@ index 44849c20e..f8c891e49 100644 void comp_scratch_stereo_images_free(struct comp_scratch_stereo_images *cssi, struct vk_bundle *vk); -- -2.46.0 +2.44.2 diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 0044688c..5b7c25c2 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -30,6 +30,7 @@ set(XRT_FEATURE_SLAM OFF) set(XRT_FEATURE_STEAMVR_PLUGIN OFF) set(XRT_FEATURE_WINDOW_PEEK OFF) set(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB ON) +set(XRT_FEATURE_OPENXR_HAND_TRACKING_EXT ON) set(XRT_HAVE_BLUETOOTH OFF) set(XRT_HAVE_GST OFF) diff --git a/server/driver/hand_joints_list.cpp b/server/driver/hand_joints_list.cpp index 6a604416..185e70b2 100644 --- a/server/driver/hand_joints_list.cpp +++ b/server/driver/hand_joints_list.cpp @@ -46,7 +46,7 @@ xrt_hand_joint_set hand_joints_list::interpolate(const xrt_hand_joint_set & a, c return j; } -xrt_hand_joint_set hand_joints_list::extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, uint64_t ta, uint64_t tb, uint64_t t) +xrt_hand_joint_set hand_joints_list::extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, int64_t ta, int64_t tb, int64_t t) { xrt_hand_joint_set j = t <= ta ? a : b; // Only extrapolate the hand pose, individual joints are too noisy diff --git a/server/driver/hand_joints_list.h b/server/driver/hand_joints_list.h index 524b9382..0800a1b1 100644 --- a/server/driver/hand_joints_list.h +++ b/server/driver/hand_joints_list.h @@ -28,7 +28,7 @@ public: const int hand_id; static xrt_hand_joint_set interpolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, float t); - static xrt_hand_joint_set extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, uint64_t ta, uint64_t tb, uint64_t t); + static xrt_hand_joint_set extrapolate(const xrt_hand_joint_set & a, const xrt_hand_joint_set & b, int64_t ta, int64_t tb, int64_t t); hand_joints_list(int hand_id) : hand_id(hand_id) {} diff --git a/server/driver/history.h b/server/driver/history.h index 1eb57dda..f45bcc3e 100644 --- a/server/driver/history.h +++ b/server/driver/history.h @@ -86,7 +86,7 @@ protected: } // Insert the new sample - auto it = std::lower_bound(data.begin(), data.end(), t, [](TimedData & sample, uint64_t t) { return sample.at_timestamp_ns < t; }); + auto it = std::lower_bound(data.begin(), data.end(), t, [](TimedData & sample, int64_t t) { return sample.at_timestamp_ns < t; }); if (it == data.end()) data.emplace_back(sample, produced, t); else if (it->at_timestamp_ns == t) diff --git a/server/driver/pose_list.cpp b/server/driver/pose_list.cpp index d35e9fe7..74f3c974 100644 --- a/server/driver/pose_list.cpp +++ b/server/driver/pose_list.cpp @@ -35,7 +35,7 @@ xrt_space_relation pose_list::interpolate(const xrt_space_relation & a, const xr return result; } -xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, uint64_t ta, uint64_t tb, uint64_t t) +xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, int64_t ta, int64_t tb, int64_t t) { float h = (tb - ta) / 1.e9; diff --git a/server/driver/pose_list.h b/server/driver/pose_list.h index e54bff63..6b81f979 100644 --- a/server/driver/pose_list.h +++ b/server/driver/pose_list.h @@ -30,7 +30,7 @@ public: const xrt::drivers::wivrn::device_id device; static xrt_space_relation interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t); - static xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, uint64_t ta, uint64_t tb, uint64_t t); + static xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_relation & b, int64_t ta, int64_t tb, int64_t t); pose_list(xrt::drivers::wivrn::device_id id) : device(id) {} diff --git a/server/driver/view_list.cpp b/server/driver/view_list.cpp index 90367f9a..81f88561 100644 --- a/server/driver/view_list.cpp +++ b/server/driver/view_list.cpp @@ -28,7 +28,7 @@ tracked_views view_list::interpolate(const tracked_views & a, const tracked_view return result; } -tracked_views view_list::extrapolate(const tracked_views & a, const tracked_views & b, uint64_t ta, uint64_t tb, uint64_t t) +tracked_views view_list::extrapolate(const tracked_views & a, const tracked_views & b, int64_t ta, int64_t tb, int64_t t) { tracked_views result = t < ta ? a : b; result.relation = pose_list::extrapolate(a.relation, b.relation, ta, tb, t); diff --git a/server/driver/view_list.h b/server/driver/view_list.h index e92d8d3b..4e35e584 100644 --- a/server/driver/view_list.h +++ b/server/driver/view_list.h @@ -34,7 +34,7 @@ class view_list : public history { public: static tracked_views interpolate(const tracked_views & a, const tracked_views & b, float t); - static tracked_views extrapolate(const tracked_views & a, const tracked_views & b, uint64_t ta, uint64_t tb, uint64_t t); + static tracked_views extrapolate(const tracked_views & a, const tracked_views & b, int64_t ta, int64_t tb, int64_t t); bool update_tracking(const from_headset::tracking & tracking, const clock_offset & offset); }; diff --git a/server/driver/wivrn_comp_target.cpp b/server/driver/wivrn_comp_target.cpp index af60e1bf..90824b7c 100644 --- a/server/driver/wivrn_comp_target.cpp +++ b/server/driver/wivrn_comp_target.cpp @@ -262,9 +262,9 @@ static bool comp_wivrn_check_ready(struct comp_target * ct) cn->c->debug.atw_off = true; for (int eye = 0; eye < 2; ++eye) { - const auto & slot = cn->c->base.slot; - if (slot.layer_count > 1 or - slot.layers[0].data.type != XRT_LAYER_PROJECTION) + const auto & layer_accum = cn->c->base.layer_accum; + if (layer_accum.layer_count > 1 or + layer_accum.layers[0].data.type != XRT_LAYER_PROJECTION) { // We are not in the trivial single stereo projection layer // reprojection must be done @@ -320,8 +320,6 @@ static void comp_wivrn_create_images(struct comp_target * ct, const struct comp_ { struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct; - uint64_t now_ns = os_monotonic_get_ns(); - // Free old images. destroy_images(cn); @@ -433,8 +431,8 @@ static VkResult comp_wivrn_present(struct comp_target * ct, VkQueue queue_, uint32_t index, uint64_t timeline_semaphore_value, - uint64_t desired_present_time_ns, - uint64_t present_slop_ns) + int64_t desired_present_time_ns, + int64_t present_slop_ns) { struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct; @@ -452,7 +450,7 @@ static VkResult comp_wivrn_present(struct comp_target * ct, .pWaitDstStageMask = &wait_stage, }; - if (cn->c->base.slot.layer_count == 0 or not cn->cnx->get_offset()) + if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx->get_offset()) { scoped_lock lock(vk->queue_mutex); cn->wivrn_bundle->queue.submit(submit_info); @@ -489,19 +487,19 @@ static VkResult comp_wivrn_present(struct comp_target * ct, view_info.display_time = cn->cnx->get_offset().to_headset(info.predicted_display_time); for (int eye = 0; eye < 2; ++eye) { - const auto & slot = cn->c->base.slot; - view_info.fov[eye] = xrt_cast(slot.fovs[eye]); - view_info.pose[eye] = xrt_cast(slot.poses[eye]); + const auto & frame_params = cn->c->base.frame_params; + view_info.fov[eye] = xrt_cast(frame_params.fovs[eye]); + view_info.pose[eye] = xrt_cast(frame_params.poses[eye]); if (cn->c->debug.atw_off) { - const auto & proj = slot.layers[0].data.proj; + const auto & proj = cn->c->base.layer_accum.layers[0].data.proj; view_info.pose[eye] = xrt_cast(proj.v[eye].pose); } else { xrt_relation_chain xrc{}; xrt_space_relation result{}; - m_relation_chain_push_pose_if_not_identity(&xrc, &slot.poses[eye]); + m_relation_chain_push_pose_if_not_identity(&xrc, &frame_params.poses[eye]); m_relation_chain_resolve(&xrc, &result); view_info.pose[eye] = xrt_cast(result.pose); } @@ -540,10 +538,10 @@ static void comp_wivrn_flush(struct comp_target * ct) static void comp_wivrn_calc_frame_pacing(struct comp_target * ct, int64_t * out_frame_id, - uint64_t * out_wake_up_time_ns, - uint64_t * out_desired_present_time_ns, - uint64_t * out_present_slop_ns, - uint64_t * out_predicted_display_time_ns) + int64_t * out_wake_up_time_ns, + int64_t * out_desired_present_time_ns, + int64_t * out_present_slop_ns, + int64_t * out_predicted_display_time_ns) { struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct; @@ -558,7 +556,7 @@ static void comp_wivrn_calc_frame_pacing(struct comp_target * ct, static void comp_wivrn_mark_timing_point(struct comp_target * ct, enum comp_target_timing_point point, int64_t frame_id, - uint64_t when_ns) + int64_t when_ns) { struct wivrn_comp_target * cn = (struct wivrn_comp_target *)ct; @@ -603,7 +601,7 @@ static void comp_wivrn_destroy(struct comp_target * ct) delete (struct wivrn_comp_target *)ct; } -static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns) +static void comp_wivrn_info_gpu(struct comp_target * ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns) { COMP_TRACE_MARKER(); } diff --git a/server/driver/wivrn_controller.cpp b/server/driver/wivrn_controller.cpp index ab63c568..da5efb40 100644 --- a/server/driver/wivrn_controller.cpp +++ b/server/driver/wivrn_controller.cpp @@ -135,14 +135,14 @@ static void wivrn_controller_destroy(xrt_device * xdev); static void wivrn_controller_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation); static void wivrn_controller_get_hand_tracking(xrt_device * xdev, xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, - uint64_t * out_timestamp_ns); + int64_t * out_timestamp_ns); static void wivrn_controller_set_output(struct xrt_device * xdev, enum xrt_output_name name, const union xrt_output_value * value); @@ -261,7 +261,7 @@ void wivrn_controller::set_inputs(const from_headset::inputs & inputs, const clo } } -void wivrn_controller::set_inputs(device_id input_id, float value, uint64_t last_change_time) +void wivrn_controller::set_inputs(device_id input_id, float value, int64_t last_change_time) { const struct wivrn_to_wivrn_controller_input * bindings; size_t bindings_count; @@ -307,7 +307,7 @@ void wivrn_controller::set_inputs(device_id input_id, float value, uint64_t last } } -xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns) +xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns) { std::chrono::nanoseconds extrapolation_time; xrt_space_relation res; @@ -329,7 +329,7 @@ xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, uint6 return res; } -std::pair wivrn_controller::get_hand_tracking(xrt_input_name name, uint64_t desired_timestamp_ns) +std::pair wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns) { switch (name) { @@ -398,7 +398,7 @@ static void wivrn_controller_update_inputs(xrt_device * xdev) static void wivrn_controller_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation) { *out_relation = static_cast(xdev)->get_tracked_pose(name, at_timestamp_ns); @@ -406,9 +406,9 @@ static void wivrn_controller_get_tracked_pose(xrt_device * xdev, static void wivrn_controller_get_hand_tracking(xrt_device * xdev, xrt_input_name name, - uint64_t desired_timestamp_ns, + int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, - uint64_t * out_timestamp_ns) + int64_t * out_timestamp_ns) { std::tie(*out_value, *out_timestamp_ns) = static_cast(xdev)->get_hand_tracking(name, desired_timestamp_ns); } diff --git a/server/driver/wivrn_controller.h b/server/driver/wivrn_controller.h index fe3cd329..76301612 100644 --- a/server/driver/wivrn_controller.h +++ b/server/driver/wivrn_controller.h @@ -52,8 +52,8 @@ public: } void update_inputs(); - xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns); - std::pair get_hand_tracking(xrt_input_name name, uint64_t desired_timestamp_ns); + xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns); + std::pair get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns); void set_output(xrt_output_name name, const xrt_output_value * value); @@ -63,5 +63,5 @@ public: void update_hand_tracking(const from_headset::hand_tracking &, const clock_offset &); private: - void set_inputs(device_id input_id, float value, uint64_t last_change_time); + void set_inputs(device_id input_id, float value, int64_t last_change_time); }; diff --git a/server/driver/wivrn_eye_tracker.cpp b/server/driver/wivrn_eye_tracker.cpp index 82a45802..7bbad490 100644 --- a/server/driver/wivrn_eye_tracker.cpp +++ b/server/driver/wivrn_eye_tracker.cpp @@ -36,7 +36,7 @@ static void wivrn_eye_tracker_update_inputs(xrt_device * xdev); static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation); wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd, @@ -70,7 +70,7 @@ void wivrn_eye_tracker::update_inputs() // Empty } -xrt_space_relation wivrn_eye_tracker::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns) +xrt_space_relation wivrn_eye_tracker::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns) { if (name == XRT_INPUT_GENERIC_EYE_GAZE_POSE) { @@ -105,7 +105,7 @@ static void wivrn_eye_tracker_update_inputs(xrt_device * xdev) static void wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation) { *out_relation = static_cast(xdev)->get_tracked_pose(name, at_timestamp_ns); diff --git a/server/driver/wivrn_eye_tracker.h b/server/driver/wivrn_eye_tracker.h index 428de797..3c719bf2 100644 --- a/server/driver/wivrn_eye_tracker.h +++ b/server/driver/wivrn_eye_tracker.h @@ -49,5 +49,5 @@ public: void update_inputs(); void update_tracking(const from_headset::tracking &, const clock_offset &); - xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns); + xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns); }; diff --git a/server/driver/wivrn_fb_face2_tracker.cpp b/server/driver/wivrn_fb_face2_tracker.cpp index 90cf9503..803eb0ab 100644 --- a/server/driver/wivrn_fb_face2_tracker.cpp +++ b/server/driver/wivrn_fb_face2_tracker.cpp @@ -28,6 +28,7 @@ #include "xrt/xrt_results.h" #include +#include #include #include @@ -37,6 +38,7 @@ static void wivrn_fb_face2_tracker_update_inputs(xrt_device * xdev); static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device * xdev, enum xrt_input_name facial_expression_type, + int64_t at_timestamp_ns, struct xrt_facial_expression_set * out_value); wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd, @@ -83,12 +85,12 @@ void wivrn_fb_face2_tracker::update_tracking(const from_headset::fb_face2 & face cnx->set_enabled(to_headset::tracking_control::id::face, false); } -xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set * inout_value) +xrt_result_t wivrn_fb_face2_tracker::get_face_tracking(enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set * inout_value) { if (facial_expression_type == XRT_INPUT_FB_FACE_TRACKING2_VISUAL) { cnx->set_enabled(to_headset::tracking_control::id::face, true); - auto [_, data] = face_list.get_at(inout_value->face_expression_set2_fb.sample_time_ns); + auto [_, data] = face_list.get_at(at_timestamp_ns); inout_value->face_expression_set2_fb.is_valid = data.is_valid; @@ -126,7 +128,8 @@ static void wivrn_fb_face2_tracker_update_inputs(xrt_device * xdev) static xrt_result_t wivrn_fb_face2_tracker_get_face_tracking(struct xrt_device * xdev, enum xrt_input_name facial_expression_type, + int64_t at_timestamp_ns, struct xrt_facial_expression_set * inout_value) { - return static_cast(xdev)->get_face_tracking(facial_expression_type, inout_value); + return static_cast(xdev)->get_face_tracking(facial_expression_type, at_timestamp_ns, inout_value); } diff --git a/server/driver/wivrn_fb_face2_tracker.h b/server/driver/wivrn_fb_face2_tracker.h index 584f6ace..01e9fb10 100644 --- a/server/driver/wivrn_fb_face2_tracker.h +++ b/server/driver/wivrn_fb_face2_tracker.h @@ -97,5 +97,5 @@ public: void update_inputs(); void update_tracking(const from_headset::fb_face2 &, const clock_offset &); - xrt_result_t get_face_tracking(enum xrt_input_name facial_expression_type, struct xrt_facial_expression_set * out_value); + xrt_result_t get_face_tracking(enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, struct xrt_facial_expression_set * out_value); }; diff --git a/server/driver/wivrn_hmd.cpp b/server/driver/wivrn_hmd.cpp index 77ed895f..ef7fa43b 100644 --- a/server/driver/wivrn_hmd.cpp +++ b/server/driver/wivrn_hmd.cpp @@ -58,12 +58,12 @@ static void wivrn_hmd_update_inputs(xrt_device * xdev); static void wivrn_hmd_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation); static void wivrn_hmd_get_view_poses(xrt_device * xdev, const xrt_vec3 * default_eye_relation, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, uint32_t view_count, xrt_space_relation * out_head_relation, xrt_fov * out_fovs, @@ -264,7 +264,7 @@ void wivrn_hmd::update_inputs() // Empty } -xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns) +xrt_space_relation wivrn_hmd::get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) { @@ -291,7 +291,7 @@ void wivrn_hmd::update_battery(const from_headset::battery & new_battery) } void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, uint32_t view_count, xrt_space_relation * out_head_relation, xrt_fov * out_fovs, @@ -431,7 +431,7 @@ static void wivrn_hmd_update_inputs(xrt_device * xdev) static void wivrn_hmd_get_tracked_pose(xrt_device * xdev, xrt_input_name name, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, xrt_space_relation * out_relation) { *out_relation = static_cast(xdev)->get_tracked_pose(name, at_timestamp_ns); @@ -439,7 +439,7 @@ static void wivrn_hmd_get_tracked_pose(xrt_device * xdev, static void wivrn_hmd_get_view_poses(xrt_device * xdev, const xrt_vec3 * default_eye_relation, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, uint32_t view_count, xrt_space_relation * out_head_relation, xrt_fov * out_fovs, diff --git a/server/driver/wivrn_hmd.h b/server/driver/wivrn_hmd.h index b617e6bd..0f05d14b 100644 --- a/server/driver/wivrn_hmd.h +++ b/server/driver/wivrn_hmd.h @@ -63,10 +63,10 @@ public: } void update_inputs(); - xrt_space_relation get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns); + xrt_space_relation get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns); comp_target * create_compositor_target(struct comp_compositor * comp); void get_view_poses(const xrt_vec3 * default_eye_relation, - uint64_t at_timestamp_ns, + int64_t at_timestamp_ns, uint32_t view_count, xrt_space_relation * out_head_relation, xrt_fov * out_fovs, diff --git a/server/driver/wivrn_pacer.cpp b/server/driver/wivrn_pacer.cpp index 50862247..d545f812 100644 --- a/server/driver/wivrn_pacer.cpp +++ b/server/driver/wivrn_pacer.cpp @@ -37,16 +37,16 @@ void wivrn_pacer::set_stream_count(size_t count) void wivrn_pacer::predict( int64_t & frame_id, - uint64_t & out_wake_up_time_ns, - uint64_t & out_desired_present_time_ns, - uint64_t & out_present_slop_ns, - uint64_t & out_predicted_display_time_ns) + int64_t & out_wake_up_time_ns, + int64_t & out_desired_present_time_ns, + int64_t & out_present_slop_ns, + int64_t & out_predicted_display_time_ns) { std::lock_guard lock(mutex); frame_id = this->frame_id++; auto now = os_monotonic_get_ns(); - uint64_t predicted_client_render = last_ns + frame_duration_ns; + int64_t predicted_client_render = last_ns + frame_duration_ns; // snap to phase predicted_client_render = (predicted_client_render / frame_duration_ns) * frame_duration_ns + client_render_phase_ns; @@ -89,7 +89,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback if (feedback.stream_index == 0) { - uint64_t safe_time = 0; + int64_t safe_time = 0; for (const auto & stream: streams) { if (stream.times.size() >= min_wait_times) @@ -109,7 +109,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback time_variance /= (stream.times.size() - 1); double time_std_dev = std::sqrt(time_variance); - safe_time = std::max(safe_time, mean_time + 3 * time_std_dev); + safe_time = std::max(safe_time, mean_time + 3 * time_std_dev); } } if (safe_time > 0 and safe_time < 100'000'000) @@ -124,7 +124,7 @@ void wivrn_pacer::on_feedback(const xrt::drivers::wivrn::from_headset::feedback void wivrn_pacer::mark_timing_point( comp_target_timing_point point, int64_t frame_id, - uint64_t when_ns) + int64_t when_ns) { std::lock_guard lock(mutex); switch (point) @@ -149,7 +149,7 @@ void wivrn_pacer::mark_timing_point( } } -wivrn_pacer::frame_info wivrn_pacer::present_to_info(uint64_t present) +wivrn_pacer::frame_info wivrn_pacer::present_to_info(int64_t present) { std::lock_guard lock(mutex); for (const auto & info: in_flight_frames) diff --git a/server/driver/wivrn_pacer.h b/server/driver/wivrn_pacer.h index 2d68309b..cd5a8b29 100644 --- a/server/driver/wivrn_pacer.h +++ b/server/driver/wivrn_pacer.h @@ -35,22 +35,22 @@ public: struct frame_info { int64_t frame_id; - uint64_t present_ns; - uint64_t predicted_display_time; + int64_t present_ns; + int64_t predicted_display_time; }; private: std::mutex mutex; - uint64_t last_ns = 0; + int64_t last_ns = 0; int64_t frame_id = 0; - uint64_t client_render_phase_ns = 0; + int64_t client_render_phase_ns = 0; - uint64_t mean_wake_up_to_present_ns = 1'000'000; - uint64_t safe_present_to_decoded_ns = 0; - uint64_t mean_render_to_display_ns = 0; + int64_t mean_wake_up_to_present_ns = 1'000'000; + int64_t safe_present_to_decoded_ns = 0; + int64_t mean_render_to_display_ns = 0; - uint64_t last_wake_up_ns = 0; + int64_t last_wake_up_ns = 0; // Client wait time for each decoder struct stream_data @@ -73,19 +73,19 @@ public: void predict( int64_t & out_frame_id, - uint64_t & out_wake_up_time_ns, - uint64_t & out_desired_present_time_ns, - uint64_t & out_present_slop_ns, - uint64_t & out_predicted_display_time_ns); + int64_t & out_wake_up_time_ns, + int64_t & out_desired_present_time_ns, + int64_t & out_present_slop_ns, + int64_t & out_predicted_display_time_ns); void on_feedback(const xrt::drivers::wivrn::from_headset::feedback &, const clock_offset &); void mark_timing_point( comp_target_timing_point point, int64_t frame_id, - uint64_t when_ns); + int64_t when_ns); - frame_info present_to_info(uint64_t present); + frame_info present_to_info(int64_t present); void reset(); }; diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index f3b3770d..14fd288a 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -457,7 +457,7 @@ std::array wivrn_session::get_foveation_para return hmd->get_foveation_parameters(); } -void wivrn_session::dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream, const char * extra) +void wivrn_session::dump_time(const std::string & event, uint64_t frame, int64_t time, uint8_t stream, const char * extra) { if (feedback_csv) { diff --git a/server/driver/wivrn_session.h b/server/driver/wivrn_session.h index b1349401..81b7c298 100644 --- a/server/driver/wivrn_session.h +++ b/server/driver/wivrn_session.h @@ -165,7 +165,7 @@ public: return (bool)foveation; } - void dump_time(const std::string & event, uint64_t frame, uint64_t time, uint8_t stream = -1, const char * extra = ""); + void dump_time(const std::string & event, uint64_t frame, int64_t time, uint8_t stream = -1, const char * extra = ""); private: static void run(std::weak_ptr);