From f90de26bc2f1a82e8691dab5f2eb4a9c153c6f71 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 2 Dec 2025 15:02:52 -0800 Subject: [PATCH] fix disable_gpu_frame_complete_metric flag (#9473) - set the flag to true (metrics disabled) until downstream is ready - make sure to exit the JobQueue thread before destroying it BUGS=[464370498] --- filament/src/details/Engine.h | 2 +- libs/utils/src/AsyncJobQueue.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/filament/src/details/Engine.h b/filament/src/details/Engine.h index ecf29a4619..4923ac1567 100644 --- a/filament/src/details/Engine.h +++ b/filament/src/details/Engine.h @@ -781,7 +781,7 @@ public: bool assert_camera_projection_near_far = CORRECTNESS_ASSERTION_DEFAULT; } debug; struct { - bool disable_gpu_frame_complete_metric = false; + bool disable_gpu_frame_complete_metric = true; } frame_info; } engine; struct { diff --git a/libs/utils/src/AsyncJobQueue.cpp b/libs/utils/src/AsyncJobQueue.cpp index 1736926c79..90021a76f4 100644 --- a/libs/utils/src/AsyncJobQueue.cpp +++ b/libs/utils/src/AsyncJobQueue.cpp @@ -55,7 +55,10 @@ AsyncJobQueue::AsyncJobQueue(const char* name, Priority priority) { } AsyncJobQueue::~AsyncJobQueue() noexcept { + // wait for all pending callbacks to be called & terminate the thread + drainAndExit(); #if !defined(__EMSCRIPTEN__) + assert_invariant(!mThread.joinable()); assert_invariant(mQueue.empty()); #endif } @@ -94,6 +97,9 @@ bool AsyncJobQueue::isValid() const noexcept { void AsyncJobQueue::drainAndExit() { #if !defined(__EMSCRIPTEN__) std::unique_lock lock(mLock); + if (mExitRequested) { + return; + } // we request the service thread to exit, but we're guaranteed that it'll only exit // after all current callbacks are processed. In addition, once mExitRequested is set, // no new jobs can be added, so we can join the thread.