summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/eglApi.cpp
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2011-11-30 15:05:37 -0800
committerSiva Velusamy <vsiva@google.com>2011-12-02 15:30:17 -0800
commitdb97468fd241cecce62366b4f0962a9572161e95 (patch)
treeffd9624f89ac1e3baf80e496256b0a80fbe3457d /opengl/libs/EGL/eglApi.cpp
parenta5d24d42ff8b99383a8c3051b9459e5248cf8536 (diff)
downloadframeworks_base-db97468fd241cecce62366b4f0962a9572161e95.zip
frameworks_base-db97468fd241cecce62366b4f0962a9572161e95.tar.gz
frameworks_base-db97468fd241cecce62366b4f0962a9572161e95.tar.bz2
glestrace: Framework for GLES tracing library
This patch provides a framework for tracing GLES 1.0 and 2.0 functions. It is missing a lot of features, but here are the things it accomplishes: - Stop building the glesv2dbg library, and build the glestrace library instead. - Replace the hooks for glesv2dbg with the ones for glestrace. - Add the basics for the trace library. Currently, this traces all GL functions, but not all required data is sent for all the functions. As a result, it will not be possible to reconstruct the entire GL state on the host side. The files gltrace.pb.* and gltrace_api.* are both generated using the tools/genapi.py script. Change-Id: Id60a468f7278657f008bc6ea1df01f9bdfecfdd3
Diffstat (limited to 'opengl/libs/EGL/eglApi.cpp')
-rw-r--r--opengl/libs/EGL/eglApi.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index a63d5b0..ceb49d4 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -37,7 +37,7 @@
#include "egl_impl.h"
#include "egl_tls.h"
-#include "glesv2dbg.h"
+#include "glestrace.h"
#include "hooks.h"
#include "egl_display.h"
@@ -110,7 +110,6 @@ extern EGLBoolean egl_init_drivers();
extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS];
extern int gEGLDebugLevel;
extern gl_hooks_t gHooksTrace;
-extern gl_hooks_t gHooksDebug;
} // namespace android;
// ----------------------------------------------------------------------------
@@ -514,6 +513,10 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
}
egl_context_t* c = new egl_context_t(dpy, context, config,
dp->configs[intptr_t(config)].impl, cnx, version);
+#if EGL_TRACE
+ if (gEGLDebugLevel > 0)
+ GLTrace_eglCreateContext(version, c);
+#endif
return c;
}
}
@@ -655,9 +658,10 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
if (ctx != EGL_NO_CONTEXT) {
setGLHooksThreadSpecific(c->cnx->hooks[c->version]);
egl_tls_t::setContext(ctx);
- if (gEGLDebugLevel > 0) {
- CreateDbgContext(c->version, c->cnx->hooks[c->version]);
- }
+#if EGL_TRACE
+ if (gEGLDebugLevel > 0)
+ GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version]);
+#endif
_c.acquire();
_r.acquire();
_d.acquire();
@@ -884,6 +888,10 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
"no more slots for eglGetProcAddress(\"%s\")",
procname);
+#if EGL_TRACE
+ gl_hooks_t *debugHooks = GLTrace_getGLHooks();
+#endif
+
if (!addr && (slot < MAX_NUMBER_OF_GL_EXTENSIONS)) {
bool found = false;
for (int i=0 ; i<IMPL_NUM_IMPLEMENTATIONS ; i++) {
@@ -894,7 +902,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
cnx->hooks[GLESv1_INDEX]->ext.extensions[slot] =
cnx->hooks[GLESv2_INDEX]->ext.extensions[slot] =
#if EGL_TRACE
- gHooksDebug.ext.extensions[slot] = gHooksTrace.ext.extensions[slot] =
+ debugHooks->ext.extensions[slot] = gHooksTrace.ext.extensions[slot] =
#endif
cnx->egl.eglGetProcAddress(procname);
}
@@ -922,10 +930,6 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
{
- EGLBoolean Debug_eglSwapBuffers(EGLDisplay dpy, EGLSurface draw);
- if (gEGLDebugLevel > 0)
- Debug_eglSwapBuffers(dpy, draw);
-
clearError();
egl_display_t const * const dp = validate_display(dpy);
@@ -935,6 +939,11 @@ EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
if (!_s.get())
return setError(EGL_BAD_SURFACE, EGL_FALSE);
+#if EGL_TRACE
+ if (gEGLDebugLevel > 0)
+ GLTrace_eglSwapBuffers(dpy, draw);
+#endif
+
egl_surface_t const * const s = get_surface(draw);
return s->cnx->egl.eglSwapBuffers(dp->disp[s->impl].dpy, s->surface);
}
@@ -1154,7 +1163,10 @@ EGLBoolean eglReleaseThread(void)
}
}
egl_tls_t::clearTLS();
- dbgReleaseThread();
+#if EGL_TRACE
+ if (gEGLDebugLevel > 0)
+ GLTrace_eglReleaseThread();
+#endif
return EGL_TRUE;
}