SF: always preallocate the client composition buffers
We have seen that allocating a GraphicBuffer on the first use
of client composition contributes to jank. To prevent that we
pre-allocate all the needed buffers when we setup the DisplayDevice.
Bug: 191633152
Test: observe logs that pre-allocation happened.
Change-Id: Ia10e023e5c91e6fd94906b90044dd9378d01051c
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index a022a8e..f346465 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2665,9 +2665,7 @@
sp<DisplayDevice> display = getFactory().createDisplayDevice(creationArgs);
- if (maxFrameBufferAcquiredBuffers >= 3) {
- nativeWindowSurface->preallocateBuffers();
- }
+ nativeWindowSurface->preallocateBuffers();
ColorMode defaultColorMode = ColorMode::NATIVE;
Dataspace defaultDataSpace = Dataspace::UNKNOWN;