From 1003c499017267bc497fc45cf8802cb933d9781b Mon Sep 17 00:00:00 2001 From: Thomas Buhot Date: Fri, 4 Dec 2015 12:18:03 +0100 Subject: libhwui: make setSurface asynchronous On the critical path of the cold launch of applications the main thread of the started application tells the RenderThread to create a surface. This process is synchronous and blocks the main thread of the application until the creation of the EGLContext is complete. As a consequence the launch time of the application is delayed by time spent allocating the EGL Context in the RenderThread. With this optimization the launch time of any application is improved (for example settings by 20 to 40 ms). Change-Id: I41cfe4e18f2d26af5058b8b17c19df60ac1e5d85 Signed-off-by: Thomas Buhot Signed-off-by: Zhiquan Liu --- core/jni/android_view_ThreadedRenderer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/jni') diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp index 47132f4..7400ef0 100644 --- a/core/jni/android_view_ThreadedRenderer.cpp +++ b/core/jni/android_view_ThreadedRenderer.cpp @@ -262,11 +262,11 @@ static void android_view_ThreadedRenderer_setName(JNIEnv* env, jobject clazz, env->ReleaseStringUTFChars(jname, name); } -static jboolean android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject clazz, +static void android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject clazz, jlong proxyPtr, jobject jsurface) { RenderProxy* proxy = reinterpret_cast(proxyPtr); sp window = android_view_Surface_getNativeWindow(env, jsurface); - return proxy->initialize(window); + proxy->initialize(window); } static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject clazz, @@ -461,7 +461,7 @@ static JNINativeMethod gMethods[] = { { "nDeleteProxy", "(J)V", (void*) android_view_ThreadedRenderer_deleteProxy }, { "nLoadSystemProperties", "(J)Z", (void*) android_view_ThreadedRenderer_loadSystemProperties }, { "nSetName", "(JLjava/lang/String;)V", (void*) android_view_ThreadedRenderer_setName }, - { "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize }, + { "nInitialize", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_initialize }, { "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface }, { "nPauseSurface", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_pauseSurface }, { "nSetup", "(JIIFII)V", (void*) android_view_ThreadedRenderer_setup }, -- cgit v1.1