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
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 6ad06af..14745b3 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -37,7 +37,7 @@
#include "egldefs.h"
#include "egl_impl.h"
#include "egl_tls.h"
-#include "glesv2dbg.h"
+#include "glestrace.h"
#include "hooks.h"
#include "Loader.h"
@@ -67,7 +67,6 @@
static int sEGLApplicationTraceLevel;
extern gl_hooks_t gHooksTrace;
-extern gl_hooks_t gHooksDebug;
static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) {
pthread_setspecific(gGLTraceKey, value);
@@ -89,27 +88,17 @@
char procPath[128] = {};
sprintf(procPath, "/proc/%ld/cmdline", pid);
FILE * file = fopen(procPath, "r");
- if (file)
- {
+ if (file) {
char cmdline[256] = {};
- if (fgets(cmdline, sizeof(cmdline) - 1, file))
- {
+ if (fgets(cmdline, sizeof(cmdline) - 1, file)) {
if (!strcmp(value, cmdline))
gEGLDebugLevel = 1;
}
fclose(file);
}
- if (gEGLDebugLevel > 0)
- {
- property_get("debug.egl.debug_port", value, "5039");
- const unsigned short port = (unsigned short)atoi(value);
- property_get("debug.egl.debug_forceUseFile", value, "0");
- const bool forceUseFile = (bool)atoi(value);
- property_get("debug.egl.debug_maxFileSize", value, "8");
- const unsigned int maxFileSize = atoi(value) << 20;
- property_get("debug.egl.debug_filePath", value, "/data/local/tmp/dump.gles2dbg");
- StartDebugServer(port, forceUseFile, maxFileSize, value);
+ if (gEGLDebugLevel > 0) {
+ GLTrace_start();
}
}
@@ -119,7 +108,7 @@
setGlThreadSpecific(&gHooksTrace);
} else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
setGlTraceThreadSpecific(value);
- setGlThreadSpecific(&gHooksDebug);
+ setGlThreadSpecific(GLTrace_getGLHooks());
} else {
setGlThreadSpecific(value);
}