WindowStateAnimator: Move HScale/VScale application to WindowState

We need to avoid calling setMatrix on WindowStateAnimator so we
don't fight with the BLASTBufferQueue.

Bug: 161937501
Test: Existing tests pass
Change-Id: I28ac9a2d1501caaea674fc31979b60b71486b602
This commit is contained in:
Robert Carr
2021-04-05 15:36:39 -07:00
committed by Rob Carr
parent a0a082b8c9
commit dae3d40c72
4 changed files with 21 additions and 42 deletions

View File

@@ -193,6 +193,12 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
"-1906387645": {
"message": "SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s",
"level": "INFO",
"group": "WM_SHOW_TRANSACTIONS",
"at": "com\/android\/server\/wm\/WindowStateAnimator.java"
},
"-1905191109": {
"message": "SyncGroup %d: Finished!",
"level": "VERBOSE",
@@ -3283,12 +3289,6 @@
"group": "WM_DEBUG_ORIENTATION",
"at": "com\/android\/server\/wm\/ActivityRecord.java"
},
"1747941491": {
"message": "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
"level": "INFO",
"group": "WM_SHOW_TRANSACTIONS",
"at": "com\/android\/server\/wm\/WindowStateAnimator.java"
},
"1756082882": {
"message": "Orientation change skips hidden %s",
"level": "VERBOSE",

View File

@@ -5354,11 +5354,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
}
}
private void updateGlobalScaleIfNeeded() {
if (mLastGlobalScale != mGlobalScale) {
private void updateScaleIfNeeded() {
if (mLastGlobalScale != mGlobalScale || mLastHScale != mHScale ||
mLastVScale != mVScale ) {
getPendingTransaction().setMatrix(getSurfaceControl(),
mGlobalScale, 0, 0, mGlobalScale);
mGlobalScale*mHScale, 0, 0, mGlobalScale*mVScale);
mLastGlobalScale = mGlobalScale;
mLastHScale = mHScale;
mLastVScale = mVScale;
}
}
@@ -5369,7 +5372,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
updateSurfacePositionNonOrganized();
// Send information to SufaceFlinger about the priority of the current window.
updateFrameRateSelectionPriorityIfNeeded();
if (isVisibleRequested()) updateGlobalScaleIfNeeded();
if (isVisibleRequested()) updateScaleIfNeeded();
mWinAnimator.prepareSurfaceLocked(getSyncTransaction());
super.prepareSurfaces();

View File

@@ -509,13 +509,6 @@ class WindowStateAnimator {
int yOffset = mYOffset;
if (!mIsWallpaper) {
mSurfaceController.setPosition(t, xOffset, yOffset);
// Wallpaper is already updated above when calling setWallpaperPositionAndScale so
// we only need to consider the non-wallpaper case here.
mSurfaceController.setMatrix(t,
w.mHScale,
w.mVScale,
w.mHScale,
w.mVScale);
} else {
setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
}
@@ -575,17 +568,12 @@ class WindowStateAnimator {
"Orientation change skips hidden %s", w);
}
} else if (mLastAlpha != mShownAlpha
|| w.mLastHScale != w.mHScale
|| w.mLastVScale != w.mVScale
|| mLastHidden) {
displayed = true;
mLastAlpha = mShownAlpha;
w.mLastHScale = w.mHScale;
w.mLastVScale = w.mVScale;
ProtoLog.i(WM_SHOW_TRANSACTIONS,
"SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
mSurfaceController, mShownAlpha, w.mHScale, w.mVScale,
w.mHScale, w.mVScale, w);
"SURFACE controller=%s alpha=%f HScale=%f, VScale=%f: %s",
mSurfaceController, mShownAlpha, w.mHScale, w.mVScale, w);
boolean prepared = true;
@@ -593,12 +581,7 @@ class WindowStateAnimator {
setWallpaperPositionAndScale(t, mXOffset, mYOffset, mWallpaperScale);
} else {
prepared =
mSurfaceController.prepareToShowInTransaction(t, mShownAlpha,
w.mHScale,
w.mVScale,
w.mHScale,
w.mVScale
);
mSurfaceController.prepareToShowInTransaction(t, mShownAlpha);
}
if (prepared && mDrawState == HAS_DRAWN) {
@@ -693,11 +676,10 @@ class WindowStateAnimator {
mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
mWin.mTmpMatrixArray[MTRANS_Y]);
mSurfaceController.setMatrix(t,
mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
mSurfaceController.setMatrix(t, mWin.mTmpMatrixArray[MSCALE_X],
mWin.mTmpMatrixArray[MSKEW_Y],
mWin.mTmpMatrixArray[MSKEW_X],
mWin.mTmpMatrixArray[MSCALE_Y]);
}
/**

View File

@@ -178,19 +178,13 @@ class WindowSurfaceController {
t.setMatrix(mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
}
boolean prepareToShowInTransaction(SurfaceControl.Transaction t, float alpha, float dsdx,
float dtdx, float dsdy, float dtdy) {
boolean prepareToShowInTransaction(SurfaceControl.Transaction t, float alpha) {
if (mSurfaceControl == null) {
return false;
}
mSurfaceAlpha = alpha;
t.setAlpha(mSurfaceControl, alpha);
mLastDsdx = dsdx;
mLastDtdx = dtdx;
mLastDsdy = dsdy;
mLastDtdy = dtdy;
t.setMatrix(mSurfaceControl, dsdx, dtdx, dsdy, dtdy);
return true;
}