diff options
author | Saurabh Shah <saurshah@codeaurora.org> | 2015-06-15 17:55:51 -0700 |
---|---|---|
committer | Saurabh Shah <saurshah@codeaurora.org> | 2015-06-17 11:08:29 -0700 |
commit | f9481058101c4e2b38c74048feac383664691d03 (patch) | |
tree | 731f48f04b6e029e779bc54779a237e99e56b97b | |
parent | 2ab05fc551f8ee8442b05484cce0350c1b523678 (diff) | |
download | frameworks_native-f9481058101c4e2b38c74048feac383664691d03.zip frameworks_native-f9481058101c4e2b38c74048feac383664691d03.tar.gz frameworks_native-f9481058101c4e2b38c74048feac383664691d03.tar.bz2 |
sf: Initialize EventThread before creating HWC
Once HWC is created, it could use any of the provided hooks, which
could lead to a crash if the EventThread (handler) isn't initialized
prior to creating HWC.
Change-Id: I5ea35fe9bcb150fb74aae1295b798bd787ad6cee
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 067ac69..bf9b886 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -438,6 +438,15 @@ void SurfaceFlinger::init() { mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(mEGLDisplay, NULL, NULL); + // start the EventThread + sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, + vsyncPhaseOffsetNs, true, "app"); + mEventThread = new EventThread(vsyncSrc); + sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, + sfVsyncPhaseOffsetNs, true, "sf"); + mSFEventThread = new EventThread(sfVsyncSrc); + mEventQueue.setEventThread(mSFEventThread); + // Initialize the H/W composer object. There may or may not be an // actual hardware composer underneath. mHwc = new HWComposer(this, @@ -489,15 +498,6 @@ void SurfaceFlinger::init() { // (which may happens before we render something) getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); - // start the EventThread - sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync, - vsyncPhaseOffsetNs, true, "app"); - mEventThread = new EventThread(vsyncSrc); - sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, - sfVsyncPhaseOffsetNs, true, "sf"); - mSFEventThread = new EventThread(sfVsyncSrc); - mEventQueue.setEventThread(mSFEventThread); - mEventControlThread = new EventControlThread(this); mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY); |