Merge "ViewRootImpl: Use mWindowAttributes directly for BBQ" into sc-dev

This commit is contained in:
Rob Carr
2021-07-14 16:23:45 +00:00
committed by Android (Google) Code Review

View File

@@ -1955,22 +1955,23 @@ public final class ViewRootImpl implements ViewParent,
return mBoundsLayer; return mBoundsLayer;
} }
Surface getOrCreateBLASTSurface(int width, int height, Surface getOrCreateBLASTSurface() {
@Nullable WindowManager.LayoutParams params) {
if (!mSurfaceControl.isValid()) { if (!mSurfaceControl.isValid()) {
return null; return null;
} }
int format = params == null ? PixelFormat.TRANSLUCENT : params.format;
Surface ret = null; Surface ret = null;
if (mBlastBufferQueue == null) { if (mBlastBufferQueue == null) {
mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl, width, height, mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl,
format); mSurfaceSize.x, mSurfaceSize.y,
mWindowAttributes.format);
// We only return the Surface the first time, as otherwise // We only return the Surface the first time, as otherwise
// it hasn't changed and there is no need to update. // it hasn't changed and there is no need to update.
ret = mBlastBufferQueue.createSurface(); ret = mBlastBufferQueue.createSurface();
} else { } else {
mBlastBufferQueue.update(mSurfaceControl, width, height, format); mBlastBufferQueue.update(mSurfaceControl,
mSurfaceSize.x, mSurfaceSize.y,
mWindowAttributes.format);
} }
return ret; return ret;
@@ -7784,8 +7785,7 @@ public final class ViewRootImpl implements ViewParent,
if (!useBLAST()) { if (!useBLAST()) {
mSurface.copyFrom(mSurfaceControl); mSurface.copyFrom(mSurfaceControl);
} else { } else {
final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x, mSurfaceSize.y, final Surface blastSurface = getOrCreateBLASTSurface();
params);
// If blastSurface == null that means it hasn't changed since the last time we // 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 // called. In this situation, avoid calling transferFrom as we would then
// inc the generation ID and cause EGL resources to be recreated. // inc the generation ID and cause EGL resources to be recreated.