Merge "BLASTBufferQueue: Fix unnecessary copying of Surface" into rvc-dev am: 73e4cc48c7 am: 1827f745ae
Change-Id: Ie1f1b9070045493827d94fae66258a007e269578
This commit is contained in:
@@ -1748,13 +1748,17 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Surface ret = null;
|
||||||
if (mBlastBufferQueue == null) {
|
if (mBlastBufferQueue == null) {
|
||||||
mBlastBufferQueue = new BLASTBufferQueue(
|
mBlastBufferQueue = new BLASTBufferQueue(
|
||||||
mBlastSurfaceControl, width, height);
|
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);
|
mBlastBufferQueue.update(mBlastSurfaceControl, width, height);
|
||||||
|
|
||||||
return mBlastBufferQueue.getSurface();
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBoundsLayerCrop() {
|
private void setBoundsLayerCrop() {
|
||||||
@@ -7349,8 +7353,14 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
if (!mUseBLASTAdapter) {
|
if (!mUseBLASTAdapter) {
|
||||||
mSurface.copyFrom(mSurfaceControl);
|
mSurface.copyFrom(mSurfaceControl);
|
||||||
} else {
|
} else {
|
||||||
mSurface.transferFrom(getOrCreateBLASTSurface(mSurfaceSize.x,
|
final Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x,
|
||||||
mSurfaceSize.y));
|
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 {
|
} else {
|
||||||
destroySurface();
|
destroySurface();
|
||||||
|
|||||||
Reference in New Issue
Block a user