Force client composition if we'd use rotator

HWC can only handle a certain range of scaling values, and will
fall back into rotator mode otherwise. However, there is an issue
at the moment with the rotator that leads to one missed frame
when enabling it, and we're better off with GL comp in that
case.

Add some temporary hack to force GPU composition if we detect
that the scaling value is set to a value that would put us into
rotator mode.

Test: Have some animation with a lot of scaling, observe no
jank.
Bug: 72106793
Bug: 64674361
Change-Id: I7eb55947179f4347e93caf572cc926ddbec9df9f
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 33f0796..067a09f 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -626,9 +626,15 @@
         transform = Transform(invTransform) * tr * bufferOrientation;
     }
 
+    // STOPSHIP (b/72106793): If we have less than 25% scaling, HWC usually needs to use the rotator
+    // to handle it. However, there is one guaranteed frame of jank when we switch to using the
+    // rotator. In the meantime, we force GL composition instead until we have a better fix for the
+    // HWC issue.
+    bool extremeScaling = abs(t[0][0]) <= 0.25 || abs(t[1][1]) <= 0.25;
+
     // this gives us only the "orientation" component of the transform
     const uint32_t orientation = transform.getOrientation();
-    if (orientation & Transform::ROT_INVALID) {
+    if (orientation & Transform::ROT_INVALID || extremeScaling) {
         // we can only handle simple transformation
         hwcInfo.forceClientComposition = true;
     } else {