summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.cpp
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2021-03-18 16:50:38 -0400
committerWei Wang <wvw@google.com>2021-04-10 10:21:17 -0700
commit027b2188473bd48c34cdafad1705abac7fff9356 (patch)
tree45cb7aef285e3bd1acf62ed2170d122f63953140 /libs/hwui/renderthread/RenderProxy.cpp
parent25318b7316a72f5fd2fa170825199f985daf29b7 (diff)
Integrate HWUI with PerformanceHintManager
PerformanceHintManager.Session is in java, so add JNI and a HintSessionWrapper class in HardwareRenderer. Then pass the two calls as two std::functions into DrawFrameTask. Note Session is created per HardwareRenderer, not global (per RenderThread). Session includes UI thread, render thread, and the thread pool. Desired duration is from the intended start duration to the frame deadline. Add an actual frame start time to compute Add system properties: debug.hwui.use_hint_manager to enable PerformanceHintManager debug.hwui.target_cpu_time_percent to control percentage of frame time to be used for target cpu duration. Test: Manual test that there are no crashes and values make sense. Bug: 158791282 Change-Id: I83f25433c10daa20033803fb7c4ae45eab34f1d3
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 423cc08189ca..9361abd20852 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -76,6 +76,12 @@ void RenderProxy::setName(const char* name) {
mRenderThread.queue().runSync([this, name]() { mContext->setName(std::string(name)); });
}
+void RenderProxy::setHintSessionCallbacks(std::function<void(int64_t)> updateTargetWorkDuration,
+ std::function<void(int64_t)> reportActualWorkDuration) {
+ mDrawFrameTask.setHintSessionCallbacks(std::move(updateTargetWorkDuration),
+ std::move(reportActualWorkDuration));
+}
+
void RenderProxy::setSurface(ANativeWindow* window, bool enableTimeout) {
if (window) { ANativeWindow_acquire(window); }
mRenderThread.queue().post([this, win = window, enableTimeout]() mutable {