gltrace: transport buffering and context management
This patch adds two improvements:
1. Protobuf messages are buffered and sent in chunks.
2. Multiple EGL contexts are handled properly: Corresponding
to each EGLContext, a GLTraceContext with a unique ID is created.
On eglMakeCurrent, the appropriate GLTraceContext is set and is
used while tracing subsequent GL Calls in that thread.
Change-Id: I34076376d3e5af205c87c7396ea47659844abd6e
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 0102caf..da1b397 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -84,6 +84,9 @@
sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel;
property_get("debug.egl.debug_proc", value, "");
+ if (strlen(value) == 0)
+ return;
+
long pid = getpid();
char procPath[128] = {};
sprintf(procPath, "/proc/%ld/cmdline", pid);
@@ -91,8 +94,11 @@
if (file) {
char cmdline[256] = {};
if (fgets(cmdline, sizeof(cmdline) - 1, file)) {
- if (!strcmp(value, cmdline))
+ if (!strncmp(value, cmdline, strlen(value))) {
+ // set EGL debug if the "debug.egl.debug_proc" property
+ // matches the prefix of this application's command line
gEGLDebugLevel = 1;
+ }
}
fclose(file);
}