Initialize DeviceInfo earlier.

DMS should be queried before RenderProxy is first created. Otherwise
JankTracker will be initialized with bad offset information, which
breaks the dequeue time forgiveness checks and causes apps to report
longer rendering times than they should.

Also, fix the default for the presentation deadline - the default should
align with SF's offset to be 0

Bug: 155490805
Test: builds, boots, verified that offsets are plumbed at the right
time.
Test: quickstep benchmark shows improved jank numbers

Change-Id: I51538a02969eb312df40cad5df48619433056de9
This commit is contained in:
Alec Mouri
2020-05-12 22:51:15 -07:00
parent f00f6c2145
commit 978a2cc477
2 changed files with 8 additions and 3 deletions

View File

@@ -165,6 +165,7 @@ public class HardwareRenderer {
* to opaque with no light source configured.
*/
public HardwareRenderer() {
ProcessInitializer.sInstance.initDisplayInfo();
mRootNode = RenderNode.adopt(nCreateRootRenderNode());
mRootNode.setClipToBounds(false);
mNativeProxy = nCreateProxy(!mOpaque, mIsWideGamut, mRootNode.mNativeRenderNode);
@@ -1051,6 +1052,7 @@ public class HardwareRenderer {
}
private boolean mInitialized = false;
private boolean mDisplayInitialized = false;
private boolean mIsolated = false;
private Context mContext;
@@ -1087,7 +1089,6 @@ public class HardwareRenderer {
initSched(renderProxy);
initGraphicsStats();
initDisplayInfo();
}
private void initSched(long renderProxy) {
@@ -1112,7 +1113,8 @@ public class HardwareRenderer {
}
}
private void initDisplayInfo() {
synchronized void initDisplayInfo() {
if (mDisplayInitialized) return;
if (mContext == null) return;
// If we're in an isolated sandbox mode then we shouldn't try to communicate with DMS
@@ -1120,6 +1122,7 @@ public class HardwareRenderer {
// Defensively clear out the context in case we were passed a context that can leak
// if we live longer than it, e.g. an activity context.
mContext = null;
mDisplayInitialized = true;
return;
}
@@ -1162,6 +1165,7 @@ public class HardwareRenderer {
// Defensively clear out the context
mContext = null;
mDisplayInitialized = true;
}
private void rotateBuffer() {

View File

@@ -95,7 +95,8 @@ private:
int32_t mWidth = 1080;
int32_t mHeight = 1920;
int64_t mVsyncPeriod = 16666666;
int64_t mPresentationDeadlineNanos = 0;
// Magically corresponds with an sf offset of 0 for a sane default.
int64_t mPresentationDeadlineNanos = 17666666;
int64_t mAppVsyncOffsetNanos = 0;
// Density is not retrieved from the ADisplay apis, so this may potentially