Improve performance for certain queries/functions in REThreaded.
Some queries into RE were already thread safe, but now they are
documented as such and avoid jumping to another thread.
Additionally all void method in REThreaded are executed in an async
strategy.
Test: librenderengine_test
Bug: 184243497
Change-Id: Id04bcccf2c90acc3e6cb6f7716f9629639b757b7
diff --git a/libs/renderengine/threaded/RenderEngineThreaded.h b/libs/renderengine/threaded/RenderEngineThreaded.h
index 117257a..61ae9b8 100644
--- a/libs/renderengine/threaded/RenderEngineThreaded.h
+++ b/libs/renderengine/threaded/RenderEngineThreaded.h
@@ -70,6 +70,7 @@
private:
void threadMain(CreateInstanceFactory factory);
+ void waitUntilInitialized() const;
/* ------------------------------------------------------------------------
* Threading
@@ -83,6 +84,12 @@
GUARDED_BY(mThreadMutex);
mutable std::condition_variable mCondition;
+ // Used to allow select thread safe methods to be accessed without requiring the
+ // method to be invoked on the RenderEngine thread
+ bool mIsInitialized = false;
+ mutable std::mutex mInitializedMutex;
+ mutable std::condition_variable mInitializedCondition;
+
/* ------------------------------------------------------------------------
* Render Engine
*/