summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorThomas Buhot <thomas.buhot@intel.com>2015-12-04 12:18:03 +0100
committerSteve Kondik <shade@chemlab.org>2015-12-16 11:02:44 -0800
commit1003c499017267bc497fc45cf8802cb933d9781b (patch)
treeeebf940241683f839e9c87e420ac40bcb38e8295 /libs
parentec4c775f1d4fbf17c249f3e763f7df0ed8ceff31 (diff)
downloadframeworks_base-1003c499017267bc497fc45cf8802cb933d9781b.zip
frameworks_base-1003c499017267bc497fc45cf8802cb933d9781b.tar.gz
frameworks_base-1003c499017267bc497fc45cf8802cb933d9781b.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 any application is improved (for example settings by 20 to 40 ms). Change-Id: I41cfe4e18f2d26af5058b8b17c19df60ac1e5d85 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.cpp5
-rw-r--r--libs/hwui/renderthread/CanvasContext.h2
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp7
-rw-r--r--libs/hwui/renderthread/RenderProxy.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 6dfb6e8..87a703c 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -110,12 +110,11 @@ void CanvasContext::setSwapBehavior(SwapBehavior swapBehavior) {
mSwapBehavior = swapBehavior;
}
-bool CanvasContext::initialize(ANativeWindow* window) {
+void CanvasContext::initialize(ANativeWindow* window) {
setSurface(window);
- if (mCanvas) return false;
+ if (mCanvas) return;
mCanvas = new OpenGLRenderer(mRenderThread.renderState());
mCanvas->initProperties();
- return true;
}
void CanvasContext::updateSurface(ANativeWindow* window) {
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index f2fa9cd..1e6f830 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -67,7 +67,7 @@ public:
// Won't take effect until next EGLSurface creation
void setSwapBehavior(SwapBehavior swapBehavior);
- bool initialize(ANativeWindow* window);
+ void initialize(ANativeWindow* window);
void updateSurface(ANativeWindow* window);
bool pauseSurface(ANativeWindow* window);
bool hasSurface() { return mNativeWindow.get(); }
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 6d9acd4..30f0073 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -140,14 +140,15 @@ void RenderProxy::setName(const char* name) {
}
CREATE_BRIDGE2(initialize, CanvasContext* context, ANativeWindow* window) {
- return (void*) args->context->initialize(args->window);
+ args->context->initialize(args->window);
+ return nullptr;
}
-bool RenderProxy::initialize(const sp<ANativeWindow>& window) {
+void RenderProxy::initialize(const sp<ANativeWindow>& window) {
SETUP_TASK(initialize);
args->context = mContext;
args->window = window.get();
- return (bool) postAndWait(task);
+ post(task);
}
CREATE_BRIDGE2(updateSurface, CanvasContext* context, ANativeWindow* window) {
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 5febbe0..db03b29 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -67,7 +67,7 @@ public:
ANDROID_API bool loadSystemProperties();
ANDROID_API void setName(const char* name);
- ANDROID_API bool initialize(const sp<ANativeWindow>& window);
+ ANDROID_API void initialize(const sp<ANativeWindow>& window);
ANDROID_API void updateSurface(const sp<ANativeWindow>& window);
ANDROID_API bool pauseSurface(const sp<ANativeWindow>& window);
ANDROID_API void setup(int width, int height, float lightRadius,