Merge "BLASTBufferQueue: Fix unnecessary copying of Surface" into rvc-dev am: 73e4cc48c7

Change-Id: Iaee4f25c5575b1d13d0e82a6caa25eb3b3f4f511
This commit is contained in:
Rob Carr
2020-04-03 21:53:34 +00:00
committed by Automerger Merge Worker

View File

@@ -1748,13 +1748,17 @@ public final class ViewRootImpl implements ViewParent,
return null;
}
Surface ret = null;
if (mBlastBufferQueue == null) {
mBlastBufferQueue = new BLASTBufferQueue(
mBlastSurfaceControl, width, height);
// We only return the Surface the first time, as otherwise
// it hasn't changed and there is no need to update.
ret = mBlastBufferQueue.getSurface();
}
mBlastBufferQueue.update(mBlastSurfaceControl, width, height);
return mBlastBufferQueue.getSurface();
return ret;
}
private void setBoundsLayerCrop() {
@@ -7349,8 +7353,14 @@ public final class ViewRootImpl implements ViewParent,
if (!mUseBLASTAdapter) {
mSurface.copyFrom(mSurfaceControl);
} else {
mSurface.transferFrom(getOrCreateBLASTSurface(mSurfaceSize.x,
mSurfaceSize.y));
final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x,
mSurfaceSize.y);
// If blastSurface == null that means it hasn't changed since the last time we
// called. In this situation, avoid calling transferFrom as we would then
// inc the generation ID and cause EGL resources to be recreated.
if (blastSurface != null) {
mSurface.transferFrom(blastSurface);
}
}
} else {
destroySurface();