Synchronize surface transaction

Until now the SurfaceControl transaction was being applied
asynchronously, which could lead to it being executed out of sync with
launcher drawing.
This became an issue at higher refresh rates, where frames are produced
at a much faster pace.

In order to fix this issue, we can use BLAST transactions, which are
annotated with a frame number.

Test: record video, go through it manually
Fixes: 194320152
Change-Id: I1636a1ded4f9dd84c54ba12239e3549b92ed7567
Merged-In: I1636a1ded4f9dd84c54ba12239e3549b92ed7567
This commit is contained in:
Lucas Dupin 2021-08-24 13:36:41 -07:00
parent a8382dc052
commit 0a2076e8d3
1 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import android.animation.ObjectAnimator;
import android.os.IBinder; import android.os.IBinder;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.util.FloatProperty; import android.util.FloatProperty;
import android.view.AttachedSurfaceControl;
import android.view.CrossWindowBlurListeners; import android.view.CrossWindowBlurListeners;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.view.View; import android.view.View;
@ -282,10 +283,15 @@ public class DepthController implements StateHandler<LauncherState>,
int blur = opaque || isOverview || !mCrossWindowBlursEnabled int blur = opaque || isOverview || !mCrossWindowBlursEnabled
|| mBlurDisabledForAppLaunch ? 0 : (int) (depth * mMaxBlurRadius); || mBlurDisabledForAppLaunch ? 0 : (int) (depth * mMaxBlurRadius);
new SurfaceControl.Transaction() SurfaceControl.Transaction transaction = new SurfaceControl.Transaction()
.setBackgroundBlurRadius(mSurface, blur) .setBackgroundBlurRadius(mSurface, blur)
.setOpaque(mSurface, opaque) .setOpaque(mSurface, opaque);
.apply();
AttachedSurfaceControl rootSurfaceControl =
mLauncher.getRootView().getRootSurfaceControl();
if (rootSurfaceControl != null) {
rootSurfaceControl.applyTransactionOnDraw(transaction);
}
} }
return true; return true;
} }