summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorThomas Buhot <thomas.buhot@intel.com>2015-09-24 10:38:07 +0200
committerSteve Kondik <steve@cyngn.com>2015-11-29 05:50:35 -0800
commit3973c59b77243793c9f5d9aed7a44483decf8c17 (patch)
tree2668e05cd6ca4928cd08a82546e17334f5ff371c /libs
parent2f123cd1bacf69d7c718211cb0644085181e1825 (diff)
downloadframeworks_base-3973c59b77243793c9f5d9aed7a44483decf8c17.zip
frameworks_base-3973c59b77243793c9f5d9aed7a44483decf8c17.tar.gz
frameworks_base-3973c59b77243793c9f5d9aed7a44483decf8c17.tar.bz2
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 the settings application is reduced by 20 ms to 40 ms. This optimization applies to the launch of all applications. Change-Id: Ibf47aaa0abb8dedf7aa00693073db3785d9d6b08 Signed-off-by: Thomas Buhot <thomas.buhot@intel.com> Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.h1
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index f2fa9cd..91ac64e 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -117,6 +117,7 @@ private:
// TODO: Replace with something better for layer & other GL object
// lifecycle tracking
friend class android::uirenderer::RenderState;
+ friend class RenderProxy;
void setSurface(ANativeWindow* window);
void swapBuffers(const SkRect& dirty, EGLint width, EGLint height);
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 6d9acd4..bad12bb 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -147,7 +147,9 @@ bool RenderProxy::initialize(const sp<ANativeWindow>& window) {
SETUP_TASK(initialize);
args->context = mContext;
args->window = window.get();
- return (bool) postAndWait(task);
+ bool ret = mContext->mCanvas == NULL;
+ post(task);
+ return ret;
}
CREATE_BRIDGE2(updateSurface, CanvasContext* context, ANativeWindow* window) {