Pass active functor rendering threads to HWUI ADPF session
Test: unit tested
Bug: 329219352
Change-Id: I13e83030e5d0891584ba9d62fe6cc1eb332a7b74
diff --git a/libs/hwui/renderthread/HintSessionWrapper.h b/libs/hwui/renderthread/HintSessionWrapper.h
index 41891cd..14e7a53 100644
--- a/libs/hwui/renderthread/HintSessionWrapper.h
+++ b/libs/hwui/renderthread/HintSessionWrapper.h
@@ -20,6 +20,7 @@
#include <future>
#include <optional>
+#include <vector>
#include "utils/TimeUtils.h"
@@ -47,11 +48,15 @@
nsecs_t getLastUpdate();
void delayedDestroy(renderthread::RenderThread& rt, nsecs_t delay,
std::shared_ptr<HintSessionWrapper> wrapperPtr);
+ // Must be called on Render thread. Otherwise can cause a race condition.
+ void setActiveFunctorThreads(std::vector<pid_t> threadIds);
private:
APerformanceHintSession* mHintSession = nullptr;
// This needs to work concurrently for testing
std::optional<std::shared_future<APerformanceHintSession*>> mHintSessionFuture;
+ // This needs to work concurrently for testing
+ std::optional<std::shared_future<int>> mSetThreadsFuture;
int mResetsSinceLastReport = 0;
nsecs_t mLastFrameNotification = 0;
@@ -59,6 +64,8 @@
pid_t mUiThreadId;
pid_t mRenderThreadId;
+ std::vector<pid_t> mPermanentSessionTids;
+ std::vector<pid_t> mActiveFunctorTids;
bool mSessionValid = true;
@@ -82,6 +89,8 @@
void (*reportActualWorkDuration)(APerformanceHintSession* session,
int64_t actualDuration) = nullptr;
void (*sendHint)(APerformanceHintSession* session, int32_t hintId) = nullptr;
+ int (*setThreads)(APerformanceHintSession* session, const pid_t* tids,
+ size_t size) = nullptr;
private:
bool mInitialized = false;