Only updateBoundsSurface when surface size has changed.
Currently, updateBoundsSurface was getting called when the surface changed, not just when the size changed. This meant it could be calling setWindowCrop and deferTransaction when no size had changed. If size hadn't changed, there was a high possibility that no new frames would be submitted by the client, causing the deferTransaction to wait forever. Since the deferTransaction was still waiting, SurfaceFlinger would wake up every vsync to check if it should call doTransaction for the deferred transaction. This caused 60Hz composition even when frames were rendered slower. Fixes: 132110524 Test: SF doesn't compose 30fps app at 60Hz Change-Id: Icf3a99b34c288575438bfcd05e9077ea7919b4ca
This commit is contained in:
@@ -2209,6 +2209,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
final boolean isViewVisible = viewVisibility == View.VISIBLE;
|
||||
final boolean windowRelayoutWasForced = mForceNextWindowRelayout;
|
||||
boolean surfaceSizeChanged = false;
|
||||
|
||||
if (mFirst || windowShouldResize || insetsChanged ||
|
||||
viewVisibilityChanged || params != null || mForceNextWindowRelayout) {
|
||||
mForceNextWindowRelayout = false;
|
||||
@@ -2287,7 +2289,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final boolean cutoutChanged = !mPendingDisplayCutout.equals(
|
||||
mAttachInfo.mDisplayCutout);
|
||||
final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets);
|
||||
final boolean surfaceSizeChanged = (relayoutResult
|
||||
surfaceSizeChanged = (relayoutResult
|
||||
& WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0;
|
||||
surfaceChanged |= surfaceSizeChanged;
|
||||
final boolean alwaysConsumeSystemBarsChanged =
|
||||
@@ -2570,7 +2572,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
maybeHandleWindowMove(frame);
|
||||
}
|
||||
|
||||
if (surfaceChanged) {
|
||||
if (surfaceSizeChanged) {
|
||||
updateBoundsSurface();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user