summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl.cpp
diff options
context:
space:
mode:
authorDavid Li <davidxli@google.com>2011-03-01 16:08:10 -0800
committerDavid Li <davidxli@google.com>2011-03-03 18:28:43 -0800
commit28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2 (patch)
treef6bcb82ff2a68a5bd30218326def0f95fb6734f2 /opengl/libs/EGL/egl.cpp
parente5f823ccf1cce4cab5699f1a07c1ee2290a69169 (diff)
downloadframeworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.zip
frameworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.tar.gz
frameworks_base-28ca2abb1ab92b2cc3a5c9119ec2f697ec3401b2.tar.bz2
Initial commit of GLESv2 debugger server
Use debug.egl.debug_proc property to match process cmdline. Binds to TCP:5039 and waits for client connection. Sends function call parameters, textures and shaders using Protobuf. Java Eclipse client plug-in is next. Change-Id: I183b755263663f87e86dde1ad12f527d0445fd57 Signed-off-by: David Li <davidxli@google.com>
Diffstat (limited to 'opengl/libs/EGL/egl.cpp')
-rw-r--r--opengl/libs/EGL/egl.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 3d5a4d1..e427504 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -296,9 +296,9 @@ EGLAPI pthread_key_t gGLTraceKey = -1;
// ----------------------------------------------------------------------------
-static int gEGLTraceLevel;
+static int gEGLTraceLevel, gEGLDebugLevel;
static int gEGLApplicationTraceLevel;
-extern EGLAPI gl_hooks_t gHooksTrace;
+extern EGLAPI gl_hooks_t gHooksTrace, gHooksDebug;
static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) {
pthread_setspecific(gGLTraceKey, value);
@@ -314,12 +314,37 @@ static void initEglTraceLevel() {
int propertyLevel = atoi(value);
int applicationLevel = gEGLApplicationTraceLevel;
gEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel;
+
+ property_get("debug.egl.debug_proc", value, "");
+ long pid = getpid();
+ char procPath[128] = {};
+ sprintf(procPath, "/proc/%ld/cmdline", pid);
+ FILE * file = fopen(procPath, "r");
+ if (file)
+ {
+ char cmdline[256] = {};
+ if (fgets(cmdline, sizeof(cmdline) - 1, file))
+ {
+ LOGD("\n*\n*\n* initEglTraceLevel cmdline='%s' \n*\n*", cmdline);
+ if (!strcmp(value, cmdline))
+ gEGLDebugLevel = 1;
+ }
+ fclose(file);
+ }
+
+ extern void StartDebugServer();
+ if (gEGLDebugLevel > 0)
+ StartDebugServer();
}
static void setGLHooksThreadSpecific(gl_hooks_t const *value) {
if (gEGLTraceLevel > 0) {
setGlTraceThreadSpecific(value);
setGlThreadSpecific(&gHooksTrace);
+ } else if (gEGLDebugLevel > 0) {
+ setGlTraceThreadSpecific(value);
+ setGlThreadSpecific(&gHooksDebug);
+ LOGD("\n* setGLHooksThreadSpecific gHooksDebug");
} else {
setGlThreadSpecific(value);
}
@@ -1597,7 +1622,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
cnx->hooks[GLESv1_INDEX]->ext.extensions[slot] =
cnx->hooks[GLESv2_INDEX]->ext.extensions[slot] =
#if EGL_TRACE
- gHooksTrace.ext.extensions[slot] =
+ gHooksDebug.ext.extensions[slot] = gHooksTrace.ext.extensions[slot] =
#endif
cnx->egl.eglGetProcAddress(procname);
}