diff options
author | Michael Lentine <mlentine@google.com> | 2014-10-01 22:44:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-01 22:44:46 +0000 |
commit | db57cfbd6f9d5795846ef237fd297cb81e429679 (patch) | |
tree | 6d6ac16215a356d2623d738f832e0b88e1617059 /services | |
parent | dd230cb8d2a43ea453a507b12c612a221a3780e7 (diff) | |
parent | 3f121fc650d72d0103cef8e6a651093fb1589e0a (diff) | |
download | frameworks_native-db57cfbd6f9d5795846ef237fd297cb81e429679.zip frameworks_native-db57cfbd6f9d5795846ef237fd297cb81e429679.tar.gz frameworks_native-db57cfbd6f9d5795846ef237fd297cb81e429679.tar.bz2 |
Merge "When eglMakeCurrent fails we need to fix the egl state." into lmp-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 11 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 12f22a7..419b246 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1743,7 +1743,7 @@ void SurfaceFlinger::doDisplayComposition(const sp<const DisplayDevice>& hw, } if (CC_LIKELY(!mDaltonize && !mHasColorMatrix)) { - doComposeSurfaces(hw, dirtyRegion); + if (!doComposeSurfaces(hw, dirtyRegion)) return; } else { RenderEngine& engine(getRenderEngine()); mat4 colorMatrix = mColorMatrix; @@ -1762,7 +1762,7 @@ void SurfaceFlinger::doDisplayComposition(const sp<const DisplayDevice>& hw, hw->swapBuffers(getHwComposer()); } -void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const Region& dirty) +bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const Region& dirty) { RenderEngine& engine(getRenderEngine()); const int32_t id = hw->getHwcDisplayId(); @@ -1775,7 +1775,11 @@ void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const if (!hw->makeCurrent(mEGLDisplay, mEGLContext)) { ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s", hw->getDisplayName().string()); - return; + eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if(!getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext)) { + ALOGE("DisplayDevice::makeCurrent on default display failed. Aborting."); + } + return false; } // Never touch the framebuffer if we don't have any framebuffer layers @@ -1883,6 +1887,7 @@ void SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& hw, const // disable scissor at the end of the frame engine.disableScissor(); + return true; } void SurfaceFlinger::drawWormhole(const sp<const DisplayDevice>& hw, const Region& region) const { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 2cc522b..710dac7 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -377,7 +377,10 @@ private: void doComposition(); void doDebugFlashRegions(); void doDisplayComposition(const sp<const DisplayDevice>& hw, const Region& dirtyRegion); - void doComposeSurfaces(const sp<const DisplayDevice>& hw, const Region& dirty); + + // compose surfaces for display hw. this fails if using GL and the surface + // has been destroyed and is no longer valid. + bool doComposeSurfaces(const sp<const DisplayDevice>& hw, const Region& dirty); void postFramebuffer(); void drawWormhole(const sp<const DisplayDevice>& hw, const Region& region) const; |