Extend shadow display frame by 2x shadow length instead of 1x

Some HWC implementations try to save bandwidth by scanning out the union
of client composited display frames within the client target buffer. To
prevent clipping shadows casted from a window, we expanded the
displayFrame by the size of the shadow. But, in practice, shadows are
blurred, so they fade out over more pixels than might be expected. So,
expand the displayFrame by double the size of the shadow.

2x the shadow length is chosen, because:
* The shadow length is converted to a sigma parameter for a gaussian blur
  by dividing by sqrt(3)
* Skia's gaussian blur implementation bounds the blur 3 * sigma
* So, casting a shadow should draw about sqrt(3) * length pixels beyond
  the edge of the window.
* Round sqrt(3) up to 2, to be conservative

This should be low risk change, as we're already forcing client
composition for casting a shadow, so no HWC implementations ought to be
inspecting the display frame except for the optimization described
above, and this patch can only relax that optimization.

Bug: 327427072
Flag: EXEMPT bug fix
Test: Enable desktop windowing, and check that shadows aren't clipping
Change-Id: Ia2d8b4a02aeab3cfeb9f2a01c08cc136cb221aea
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 091c207..9b05084 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -223,7 +223,9 @@
     // Some HWCs may clip client composited input to its displayFrame. Make sure
     // that this does not cut off the shadow.
     if (layerState.forceClientComposition && layerState.shadowSettings.length > 0.0f) {
-        const auto outset = layerState.shadowSettings.length;
+        // RenderEngine currently blurs shadows to smooth out edges, so outset by
+        // 2x the length instead of 1x to compensate
+        const auto outset = layerState.shadowSettings.length * 2;
         geomLayerBounds.left -= outset;
         geomLayerBounds.top -= outset;
         geomLayerBounds.right += outset;