diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index ca6290872..1e4319510 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -148,10 +148,13 @@ static int gl_no_context() { if (egl_tls_t::logNoContextCall()) { LOGE("call to OpenGL ES API with no current context " "(logged once per thread)"); - LOGE("call stack before error:"); - CallStack stack; - stack.update(); - stack.dump(); + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.callstack", value, "0"); + if (atoi(value)) { + CallStack stack; + stack.update(); + stack.dump(); + } } return 0; } diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp index 961a61ec2..f3c8d2c78 100644 --- a/opengl/libs/EGL/egl_tls.cpp +++ b/opengl/libs/EGL/egl_tls.cpp @@ -14,9 +14,13 @@ ** limitations under the License. */ +#include #include #include +#include + +#include #include @@ -69,6 +73,13 @@ void egl_tls_t::setErrorEtcImpl(const char* caller, int line, EGLint error) { if (tls->error != error) { LOGE("%s:%d error %x (%s)", caller, line, error, egl_strerror(error)); tls->error = error; + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.callstack", value, "0"); + if (atoi(value)) { + CallStack stack; + stack.update(); + stack.dump(); + } } }