Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ec2ff65 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

add an option to EGL to dump stack traces on errors

enable by setting debug.egl.callstack to 1

Change-Id: I7fad9ce71b4c4c5ece97d4f9d139348eab742a3c
parent b69f7015
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -148,11 +148,14 @@ 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:");
        char value[PROPERTY_VALUE_MAX];
        property_get("debug.egl.callstack", value, "0");
        if (atoi(value)) {
            CallStack stack;
            stack.update();
            stack.dump();
        }
    }
    return 0;
}

+11 −0
Original line number Diff line number Diff line
@@ -14,9 +14,13 @@
 ** limitations under the License.
 */

#include <stdlib.h>
#include <pthread.h>

#include <cutils/log.h>
#include <cutils/properties.h>

#include <utils/CallStack.h>

#include <EGL/egl.h>

@@ -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();
        }
    }
}