From 143d05abd6e3e1a6b850bc6c10e5bf28362b2d8e Mon Sep 17 00:00:00 2001 From: Michael Chock Date: Mon, 4 Mar 2013 15:15:46 -0800 Subject: Abort surface composition if hw surface is invalid If an invalid display device is detected during surface composition (e.g., a simulated secondary display is removed), abort the composition. Change-Id: Ia6afb2e287882d8ae0614eb25463d3f85b687adf --- services/surfaceflinger/SurfaceFlinger.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 1842949..f31bae4 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1559,7 +1559,11 @@ void SurfaceFlinger::doComposeSurfaces(const sp& hw, const const bool hasGlesComposition = hwc.hasGlesComposition(id) || (cur==end); if (hasGlesComposition) { - DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext); + if (!DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext)) { + ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s", + hw->getDisplayName().string()); + return; + } // set the frame buffer glMatrixMode(GL_MODELVIEW); -- cgit v1.1