}
if (CC_LIKELY(!mDaltonize && !mHasColorMatrix)) {
- doComposeSurfaces(hw, dirtyRegion);
+ if (!doComposeSurfaces(hw, dirtyRegion)) return;
} else {
RenderEngine& engine(getRenderEngine());
mat4 colorMatrix = mColorMatrix;
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();
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
// disable scissor at the end of the frame
engine.disableScissor();
+ return true;
}
void SurfaceFlinger::drawWormhole(const sp<const DisplayDevice>& hw, const Region& region) const {
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;