Send HWUI load reset hint when Choreographer registers a callback
Send a load reset hint hint to DrawFrameTask through ThreadedRenderer
from ViewRootImpl whenever Choreographer registers a callback. This
allows the PowerHAL to allocate more resources for HWUI in response to
upcoming work, helping prevent frame drop.
Bug: b/243938267
Test: manual
Change-Id: Ie2cf809cf85530af04f4d0db3407853d4da03d62
diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h
index d6fc292..7eae41c 100644
--- a/libs/hwui/renderthread/DrawFrameTask.h
+++ b/libs/hwui/renderthread/DrawFrameTask.h
@@ -28,6 +28,7 @@
#include "../Rect.h"
#include "../TreeInfo.h"
#include "RenderTask.h"
+#include "utils/TimeUtils.h"
namespace android {
namespace uirenderer {
@@ -90,6 +91,8 @@
void forceDrawNextFrame() { mForceDrawFrame = true; }
+ void sendLoadResetHint();
+
private:
class HintSessionWrapper {
public:
@@ -98,6 +101,7 @@
void updateTargetWorkDuration(long targetDurationNanos);
void reportActualWorkDuration(long actualDurationNanos);
+ void sendHint(SessionHint hint);
private:
APerformanceHintSession* mHintSession = nullptr;
@@ -135,6 +139,9 @@
nsecs_t mLastTargetWorkDuration = 0;
std::optional<HintSessionWrapper> mHintSessionWrapper;
+ nsecs_t mLastFrameNotification = 0;
+ nsecs_t kResetHintTimeout = 100_ms;
+
bool mForceDrawFrame = false;
};