From ab47d95a68e10af3c22a428d04ddd404e133b390 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Thu, 6 Feb 2025 17:46:28 +0100 Subject: [PATCH] minor lock improvement --- server/driver/wivrn_pacer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/driver/wivrn_pacer.cpp b/server/driver/wivrn_pacer.cpp index b5377ac2..f09d32f4 100644 --- a/server/driver/wivrn_pacer.cpp +++ b/server/driver/wivrn_pacer.cpp @@ -128,7 +128,6 @@ void wivrn_pacer::mark_timing_point( int64_t frame_id, int64_t when_ns) { - std::lock_guard lock(mutex); switch (point) { //! Woke up after sleeping in wait frame. @@ -146,7 +145,10 @@ void wivrn_pacer::mark_timing_point( //! Just after submitting work to the GPU. case COMP_TARGET_TIMING_POINT_SUBMIT_END: if (when_ns > last_wake_up_ns and when_ns < last_wake_up_ns + 100'000'000) + { + std::lock_guard lock(mutex); mean_wake_up_to_present_ns = std::lerp(mean_wake_up_to_present_ns, when_ns - last_wake_up_ns, 0.1); + } } }