add debug option for debug builds

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
Pickle Repr nodes too.
make GLES/glext.hpp guard macro name unique

We want to include both GL/glext.hpp and GLES/glext.hpp but they are
guarded using the same macro name. Make them unique.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
filter based on thread_id

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
Compute the vertex buffer sizes in term of vertex count.

As opposed to max index, given that max index can not represent zero count.
Export undocumented Android gl*PointerBounds entrypoints.

Used in Dalvik.
trace: add support for tracing GL_OES_draw_texture calls

These are present at least in the Android EGL implementation.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
mt trace: create gltrace_state.cpp, move getContext into it

There is no need to keep this function in a python script and the
following patches will extend the functionality around this code, so
move the function to a .cpp file.

Signed-off-by: Imre Deak <imre.deak@intel.com>
mt trace: add helper to track GL contexts on a per-thread basis

This is needed for muti-threaded tracing to work properly.

Tracing multi-threaded GL apps requires that we track the lifetime of
the GL context objects and store thread specific state like the currently
active GL context on thread-local memory area.

Also add 'retain_count' to the context needed by the CGL retain/release
context calls.

Needed by the 4 upcoming GL API specific patches.

Signed-off-by: Imre Deak <imre.deak@intel.com>
mt trace: cgl: track GL context on a per-thread basis

Wrap CGL context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak@intel.com>
check for error in eglMakeCurrent wrapper

In case of error we shouldn't update our book-keeping.

Signed-off-by: Imre Deak <imre.deak@intel.com>
mt trace: egl: track GL context on a per-thread basis

Wrap EGL context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak@intel.com>
mt trace: glx: track GL context on a per-thread basis

Wrap GLX context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak@intel.com>
mt trace: wgl: track GL context on a per-thread basis

Wrap WGL context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android: add support for dynamically enable/disable tracing

To trace applications started by the Dalvik VM we have to wrap the main
Dalvik process zygote (or app_process) which is started at boot time and
never stopped afterwards. We would still want to restrict tracing to a
single process which will be forked by zygote.

To achieve this we'll use the fact that the forked process image is
contained in the same file as zygote, pointed to by /proc/self/exe. So
if this is 'app_process' we know it's a zygote process. To distinguish
between zygote processes we'll check /proc/self/cmdline which will in
turn be set to a unique application specific string (for example
com.android.settings). The user has to set the debug.apitrace.procname
to this string in order to enable tracing.

For non-zygote processes tracing will be always enabled.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android manual state tracking: add integer,pointer maps

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android manual state tracking: add function prologs

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android manual state tracking: add helpers

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android manual state tracking: wrap native GL calls

Signed-off-by: Imre Deak <imre.deak@intel.com>
Android manual state tracking: enable for EGL

Signed-off-by: Imre Deak <imre.deak@intel.com>