summaryrefslogtreecommitdiffstats
path: root/opengl/libs
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/libs')
-rw-r--r--opengl/libs/Android.mk2
-rw-r--r--opengl/libs/EGL/egl_display.cpp8
-rw-r--r--opengl/libs/GLES2/gl2.cpp11
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_context.cpp12
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_context.h4
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_fixup.cpp11
6 files changed, 43 insertions, 5 deletions
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 42aaa24..eea79f8 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -122,7 +122,7 @@ LOCAL_SRC_FILES:= \
GLES2/gl2.cpp.arm \
#
-LOCAL_SHARED_LIBRARIES += libcutils libEGL
+LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL
LOCAL_LDLIBS := -lpthread -ldl
LOCAL_MODULE:= libGLESv2
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index a46aa38..80072ab 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -263,7 +263,13 @@ EGLBoolean egl_display_t::terminate() {
Mutex::Autolock _l(lock);
if (refs == 0) {
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ /*
+ * From the EGL spec (3.2):
+ * "Termination of a display that has already been terminated,
+ * (...), is allowed, but the only effect of such a call is
+ * to return EGL_TRUE (...)
+ */
+ return EGL_TRUE;
}
// this is specific to Android, display termination is ref-counted.
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index 4345c2b..b00af1b 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -26,6 +26,9 @@
#include <cutils/log.h>
#include <cutils/properties.h>
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
+
#include "hooks.h"
#include "egl_impl.h"
@@ -40,6 +43,7 @@ using namespace android;
#undef CALL_GL_API_RETURN
#define DEBUG_CALL_GL_API 0
+#define SYSTRACE_CALL_GL_API 0
#if USE_FAST_TLS_KEY
@@ -86,6 +90,13 @@ using namespace android;
ALOGD("[" #_api "] 0x%x", status); \
}
+#elif SYSTRACE_CALL_GL_API
+
+ #define CALL_GL_API(_api, ...) \
+ ATRACE_CALL(); \
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
+ _c->_api(__VA_ARGS__);
+
#else
#define CALL_GL_API(_api, ...) \
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.cpp b/opengl/libs/GLES_trace/src/gltrace_context.cpp
index 45dbb43..3a8decc 100644
--- a/opengl/libs/GLES_trace/src/gltrace_context.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_context.cpp
@@ -119,7 +119,7 @@ GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglCont
const size_t DEFAULT_BUFFER_SIZE = 8192;
BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE);
- GLTraceContext *traceContext = new GLTraceContext(id, this, stream);
+ GLTraceContext *traceContext = new GLTraceContext(id, version, this, stream);
mPerContextState[eglContext] = traceContext;
return traceContext;
@@ -129,8 +129,10 @@ GLTraceContext *GLTraceState::getTraceContext(EGLContext c) {
return mPerContextState[c];
}
-GLTraceContext::GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream) :
+GLTraceContext::GLTraceContext(int id, int version, GLTraceState *state,
+ BufferedOutputStream *stream) :
mId(id),
+ mVersion(version),
mState(state),
mBufferedOutputStream(stream),
mElementArrayBuffers(DefaultKeyedVector<GLuint, ElementArrayBuffer*>(NULL))
@@ -143,6 +145,10 @@ int GLTraceContext::getId() {
return mId;
}
+int GLTraceContext::getVersion() {
+ return mVersion;
+}
+
GLTraceState *GLTraceContext::getGlobalTraceState() {
return mState;
}
@@ -203,6 +209,8 @@ void GLTraceContext::traceGLMessage(GLMessage *msg) {
GLMessage_Function func = msg->function();
if (func == GLMessage::eglSwapBuffers
+ || func == GLMessage::eglCreateContext
+ || func == GLMessage::eglMakeCurrent
|| func == GLMessage::glDrawArrays
|| func == GLMessage::glDrawElements) {
mBufferedOutputStream->flush();
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.h b/opengl/libs/GLES_trace/src/gltrace_context.h
index 323cfdc..4c38bba 100644
--- a/opengl/libs/GLES_trace/src/gltrace_context.h
+++ b/opengl/libs/GLES_trace/src/gltrace_context.h
@@ -50,6 +50,7 @@ public:
/** GL Trace Context info associated with each EGLContext */
class GLTraceContext {
int mId; /* unique context id */
+ int mVersion; /* GL version, e.g: egl_connection_t::GLESv2_INDEX */
GLTraceState *mState; /* parent GL Trace state (for per process GL Trace State Info) */
void *fbcontents; /* memory area to read framebuffer contents */
@@ -65,8 +66,9 @@ class GLTraceContext {
public:
gl_hooks_t *hooks;
- GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream);
+ GLTraceContext(int id, int version, GLTraceState *state, BufferedOutputStream *stream);
int getId();
+ int getVersion();
GLTraceState *getGlobalTraceState();
void getCompressedFB(void **fb, unsigned *fbsize,
unsigned *fbwidth, unsigned *fbheight,
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
index 3597b26..1bd790e 100644
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
@@ -15,6 +15,7 @@
*/
#include <cutils/log.h>
+#include <EGL/egldefs.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
@@ -592,6 +593,11 @@ void trace_VertexAttribPointerData(GLTraceContext *context,
}
void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMessage *glmsg) {
+ if (context->getVersion() == egl_connection_t::GLESv1_INDEX) {
+ // only supported for GLES2 and above
+ return;
+ }
+
/* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */
GLsizei count = glmsg->args(2).intvalue(0);
@@ -604,6 +610,11 @@ void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMes
void trace_VertexAttribPointerDataForGlDrawElements(GLTraceContext *context, GLMessage *glmsg,
GLvoid *indices) {
+ if (context->getVersion() == egl_connection_t::GLESv1_INDEX) {
+ // only supported for GLES2 and above
+ return;
+ }
+
/* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */
GLsizei count = glmsg->args(1).intvalue(0);
GLenum type = glmsg->args(2).intvalue(0);