SurfaceFlinger: Handle EGL errors more cleanly

Adds some more safety checking for cases where we get an error while
trying to create the EGLImage. The checking puts the Layer into a
failed state after detecting an error, since the shadow queue may no
longer be synchronized.

Bug: 20957332
Change-Id: I68b4c40eab3e58731b875ed5752f2c7d17f14bcb
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 947da85..4e222b7 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -419,6 +419,7 @@
     Condition mQueueItemCondition;
     Vector<BufferItem> mQueueItems;
     uint64_t mLastFrameNumberReceived;
+    bool mUpdateTexImageFailed; // This is only modified from the main thread
 };
 
 // ---------------------------------------------------------------------------