On the critical path of the cold launch of applications
the main thread of the started application allocates
the surface buffer. The allocation is synchronous and blocks
the main thread of the application.
As a consequence the launch time of the application is delayed
by the time spent doing the allocation.
With this optimization the allocation is performed
asynchronously in the RenderThread. This optimization
will benefit to the launch of all applications.
Change-Id: I4bc145cfc3ba6fe1efbca519bcee2e4ea6617ae7
Signed-off-by: Thomas Buhot <thomas.buhot@intel.com>
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-3601
FeatureID: https://jira01.devtools.intel.com/browse/AREQ-13987
Reviewed-on: https://android.intel.com:443/420527
try {
hwInitialized = mAttachInfo.mHardwareRenderer.initialize(
mSurface);
- if (hwInitialized && (host.mPrivateFlags
- & View.PFLAG_REQUEST_TRANSPARENT_REGIONS) == 0) {
- // Don't pre-allocate if transparent regions
- // are requested as they may not be needed
- mSurface.allocateBuffers();
- }
} catch (OutOfResourcesException e) {
handleOutOfResourcesException(e);
return;
#include <strings.h>
#include <cutils/properties.h>
#include <private/hwui/DrawGlInfo.h>
+#include <gui/Surface.h>
#define TRIM_MEMORY_COMPLETE 80
#define TRIM_MEMORY_UI_HIDDEN 20
if (mCanvas) return false;
mCanvas = new OpenGLRenderer(mRenderThread.renderState());
mCanvas->initProperties();
+ if (window) {
+ Surface *s = static_cast<Surface*>(window);
+ s->allocateBuffers();
+ }
return true;
}