Merge "Set mSyncBuffer to true when VRI did not initiate the sync request" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
700cdec45b
@@ -967,7 +967,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
|||||||
final boolean redrawNeeded = sizeChanged || creating || hintChanged
|
final boolean redrawNeeded = sizeChanged || creating || hintChanged
|
||||||
|| (mVisible && !mDrawFinished);
|
|| (mVisible && !mDrawFinished);
|
||||||
boolean shouldSyncBuffer =
|
boolean shouldSyncBuffer =
|
||||||
redrawNeeded && viewRoot.wasRelayoutRequested() && viewRoot.isInSync();
|
redrawNeeded && viewRoot.wasRelayoutRequested() && viewRoot.isInLocalSync();
|
||||||
SyncBufferTransactionCallback syncBufferTransactionCallback = null;
|
SyncBufferTransactionCallback syncBufferTransactionCallback = null;
|
||||||
if (shouldSyncBuffer) {
|
if (shouldSyncBuffer) {
|
||||||
syncBufferTransactionCallback = new SyncBufferTransactionCallback();
|
syncBufferTransactionCallback = new SyncBufferTransactionCallback();
|
||||||
|
|||||||
@@ -319,6 +319,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
*/
|
*/
|
||||||
private static final int SCROLL_CAPTURE_REQUEST_TIMEOUT_MILLIS = 2500;
|
private static final int SCROLL_CAPTURE_REQUEST_TIMEOUT_MILLIS = 2500;
|
||||||
|
|
||||||
|
private static final int UNSET_SYNC_ID = -1;
|
||||||
|
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||||
static final ThreadLocal<HandlerActionQueue> sRunQueues = new ThreadLocal<HandlerActionQueue>();
|
static final ThreadLocal<HandlerActionQueue> sRunQueues = new ThreadLocal<HandlerActionQueue>();
|
||||||
|
|
||||||
@@ -815,7 +817,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final SurfaceSyncer mSurfaceSyncer = new SurfaceSyncer();
|
private final SurfaceSyncer mSurfaceSyncer = new SurfaceSyncer();
|
||||||
private int mLastSyncId = -1;
|
private int mSyncId = UNSET_SYNC_ID;
|
||||||
private SurfaceSyncer.SyncBufferCallback mSyncBufferCallback;
|
private SurfaceSyncer.SyncBufferCallback mSyncBufferCallback;
|
||||||
private int mNumSyncsInProgress = 0;
|
private int mNumSyncsInProgress = 0;
|
||||||
|
|
||||||
@@ -3463,21 +3465,21 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mReportNextDraw = false;
|
mReportNextDraw = false;
|
||||||
mSyncBufferCallback = null;
|
mSyncBufferCallback = null;
|
||||||
mSyncBuffer = false;
|
mSyncBuffer = false;
|
||||||
if (mLastSyncId != -1) {
|
if (isInLocalSync()) {
|
||||||
mSurfaceSyncer.markSyncReady(mLastSyncId);
|
mSurfaceSyncer.markSyncReady(mSyncId);
|
||||||
mLastSyncId = -1;
|
mSyncId = UNSET_SYNC_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSyncIfNeeded() {
|
private void createSyncIfNeeded() {
|
||||||
// Started a sync already or there's nothing needing to sync
|
// Started a sync already or there's nothing needing to sync
|
||||||
if (mLastSyncId != -1 || !mReportNextDraw) {
|
if (isInLocalSync() || !mReportNextDraw) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int seqId = mSyncSeqId;
|
final int seqId = mSyncSeqId;
|
||||||
mLastSyncId = mSurfaceSyncer.setupSync(transaction -> {
|
mSyncId = mSurfaceSyncer.setupSync(transaction -> {
|
||||||
// Callback will be invoked on executor thread so post to main thread.
|
// Callback will be invoked on executor thread so post to main thread.
|
||||||
mHandler.postAtFrontOfQueue(() -> {
|
mHandler.postAtFrontOfQueue(() -> {
|
||||||
mSurfaceChangedTransaction.merge(transaction);
|
mSurfaceChangedTransaction.merge(transaction);
|
||||||
@@ -3485,9 +3487,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (DEBUG_BLAST) {
|
if (DEBUG_BLAST) {
|
||||||
Log.d(mTag, "Setup new sync id=" + mLastSyncId);
|
Log.d(mTag, "Setup new sync id=" + mSyncId);
|
||||||
}
|
}
|
||||||
mSurfaceSyncer.addToSync(mLastSyncId, mSyncTarget);
|
mSurfaceSyncer.addToSync(mSyncId, mSyncTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyContentCatpureEvents() {
|
private void notifyContentCatpureEvents() {
|
||||||
@@ -4123,17 +4125,19 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
return mAttachInfo.mThreadedRenderer != null && mAttachInfo.mThreadedRenderer.isEnabled();
|
return mAttachInfo.mThreadedRenderer != null && mAttachInfo.mThreadedRenderer.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean addToSync(SurfaceSyncer.SyncTarget syncable) {
|
void addToSync(SurfaceSyncer.SyncTarget syncable) {
|
||||||
if (mLastSyncId == -1) {
|
if (!isInLocalSync()) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
mSurfaceSyncer.addToSync(mLastSyncId, syncable);
|
mSurfaceSyncer.addToSync(mSyncId, syncable);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public boolean isInSync() {
|
* This VRI is currently in the middle of a sync request, but specifically one initiated from
|
||||||
return mLastSyncId != -1;
|
* within VRI.
|
||||||
|
*/
|
||||||
|
public boolean isInLocalSync() {
|
||||||
|
return mSyncId != UNSET_SYNC_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFrameCommitCallbackIfNeeded() {
|
private void addFrameCommitCallbackIfNeeded() {
|
||||||
@@ -10895,6 +10899,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
private void readyToSync(SurfaceSyncer.SyncBufferCallback syncBufferCallback) {
|
private void readyToSync(SurfaceSyncer.SyncBufferCallback syncBufferCallback) {
|
||||||
mNumSyncsInProgress++;
|
mNumSyncsInProgress++;
|
||||||
|
if (!isInLocalSync()) {
|
||||||
|
// Always sync the buffer if the sync request did not come from VRI.
|
||||||
|
mSyncBuffer = true;
|
||||||
|
}
|
||||||
if (mAttachInfo.mThreadedRenderer != null) {
|
if (mAttachInfo.mThreadedRenderer != null) {
|
||||||
HardwareRenderer.setRtAnimationsEnabled(false);
|
HardwareRenderer.setRtAnimationsEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user