make sure we have a context when creating the 1st surface

also add an option to dump the stack trace when
calling a GL function without a context.

Change-Id: I57b72bb8c322ac4253c3077bf150621bd9863b69
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 86637dc..f759e6b 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -331,6 +331,11 @@
 
 void gl_unimplemented() {
     ALOGE("called unimplemented OpenGL ES API");
+    char value[PROPERTY_VALUE_MAX];
+    property_get("debug.egl.callstack", value, "0");
+    if (atoi(value)) {
+        CallStack stack(LOG_TAG);
+    }
 }
 
 void gl_noop() {