Loading opengl/libs/EGL/egl.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,9 @@ void initEglTraceLevel() { 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); Loading @@ -91,9 +94,12 @@ void initEglTraceLevel() { 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); } Loading opengl/libs/EGL/eglApi.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -662,7 +662,7 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, egl_tls_t::setContext(ctx); #if EGL_TRACE if (gEGLDebugLevel > 0) GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version]); GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx); #endif _c.acquire(); _r.acquire(); Loading opengl/libs/GLES_trace/src/gltrace_api.cpp +752 −1128 File changed.Preview size limit exceeded, changes collapsed. Show changes opengl/libs/GLES_trace/src/gltrace_context.cpp +52 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <pthread.h> #include <cutils/log.h> extern "C" { #include "liblzf/lzf.h" Loading Loading @@ -42,12 +43,8 @@ void setGLTraceContext(GLTraceContext *c) { pthread_setspecific(sTLSKey, c); } void initContext(unsigned version, gl_hooks_t *hooks) { void setupTraceContextThreadSpecific(GLTraceContext *context) { pthread_once(&sPthreadOnceKey, createTLSKey); GLTraceContext *context = new GLTraceContext(); context->hooks = hooks; setGLTraceContext(context); } Loading @@ -59,9 +56,47 @@ void releaseContext() { } } GLTraceContext::GLTraceContext() { GLTraceState::GLTraceState(TCPStream *stream) { mTraceContextIds = 0; mStream = stream; } GLTraceState::~GLTraceState() { if (mStream) { mStream->closeStream(); mStream = NULL; } } TCPStream *GLTraceState::getStream() { return mStream; } GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglContext) { int id = __sync_fetch_and_add(&mTraceContextIds, 1); const size_t DEFAULT_BUFFER_SIZE = 8192; BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE); GLTraceContext *traceContext = new GLTraceContext(id, stream); mPerContextState[eglContext] = traceContext; return traceContext; } GLTraceContext *GLTraceState::getTraceContext(EGLContext c) { return mPerContextState[c]; } GLTraceContext::GLTraceContext(int id, BufferedOutputStream *stream) { mId = id; fbcontents = fbcompressed = NULL; fbcontentsSize = 0; mBufferedOutputStream = stream; } int GLTraceContext::getId() { return mId; } void GLTraceContext::resizeFBMemory(unsigned minSize) { Loading Loading @@ -115,5 +150,16 @@ void GLTraceContext::getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwi *fbheight = viewport[3]; } void GLTraceContext::traceGLMessage(GLMessage *msg) { mBufferedOutputStream->send(msg); GLMessage_Function func = msg->function(); if (func == GLMessage::eglSwapBuffers || func == GLMessage::glDrawArrays || func == GLMessage::glDrawElements) { mBufferedOutputStream->flush(); } } }; // namespace gltrace }; // namespace android opengl/libs/GLES_trace/src/gltrace_context.h +27 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ #ifndef __GLTRACE_CONTEXT_H_ #define __GLTRACE_CONTEXT_H_ #include <map> #include "hooks.h" #include "gltrace_transport.h" namespace android { namespace gltrace { Loading @@ -26,24 +29,45 @@ using ::android::gl_hooks_t; enum FBBinding {CURRENTLY_BOUND_FB, FB0}; /** GL Trace Context info associated with each EGLContext */ class GLTraceContext { int mId; /* unique context id */ void *fbcontents; /* memory area to read framebuffer contents */ void *fbcompressed; /* destination for lzf compressed framebuffer */ unsigned fbcontentsSize; /* size of fbcontents & fbcompressed buffers */ BufferedOutputStream *mBufferedOutputStream; /* stream where trace info is sent */ void resizeFBMemory(unsigned minSize); public: gl_hooks_t *hooks; GLTraceContext(); GLTraceContext(int id, BufferedOutputStream *stream); int getId(); void getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwidth, unsigned *fbheight, FBBinding fbToRead); void traceGLMessage(GLMessage *msg); }; /** Per process trace state. */ class GLTraceState { int mTraceContextIds; TCPStream *mStream; std::map<EGLContext, GLTraceContext*> mPerContextState; public: GLTraceState(TCPStream *stream); ~GLTraceState(); GLTraceContext *createTraceContext(int version, EGLContext c); GLTraceContext *getTraceContext(EGLContext c); TCPStream *getStream(); }; void setupTraceContextThreadSpecific(GLTraceContext *context); GLTraceContext *getGLTraceContext(); void setGLTraceContext(GLTraceContext *c); void initContext(unsigned version, gl_hooks_t *hooks); void releaseContext(); }; Loading Loading
opengl/libs/EGL/egl.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,9 @@ void initEglTraceLevel() { 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); Loading @@ -91,9 +94,12 @@ void initEglTraceLevel() { 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); } Loading
opengl/libs/EGL/eglApi.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -662,7 +662,7 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, egl_tls_t::setContext(ctx); #if EGL_TRACE if (gEGLDebugLevel > 0) GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version]); GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx); #endif _c.acquire(); _r.acquire(); Loading
opengl/libs/GLES_trace/src/gltrace_api.cpp +752 −1128 File changed.Preview size limit exceeded, changes collapsed. Show changes
opengl/libs/GLES_trace/src/gltrace_context.cpp +52 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <pthread.h> #include <cutils/log.h> extern "C" { #include "liblzf/lzf.h" Loading Loading @@ -42,12 +43,8 @@ void setGLTraceContext(GLTraceContext *c) { pthread_setspecific(sTLSKey, c); } void initContext(unsigned version, gl_hooks_t *hooks) { void setupTraceContextThreadSpecific(GLTraceContext *context) { pthread_once(&sPthreadOnceKey, createTLSKey); GLTraceContext *context = new GLTraceContext(); context->hooks = hooks; setGLTraceContext(context); } Loading @@ -59,9 +56,47 @@ void releaseContext() { } } GLTraceContext::GLTraceContext() { GLTraceState::GLTraceState(TCPStream *stream) { mTraceContextIds = 0; mStream = stream; } GLTraceState::~GLTraceState() { if (mStream) { mStream->closeStream(); mStream = NULL; } } TCPStream *GLTraceState::getStream() { return mStream; } GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglContext) { int id = __sync_fetch_and_add(&mTraceContextIds, 1); const size_t DEFAULT_BUFFER_SIZE = 8192; BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE); GLTraceContext *traceContext = new GLTraceContext(id, stream); mPerContextState[eglContext] = traceContext; return traceContext; } GLTraceContext *GLTraceState::getTraceContext(EGLContext c) { return mPerContextState[c]; } GLTraceContext::GLTraceContext(int id, BufferedOutputStream *stream) { mId = id; fbcontents = fbcompressed = NULL; fbcontentsSize = 0; mBufferedOutputStream = stream; } int GLTraceContext::getId() { return mId; } void GLTraceContext::resizeFBMemory(unsigned minSize) { Loading Loading @@ -115,5 +150,16 @@ void GLTraceContext::getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwi *fbheight = viewport[3]; } void GLTraceContext::traceGLMessage(GLMessage *msg) { mBufferedOutputStream->send(msg); GLMessage_Function func = msg->function(); if (func == GLMessage::eglSwapBuffers || func == GLMessage::glDrawArrays || func == GLMessage::glDrawElements) { mBufferedOutputStream->flush(); } } }; // namespace gltrace }; // namespace android
opengl/libs/GLES_trace/src/gltrace_context.h +27 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ #ifndef __GLTRACE_CONTEXT_H_ #define __GLTRACE_CONTEXT_H_ #include <map> #include "hooks.h" #include "gltrace_transport.h" namespace android { namespace gltrace { Loading @@ -26,24 +29,45 @@ using ::android::gl_hooks_t; enum FBBinding {CURRENTLY_BOUND_FB, FB0}; /** GL Trace Context info associated with each EGLContext */ class GLTraceContext { int mId; /* unique context id */ void *fbcontents; /* memory area to read framebuffer contents */ void *fbcompressed; /* destination for lzf compressed framebuffer */ unsigned fbcontentsSize; /* size of fbcontents & fbcompressed buffers */ BufferedOutputStream *mBufferedOutputStream; /* stream where trace info is sent */ void resizeFBMemory(unsigned minSize); public: gl_hooks_t *hooks; GLTraceContext(); GLTraceContext(int id, BufferedOutputStream *stream); int getId(); void getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwidth, unsigned *fbheight, FBBinding fbToRead); void traceGLMessage(GLMessage *msg); }; /** Per process trace state. */ class GLTraceState { int mTraceContextIds; TCPStream *mStream; std::map<EGLContext, GLTraceContext*> mPerContextState; public: GLTraceState(TCPStream *stream); ~GLTraceState(); GLTraceContext *createTraceContext(int version, EGLContext c); GLTraceContext *getTraceContext(EGLContext c); TCPStream *getStream(); }; void setupTraceContextThreadSpecific(GLTraceContext *context); GLTraceContext *getGLTraceContext(); void setGLTraceContext(GLTraceContext *c); void initContext(unsigned version, gl_hooks_t *hooks); void releaseContext(); }; Loading