Merge "GLES2Dbg: change GLES2_dbg to shared library"
This commit is contained in:
@@ -13,8 +13,8 @@ LOCAL_SRC_FILES:= \
|
||||
EGL/hooks.cpp \
|
||||
EGL/Loader.cpp \
|
||||
#
|
||||
LOCAL_STATIC_LIBRARIES += libGLESv2_dbg libprotobuf-cpp-2.3.0-lite liblzf
|
||||
LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport
|
||||
|
||||
LOCAL_SHARED_LIBRARIES += libcutils libutils libGLESv2_dbg
|
||||
LOCAL_LDLIBS := -lpthread -ldl
|
||||
LOCAL_MODULE:= libEGL
|
||||
LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "egl_impl.h"
|
||||
#include "Loader.h"
|
||||
#include "glesv2dbg.h"
|
||||
#include "egl_tls.h"
|
||||
|
||||
#define setError(_e, _r) setErrorEtc(__FUNCTION__, __LINE__, _e, _r)
|
||||
|
||||
@@ -58,7 +59,7 @@ namespace android {
|
||||
static char const * const gVendorString = "Android";
|
||||
static char const * const gVersionString = "1.4 Android META-EGL";
|
||||
static char const * const gClientApiString = "OpenGL ES";
|
||||
static char const * const gExtensionString =
|
||||
static char const * const gExtensionString =
|
||||
"EGL_KHR_image "
|
||||
"EGL_KHR_image_base "
|
||||
"EGL_KHR_image_pixmap "
|
||||
@@ -221,18 +222,15 @@ struct egl_surface_t : public egl_object_t
|
||||
struct egl_context_t : public egl_object_t
|
||||
{
|
||||
typedef egl_object_t::LocalRef<egl_context_t, EGLContext> Ref;
|
||||
|
||||
|
||||
egl_context_t(EGLDisplay dpy, EGLContext context, EGLConfig config,
|
||||
int impl, egl_connection_t const* cnx, int version)
|
||||
: egl_object_t(dpy), dpy(dpy), context(context), config(config), read(0), draw(0),
|
||||
impl(impl), cnx(cnx), version(version), dbg(NULL)
|
||||
int impl, egl_connection_t const* cnx, int version)
|
||||
: egl_object_t(dpy), dpy(dpy), context(context), config(config), read(0), draw(0),
|
||||
impl(impl), cnx(cnx), version(version)
|
||||
{
|
||||
}
|
||||
~egl_context_t()
|
||||
{
|
||||
if (dbg)
|
||||
DestroyDbgContext(dbg);
|
||||
dbg = NULL;
|
||||
}
|
||||
EGLDisplay dpy;
|
||||
EGLContext context;
|
||||
@@ -242,7 +240,6 @@ struct egl_context_t : public egl_object_t
|
||||
int impl;
|
||||
egl_connection_t const* cnx;
|
||||
int version;
|
||||
DbgContext * dbg;
|
||||
};
|
||||
|
||||
struct egl_image_t : public egl_object_t
|
||||
@@ -277,15 +274,6 @@ typedef egl_context_t::Ref ContextRef;
|
||||
typedef egl_image_t::Ref ImageRef;
|
||||
typedef egl_sync_t::Ref SyncRef;
|
||||
|
||||
struct tls_t
|
||||
{
|
||||
tls_t() : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) { }
|
||||
EGLint error;
|
||||
EGLContext ctx;
|
||||
EGLBoolean logCallWithNoContext;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static egl_connection_t gEGLImpl[IMPL_NUM_IMPLEMENTATIONS];
|
||||
@@ -586,7 +574,7 @@ static inline NATIVE* egl_to_native_cast(EGL arg) {
|
||||
}
|
||||
|
||||
static inline
|
||||
egl_surface_t* get_surface(EGLSurface surface) {
|
||||
egl_surface_t* get_surface(EGLSurface surface) {
|
||||
return egl_to_native_cast<egl_surface_t>(surface);
|
||||
}
|
||||
|
||||
@@ -595,11 +583,6 @@ egl_context_t* get_context(EGLContext context) {
|
||||
return egl_to_native_cast<egl_context_t>(context);
|
||||
}
|
||||
|
||||
DbgContext * getDbgContextThreadSpecific()
|
||||
{
|
||||
return get_context(getContext())->dbg;
|
||||
}
|
||||
|
||||
static inline
|
||||
egl_image_t* get_image(EGLImageKHR image) {
|
||||
return egl_to_native_cast<egl_image_t>(image);
|
||||
@@ -1442,10 +1425,12 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
|
||||
loseCurrent(cur_c);
|
||||
|
||||
if (ctx != EGL_NO_CONTEXT) {
|
||||
if (!c->dbg && gEGLDebugLevel > 0)
|
||||
c->dbg = CreateDbgContext(c->version, c->cnx->hooks[c->version]);
|
||||
setGLHooksThreadSpecific(c->cnx->hooks[c->version]);
|
||||
setContext(ctx);
|
||||
tls_t * const tls = getTLS();
|
||||
if (!tls->dbg && gEGLDebugLevel > 0)
|
||||
tls->dbg = CreateDbgContext(gEGLThreadLocalStorageKey, c->version,
|
||||
c->cnx->hooks[c->version]);
|
||||
_c.acquire();
|
||||
_r.acquire();
|
||||
_d.acquire();
|
||||
|
||||
@@ -11,7 +11,7 @@ LOCAL_SRC_FILES := \
|
||||
src/server.cpp \
|
||||
src/vertex.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH) \
|
||||
$(LOCAL_PATH)/../ \
|
||||
external/stlport/stlport \
|
||||
@@ -21,7 +21,8 @@ LOCAL_C_INCLUDES := \
|
||||
|
||||
#LOCAL_CFLAGS += -O0 -g -DDEBUG -UNDEBUG
|
||||
LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libprotobuf-cpp-2.3.0-lite liblzf
|
||||
LOCAL_SHARED_LIBRARIES := libcutils libutils libstlport
|
||||
ifeq ($(TARGET_ARCH),arm)
|
||||
LOCAL_CFLAGS += -fstrict-aliasing
|
||||
endif
|
||||
@@ -43,4 +44,4 @@ endif
|
||||
LOCAL_MODULE:= libGLESv2_dbg
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -192,11 +192,16 @@ if __name__ == "__main__":
|
||||
|
||||
// auto generated by generate_api_cpp.py
|
||||
|
||||
#include <utils/Debug.h>
|
||||
|
||||
#include "src/header.h"
|
||||
#include "src/api.h"
|
||||
|
||||
template<typename T> static int ToInt(const T & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (int &)t; }
|
||||
template<typename T> static T FromInt(const int & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (T &)t; }
|
||||
template<typename T> static int ToInt(const T & t)
|
||||
{
|
||||
COMPILE_TIME_ASSERT_FUNCTION_SCOPE(sizeof(T) == sizeof(int));
|
||||
return (int &)t;
|
||||
}
|
||||
"""
|
||||
lines = open("gl2_api_annotated.in").readlines()
|
||||
generate_api(lines)
|
||||
|
||||
@@ -177,7 +177,6 @@ const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message &
|
||||
{
|
||||
LOGD("GenerateCall function=%u", cmd.function());
|
||||
const int * ret = prevRet; // only some functions have return value
|
||||
gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl;
|
||||
nsecs_t c0 = systemTime(timeMode);
|
||||
switch (cmd.function()) {""")
|
||||
|
||||
|
||||
@@ -16,11 +16,16 @@
|
||||
|
||||
// auto generated by generate_api_cpp.py
|
||||
|
||||
#include <utils/Debug.h>
|
||||
|
||||
#include "src/header.h"
|
||||
#include "src/api.h"
|
||||
|
||||
template<typename T> static int ToInt(const T & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (int &)t; }
|
||||
template<typename T> static T FromInt(const int & t) { STATIC_ASSERT(sizeof(T) == sizeof(int), bitcast); return (T &)t; }
|
||||
template<typename T> static int ToInt(const T & t)
|
||||
{
|
||||
COMPILE_TIME_ASSERT_FUNCTION_SCOPE(sizeof(T) == sizeof(int));
|
||||
return (int &)t;
|
||||
}
|
||||
|
||||
void Debug_glActiveTexture(GLenum texture)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,6 @@ const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message &
|
||||
{
|
||||
LOGD("GenerateCall function=%u", cmd.function());
|
||||
const int * ret = prevRet; // only some functions have return value
|
||||
gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl;
|
||||
nsecs_t c0 = systemTime(timeMode);
|
||||
switch (cmd.function()) { case glesv2debugger::Message_Function_glActiveTexture:
|
||||
dbg->hooks->gl.glActiveTexture(
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include "header.h"
|
||||
#include "egl_tls.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -24,6 +25,14 @@ extern "C"
|
||||
namespace android
|
||||
{
|
||||
|
||||
static pthread_key_t sEGLThreadLocalStorageKey = -1;
|
||||
|
||||
DbgContext * getDbgContextThreadSpecific()
|
||||
{
|
||||
tls_t* tls = (tls_t*)pthread_getspecific(sEGLThreadLocalStorageKey);
|
||||
return tls->dbg;
|
||||
}
|
||||
|
||||
DbgContext::DbgContext(const unsigned version, const gl_hooks_t * const hooks,
|
||||
const unsigned MAX_VERTEX_ATTRIBS)
|
||||
: lzf_buf(NULL), lzf_readIndex(0), lzf_refSize(0), lzf_refBufSize(0)
|
||||
@@ -47,8 +56,10 @@ DbgContext::~DbgContext()
|
||||
free(lzf_ref[1]);
|
||||
}
|
||||
|
||||
DbgContext * CreateDbgContext(const unsigned version, const gl_hooks_t * const hooks)
|
||||
DbgContext * CreateDbgContext(const pthread_key_t EGLThreadLocalStorageKey,
|
||||
const unsigned version, const gl_hooks_t * const hooks)
|
||||
{
|
||||
sEGLThreadLocalStorageKey = EGLThreadLocalStorageKey;
|
||||
assert(version < 2);
|
||||
assert(GL_NO_ERROR == hooks->gl.glGetError());
|
||||
GLint MAX_VERTEX_ATTRIBS = 0;
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_GLES2_DBG_HEADER_H
|
||||
#define ANDROID_GLES2_DBG_HEADER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@@ -24,9 +27,7 @@
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <utils/Timers.h>
|
||||
#include <../../../libcore/include/StaticAssert.h>
|
||||
|
||||
#define EGL_TRACE 1
|
||||
#include "hooks.h"
|
||||
|
||||
#include "glesv2dbg.h"
|
||||
@@ -39,8 +40,6 @@
|
||||
using namespace android;
|
||||
using namespace com::android;
|
||||
|
||||
#define API_ENTRY(_api) Debug_##_api
|
||||
|
||||
#ifndef __location__
|
||||
#define __HIERALLOC_STRING_0__(s) #s
|
||||
#define __HIERALLOC_STRING_1__(s) __HIERALLOC_STRING_0__(s)
|
||||
@@ -141,9 +140,7 @@ public:
|
||||
void glDeleteBuffers(GLsizei n, const GLuint *buffers);
|
||||
};
|
||||
|
||||
|
||||
DbgContext * getDbgContextThreadSpecific();
|
||||
#define DBGCONTEXT(ctx) DbgContext * const ctx = getDbgContextThreadSpecific();
|
||||
|
||||
struct FunctionCall {
|
||||
virtual const int * operator()(gl_hooks_t::gl_t const * const _c,
|
||||
@@ -169,3 +166,5 @@ void SetProp(DbgContext * const dbg, const glesv2debugger::Message & cmd);
|
||||
const int * GenerateCall(DbgContext * const dbg, const glesv2debugger::Message & cmd,
|
||||
glesv2debugger::Message & msg, const int * const prevRet);
|
||||
}; // namespace android {
|
||||
|
||||
#endif // #ifndef ANDROID_GLES2_DBG_HEADER_H
|
||||
|
||||
40
opengl/libs/egl_tls.h
Normal file
40
opengl/libs/egl_tls.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
** Copyright 2011, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_EGL_TLS_H
|
||||
#define ANDROID_EGL_TLS_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "glesv2dbg.h"
|
||||
|
||||
namespace android
|
||||
{
|
||||
struct tls_t {
|
||||
tls_t() : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE), dbg(0) { }
|
||||
~tls_t() {
|
||||
if (dbg)
|
||||
DestroyDbgContext(dbg);
|
||||
}
|
||||
|
||||
EGLint error;
|
||||
EGLContext ctx;
|
||||
EGLBoolean logCallWithNoContext;
|
||||
DbgContext* dbg;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -13,20 +13,24 @@
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GLESV2_DBG_H_
|
||||
#define _GLESV2_DBG_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace android
|
||||
{
|
||||
struct DbgContext;
|
||||
|
||||
DbgContext * CreateDbgContext(const unsigned version, const gl_hooks_t * const hooks);
|
||||
void DestroyDbgContext(DbgContext * const dbg);
|
||||
|
||||
void StartDebugServer(unsigned short port); // create and bind socket if haven't already
|
||||
void StopDebugServer(); // close socket if open
|
||||
|
||||
struct DbgContext;
|
||||
|
||||
DbgContext * CreateDbgContext(const pthread_key_t EGLThreadLocalStorageKey,
|
||||
const unsigned version, const gl_hooks_t * const hooks);
|
||||
|
||||
void DestroyDbgContext(DbgContext * const dbg);
|
||||
|
||||
void StartDebugServer(unsigned short port); // create and bind socket if haven't already
|
||||
void StopDebugServer(); // close socket if open
|
||||
|
||||
}; // namespace android
|
||||
|
||||
#endif // #ifndef _GLESV2_DBG_H_
|
||||
|
||||
Reference in New Issue
Block a user