# ./probe_ui/capi_capture.c
TIZEN_SRCS = $(COMMON_SRCS) $(CAPI_SRCS)\
- ./helper/addr-tizen.c \
- ./helper/common_probe_init.cpp \
- ./probe_memory/libdanew.cpp \
- ./probe_graphics/da_gles20_tizen.cpp \
+ ./helper/addr-tizen.c \
+ ./helper/common_probe_init.c \
+ ./probe_memory/libdanew.cpp \
+ ./probe_graphics/da_evas_gl.c \
+ ./probe_graphics/da_gles20_tizen.cpp \
./probe_graphics/da_gles20_native.cpp
-
ASM_SRC = ./helper/da_call_original.S
## Totally brain-dead.
--- /dev/null
+/*
+ * DA probe
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Vitaliy Cherepanov <v.cherepanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <unistd.h>
+#include "da_gles20.h"
+#include "binproto.h"
+#include "common_probe_init.h"
+
+//#define EGL_TEST
+
+void probe_terminate_with_err(const char *msg, const char *func_name,
+ ORIGINAL_LIBRARY id)
+{
+ char error_msg[1024];
+ const char *lib_name = "unknown";
+
+ if (id < NUM_ORIGINAL_LIBRARY)
+ lib_name = lib_string[id];
+ sprintf(error_msg, "%s : [%s], %s", msg, func_name, lib_name);
+ perror(error_msg);
+ PRINTERR(error_msg);
+ //wait for flush
+ sleep(1);
+ exit(0);
+
+}
+
+////////////////////////////////////////////////////////////////////////////
+//egl init probe function
+// params:
+// func_name - original function name for dlsym search
+// func_pointer - original function pointer (return)
+//
+// info
+// search original function by name
+// function have no return becouse on error it terminates main application
+#ifdef EGL_TEST
+
+void dummy()
+{
+ return;
+}
+
+void init_probe_egl(__attribute__ ((unused))const char *func_name, void **func_pointer,
+ __attribute__ ((unused))ORIGINAL_LIBRARY id)
+{
+ PRINTMSG(func_name);
+ *func_pointer = (void *)dummy;
+}
+#else
+void init_probe_egl(const char *func_name, void **func_pointer,
+ ORIGINAL_LIBRARY id)
+{
+ void *faddr = 0;
+
+ (gProbeBlockCount++);
+ if (lib_handle[id] == ((void *)0)) {
+ lib_handle[id] = dlopen(lib_string[id],
+ RTLD_LAZY | RTLD_GLOBAL);
+
+ if (lib_handle[id] == ((void *)0))
+ probe_terminate_with_err("dlopen failed", func_name, id);
+ };
+ faddr = dlsym(lib_handle[id], func_name);
+ if (faddr == NULL || dlerror() != NULL)
+ probe_terminate_with_err("dlsym failed", func_name, id);
+ memcpy(func_pointer, &faddr, sizeof(faddr));
+ (gProbeBlockCount--);
+}
+#endif
+
+
+void init_probe_gl(const char *func_name, void **func_pointer,
+ ORIGINAL_LIBRARY id, int blockresult, int32_t vAPI_ID)
+{
+ void *faddr;
+ probeInfo_t tempProbeInfo;
+
+ probeBlockStart();
+ if (lib_handle[id] == ((void *)0)) {
+ lib_handle[id] = dlopen(lib_string[id], RTLD_LAZY);
+ if (lib_handle[id] == ((void *)0))
+ probe_terminate_with_err("dlopen failed", func_name, id);
+
+ setProbePoint(&tempProbeInfo);
+ if (blockresult != 0) {
+ /* get max value */
+ char maxValString[64];
+ GLint maxVal[2];
+ glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVal[0]);
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxVal[1]);
+ sprintf(maxValString, "%d,%d", maxVal[0], maxVal[1]);
+ PREPARE_LOCAL_BUF();
+ PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, "", 0);
+ PACK_COMMON_END('p', 1, 0, 0);
+ PACK_GL_ADD(APITYPE_INIT, 0, maxValString);
+ FLUSH_LOCAL_BUF();
+ }
+ }
+
+ faddr = dlsym(lib_handle[id], func_name);
+ if (faddr == NULL || dlerror() != NULL)
+ probe_terminate_with_err("function not found in lib", func_name,
+ id);
+
+ memcpy(func_pointer, &faddr, sizeof(faddr));
+ probeBlockEnd();
+}
+++ /dev/null
-/*
- * DA probe
- *
- * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- *
- * Vitaliy Cherepanov <v.cherepanov@samsung.com>
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include <unistd.h>
-#include "common_probe_init.h"
-
-
-
-//#define EGL_TEST
-
-void dummy()
-{
- return;
-}
-
-void probe_terminate_with_err(const char *msg, const char *func_name,
- ORIGINAL_LIBRARY id)
-{
- char error_msg[1024];
-
- sprintf(error_msg, "%s : [%s], %s", msg, func_name, lib_string[id]);
- perror(error_msg);
- PRINTERR(error_msg);
- //wait for flush
- sleep(1);
- exit(0);
-
-}
-
-////////////////////////////////////////////////////////////////////////////
-//egl init probe function
-// params:
-// func_name - original function name for dlsym search
-// func_pointer - original function pointer (return)
-//
-// info
-// search original function by name
-// function have no return becouse on error it terminates main application
-#ifdef EGL_TEST
-void init_probe_egl(__attribute__ ((unused))const char *func_name, void **func_pointer,
- __attribute__ ((unused))ORIGINAL_LIBRARY id)
-{
- PRINTMSG(func_name);
- *func_pointer = (void *)dummy;
-}
-#else
-void init_probe_egl(const char *func_name, void **func_pointer,
- ORIGINAL_LIBRARY id)
-{
- void *faddr = 0;
-
- (gProbeBlockCount++);
- if (lib_handle[id] == ((void *)0)) {
- lib_handle[id] = dlopen(lib_string[id],
- RTLD_LAZY | RTLD_GLOBAL);
-
- if (lib_handle[id] == ((void *)0))
- probe_terminate_with_err("dlopen failed", func_name, id);
- };
- faddr = dlsym(lib_handle[id], func_name);
- if (faddr == __null || dlerror() != __null)
- probe_terminate_with_err("dlsym failed", func_name, id);
- memcpy(func_pointer, &faddr, sizeof(faddr));
- (gProbeBlockCount--);
-}
-#endif
#ifndef __COMMON_PROBE_INIT_H__
#define __COMMON_PROBE_INIT_H__
-#include "dahelper.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "dahelper.h"
////////////////////////////////////////////////////////////////////////////
//egl init probe function
// params:
// info
// search original function by name
// function have no return becouse on error it terminates main application
-void init_probe_egl(const char *func_name, void **func_pointer, ORIGINAL_LIBRARY id);
+extern void init_probe_egl(const char *func_name, void **func_pointer,
+ ORIGINAL_LIBRARY id);
+
+extern void init_probe_gl(const char *func_name, void **func_pointer,
+ ORIGINAL_LIBRARY id, int blockresult, int32_t vAPI_ID);
+
+extern void probe_terminate_with_err(const char *msg, const char *func_name,
+ ORIGINAL_LIBRARY id);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
-void probe_terminate_with_err(const char *msg, const char *func_name,
- ORIGINAL_LIBRARY id);
#endif /* __COMMON_PROBE_INIT_H__ */
--- /dev/null
+/*
+ * DA probe
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Sanghyun Lee <sanghyunnim.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ * Vitaliy Cherepanov <v.cherepanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef DA_GLES20_H_
+#define DA_GLES20_H_
+
+/*
+ * TODO find this headers. need for EGL_Context and other
+#include <egl.h>
+#include <eglext.h>
+#include <gl2.h>
+#include <gl2ext.h>
+*/
+
+#include <Evas_GL.h>
+#include <Evas.h>
+
+#include <errno.h>
+#include "daprobe.h"
+#include "dahelper.h"
+
+/* TODO add egl header for next */
+#define EGLContext void *
+extern EGLContext eglGetCurrentContext(void);
+
+#define NO_RETURN_FORMAT "%s"
+#define NO_RETURN_VALUE 0
+#define APITYPE_INIT 0
+#define APITYPE_CONTEXT 1
+#define APITYPE_NO_CONTEXT 2
+
+#define FUNC(FUNCNAME) FUNCNAME
+#define FUNCSTR(FUNCNAME) #FUNCNAME
+#define FUNCID(FUNCNAME) API_ID_##FUNCNAME
+
+#define PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time) \
+ do { /* PACK_GL_ADD_COMMON */ \
+ /* TODO restore eglGetCurrentContext */ \
+ /*BUF_PTR = pack_int64(BUF_PTR, voidp_to_uint64((void *)eglGetCurrentContext()));*/\
+ BUF_PTR = pack_int64(BUF_PTR, voidp_to_uint64((void *)0));\
+ BUF_PTR = pack_int32(BUF_PTR, (uint32_t)GL_api_type); \
+ BUF_PTR = pack_int64(BUF_PTR, (uint64_t)GL_elapsed_time); \
+ } while (0)
+
+#define PACK_GL_ADD(GL_api_type, GL_elapsed_time, GL_context_value) \
+ do { /* PACK_GL_ADD */ \
+ PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time); \
+ BUF_PTR = pack_string(BUF_PTR, GL_context_value); \
+ } while (0)
+
+#define PACK_GL_SHADER(GL_api_type, GL_elapsed_time, GL_shader, GL_shader_size) \
+ do { /* PACK_GL_SHADER */ \
+ PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time); \
+ uint32_t min = (sizeof(LOCAL_BUF) - (BUF_PTR - LOCAL_BUF)); \
+ if (min > MAX_SHADER_LEN) \
+ min = MAX_SHADER_LEN; \
+ BUF_PTR = pack_string_to_file(BUF_PTR, GL_shader, \
+ GL_shader_size, min); \
+ } while (0)
+
+#define BEFORE(FUNCNAME) \
+ DECLARE_VARIABLE_STANDARD_NORET; \
+ GLenum error = GL_NO_ERROR; \
+ static methodType FUNCNAME ## p = 0; \
+ int32_t vAPI_ID = API_ID_ ## FUNCNAME; \
+ uint64_t start_nsec = 0; \
+ PRE_PROBEBLOCK(); \
+ if(blockresult != 0) \
+ start_nsec = get_current_nsec(); \
+ if(!FUNCNAME##p) { \
+ init_probe_gl(#FUNCNAME, (void **)&FUNCNAME##p, \
+ LIBGLES20, blockresult, vAPI_ID); \
+ }
+
+#define INIT_LIB_ID_STR(LIB_ID, LIB_STR, KEYS) \
+ if (lib_handle[LIB_ID] == ((void *) 0)) { \
+ lib_handle[LIB_ID] = dlopen(LIB_STR, RTLD_LAZY | RTLD_GLOBAL); \
+ if (lib_handle[LIB_ID] == ((void *) 0)) { \
+ char perror_msg[128]; \
+ sprintf(perror_msg, "dlopen failed : [%s],%s", \
+ __FUNCTION__, LIB_STR); \
+ perror(perror_msg); \
+ exit(0); \
+ } \
+ }
+
+#define INIT_LIB(LIB_ID, KEYS) \
+ INIT_LIB_ID_STR(LIB_ID, lib_string[LIB_ID], KEYS)
+
+
+#define BEFORE_EGL_NATIVE(FUNCNAME) \
+ DECLARE_VARIABLE_STANDARD_NORET; \
+ GLenum error = EGL_SUCCESS; \
+ static methodType FUNCNAME ## p = 0; \
+ int32_t vAPI_ID = API_ID_ ## FUNCNAME; \
+ uint64_t start_nsec = 0; \
+ PRE_PROBEBLOCK(); \
+ if(blockresult != 0) \
+ start_nsec = get_current_nsec(); \
+ if(!FUNCNAME##p) \
+ init_probe_egl(#FUNCNAME, (void **)&FUNCNAME##p, LIBEGL)
+
+#define EGL_GET_ERROR() \
+ if (blockresult != 0) { \
+ error = eglGetError(); \
+ }
+
+#define AFTER(RET_TYPE, RET_VAL, APITYPE, CONTEXT_VAL, INPUTFORMAT, ...) \
+ POST_PACK_PROBEBLOCK_BEGIN(); \
+ PREPARE_LOCAL_BUF(); \
+ PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, INPUTFORMAT, __VA_ARGS__); \
+ PACK_COMMON_END(RET_TYPE, RET_VAL, error, blockresult); \
+ PACK_GL_ADD(APITYPE, get_current_nsec() - start_nsec, CONTEXT_VAL); \
+ FLUSH_LOCAL_BUF(); \
+ POST_PACK_PROBEBLOCK_END()
+
+#define AFTER_NO_PARAM(RET_TYPE, RETVAL, APITYPE, CONTEXTVALUE) \
+ AFTER(RET_TYPE, RETVAL, APITYPE, CONTEXTVALUE, "", 0)
+
+#define GL_GET_ERROR() \
+ if (blockresult != 0) { \
+ error = glGetError(); \
+ }
+
+#define AFTER_SHADER(RET_TYPE, RET_VAL, APITYPE, CONTEXT_VAL, CONTEXT_SIZE, INPUTFORMAT, ...) \
+ POST_PACK_PROBEBLOCK_BEGIN(); \
+ PREPARE_LOCAL_BUF(); \
+ PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, INPUTFORMAT, __VA_ARGS__); \
+ PACK_COMMON_END(RET_TYPE, RET_VAL, error, blockresult); \
+ PACK_GL_SHADER(APITYPE, get_current_nsec() - start_nsec, CONTEXT_VAL, CONTEXT_SIZE); \
+ FLUSH_LOCAL_BUF(); \
+ POST_PACK_PROBEBLOCK_END()
+
+#define BEFORE_EVAS_GL(FUNCNAME) \
+ DECLARE_VARIABLE_STANDARD_NORET; \
+ GLenum error = GL_NO_ERROR; \
+ static methodType FUNCNAME ## p = 0; \
+ int32_t vAPI_ID = API_ID_ ## FUNCNAME; \
+ uint64_t start_nsec = 0; \
+ PRE_PROBEBLOCK(); \
+ if(blockresult != 0) \
+ start_nsec = get_current_nsec(); \
+ GET_REAL_FUNC_RTLD_NEXT(FUNCNAME)
+
+GLenum glGetError(void);
+void glGetIntegerv(GLenum pname, GLint * params);
+
+#endif /* DA_GLES20_H_ */
+
// =========================== declare variables ===========================
// local variable is faster than heap allocated variable
// array variable initialization with declare is expensive than memset
+#define DECLARE_ERRNO_VARS \
+ int olderrno = 0; \
+ int newerrno = 0;
// declare variable for standard api (not tizen related api)
#define DECLARE_VARIABLE_STANDARD \
probeInfo_t probeInfo; \
int blockresult = 0; \
bool bfiltering = true; \
- int olderrno = 0; \
- int newerrno = 0; \
+ DECLARE_ERRNO_VARS; \
int __attribute__((unused)) ret
// declare variable for standard api (not tizen related api) without ret
if(!FUNCTIONPOINTER) { \
probeBlockStart(); \
FUNCTIONPOINTER = dlsym(RTLD_NEXT, #FUNCNAME); \
- if(FUNCTIONPOINTER == NULL || dlerror() != NULL) { \
- fprintf(stderr, "dlsym failed <%s>\n", #FUNCNAME); \
- exit(0); \
- } \
+ if(FUNCTIONPOINTER == NULL || dlerror() != NULL) \
+ probe_terminate_with_err("function not found", #FUNCNAME, -1); \
probeBlockEnd(); \
} \
} while(0)
#include <app.h>
#include <Ecore.h>
+#include "damaps.h"
#include "daprobe.h"
#include "dahelper.h"
#include "probeinfo.h"
#include "binproto.h"
+#include "common_probe_init.h"
/* FIXME think of a better solution for conditional build. */
#ifndef PRIVATE_CAPI_APPFW
#define PACK_ORIGINAL_APPFWCYCLE(API_ID, RTYPE, RVAL, INPUTFORMAT, ...) \
newerrno = errno; \
do { \
- if(postBlockBegin(blockresult)) { \
- PREPARE_LOCAL_BUF(); \
- PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, API_ID, INPUTFORMAT, __VA_ARGS__); \
- PACK_COMMON_END(RTYPE, RVAL, newerrno, blockresult); \
- FLUSH_LOCAL_BUF(); \
- postBlockEnd(); \
- } \
+ PREPARE_LOCAL_BUF(); \
+ PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, API_ID, INPUTFORMAT, __VA_ARGS__); \
+ PACK_COMMON_END(RTYPE, RVAL, newerrno, blockresult); \
+ FLUSH_LOCAL_BUF(); \
} while(0); \
errno = (newerrno != 0) ? newerrno : olderrno
-static enum DaOptions _sopt = OPT_ALWAYSON;
-
static bool _dalc_app_create(void *user_data)
{
bool bret = false;
- DECLARE_VARIABLE_STANDARD;
+ DECLARE_ERRNO_VARS;
+ int blockresult = 1;
- bfiltering = false;
- PRE_PROBEBLOCK();
bret = gAppCallback.create(user_data);
PACK_ORIGINAL_APPFWCYCLE(API_ID__dalc_app_create, 'b', bret, "p",
static void _dalc_app_terminate(void *user_data)
{
- DECLARE_VARIABLE_STANDARD;
-
- bfiltering = false;
- PRE_PROBEBLOCK();
+ DECLARE_ERRNO_VARS;
+ int blockresult = 1;
gAppCallback.terminate(user_data);
static void _dalc_app_pause(void *user_data)
{
- DECLARE_VARIABLE_STANDARD;
-
- bfiltering = false;
- PRE_PROBEBLOCK();
+ DECLARE_ERRNO_VARS;
+ int blockresult = 1;
gAppCallback.pause(user_data);
static void _dalc_app_resume(void *user_data)
{
- DECLARE_VARIABLE_STANDARD;
-
- bfiltering = false;
- PRE_PROBEBLOCK();
+ DECLARE_ERRNO_VARS;
+ int blockresult = 1;
gAppCallback.resume(user_data);
static void _dalc_app_service(service_h handle, void *user_data)
#endif /* PRIVATE_CAPI_APPFW */
{
- DECLARE_VARIABLE_STANDARD;
-
- bfiltering = false;
- PRE_PROBEBLOCK();
+ DECLARE_ERRNO_VARS;
+ int blockresult = 1;
#ifdef PRIVATE_CAPI_APPFW
gAppCallback.app_control(handle, user_data);
--- /dev/null
+/*
+ * DA probe
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Vitaliy Cherepanov <v.cherepanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - Samsung RnD Institute Russia
+ *
+ */
+
+#include "da_gles20.h"
+#include "daprobe.h"
+#include "binproto.h"
+#include "common_probe_init.h"
+
+static enum DaOptions _sopt = OPT_GLES;
+
+/* Evas open gl API functions */
+
+void evas_gl_free(Evas_GL *evas_gl)
+{
+ typedef void (*methodType)(Evas_GL *evas_gl);
+ BEFORE_EVAS_GL(evas_gl_free);
+ evas_gl_freep(evas_gl);
+ GL_GET_ERROR();
+ AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "p",
+ evas_gl);
+}
+
+void evas_gl_config_free(Evas_GL_Config *cfg)
+{
+ typedef void (*methodType)(Evas_GL_Config *cfg);
+ BEFORE_EVAS_GL(evas_gl_config_free);
+ evas_gl_config_freep(cfg);
+ GL_GET_ERROR();
+ AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "p",
+ cfg);
+}
+
+void evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf)
+{
+ typedef void (*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf);
+ BEFORE_EVAS_GL(evas_gl_surface_destroy);
+ evas_gl_surface_destroyp(evas_gl, surf);
+ GL_GET_ERROR();
+ AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "pp",
+ evas_gl, surf);
+}
+
+void evas_gl_context_destroy(Evas_GL *evas_gl, Evas_GL_Context *ctx)
+{
+ typedef void (*methodType)(Evas_GL *evas_gl, Evas_GL_Context *ctx);
+ BEFORE_EVAS_GL(evas_gl_context_destroy);
+ evas_gl_context_destroyp(evas_gl, ctx);
+ GL_GET_ERROR();
+ AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "pp",
+ evas_gl, ctx);
+}
+
+
+Evas_GL *evas_gl_new(Evas *e)
+{
+ typedef Evas_GL *(*methodType)(Evas *e);
+ BEFORE_EVAS_GL(evas_gl_new);
+ Evas_GL *res = evas_gl_newp(e);
+ GL_GET_ERROR();
+ AFTER('p', res, APITYPE_CONTEXT, "", "p",
+ e);
+ return res;
+}
+
+Evas_GL_Config *evas_gl_config_new(void)
+{
+ typedef Evas_GL_Config *(*methodType)(void);
+ BEFORE_EVAS_GL(evas_gl_config_new);
+ Evas_GL_Config *res = evas_gl_config_newp();
+ GL_GET_ERROR();
+ AFTER_NO_PARAM('p', res, APITYPE_CONTEXT, "");
+ return res;
+}
+
+Evas_GL_Surface *evas_gl_surface_create(Evas_GL *evas_gl, Evas_GL_Config *cfg,
+ int w, int h)
+{
+ typedef Evas_GL_Surface *(*methodType)(Evas_GL *evas_gl,
+ Evas_GL_Config *cfg,
+ int w, int h);
+ BEFORE_EVAS_GL(evas_gl_surface_create);
+ Evas_GL_Surface *res = evas_gl_surface_createp(evas_gl, cfg, w, h);
+ GL_GET_ERROR();
+ AFTER('p', res, APITYPE_CONTEXT, "", "ppdd",
+ evas_gl, cfg, w, h);
+ return res;
+}
+
+Evas_GL_Context *evas_gl_context_create(Evas_GL *evas_gl,
+ Evas_GL_Context *share_ctx)
+{
+ typedef Evas_GL_Context *(*methodType)(Evas_GL *evas_gl, Evas_GL_Context *share_ctx);
+ BEFORE_EVAS_GL(evas_gl_context_create);
+ Evas_GL_Context *res = evas_gl_context_createp(evas_gl, share_ctx);
+ GL_GET_ERROR();
+ AFTER('p', res, APITYPE_CONTEXT, "", "pp",
+ evas_gl, share_ctx);
+ return res;
+}
+
+Eina_Bool evas_gl_make_current(Evas_GL *evas_gl, Evas_GL_Surface *surf,
+ Evas_GL_Context *ctx)
+{
+ typedef Eina_Bool (*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf,
+ Evas_GL_Context *ctx);
+ BEFORE_EVAS_GL(evas_gl_make_current);
+ Eina_Bool res = evas_gl_make_currentp(evas_gl, surf, ctx);
+ GL_GET_ERROR();
+ AFTER('b', res, APITYPE_CONTEXT, "", "ppp",
+ evas_gl, surf, ctx);
+ return res;
+}
+
+const char *evas_gl_string_query(Evas_GL *evas_gl, int name)
+{
+ typedef const char *(*methodType)(Evas_GL *evas_gl, int name);
+ BEFORE_EVAS_GL(evas_gl_string_query);
+ const char *res = evas_gl_string_queryp(evas_gl, name);
+ GL_GET_ERROR();
+ AFTER('s', res, APITYPE_CONTEXT, "", "pd",
+ evas_gl, name);
+ return res;
+}
+
+Evas_GL_Func evas_gl_proc_address_get(Evas_GL *evas_gl, const char *name)
+{
+ typedef Evas_GL_Func(*methodType)(Evas_GL *evas_gl, const char *name);
+ BEFORE_EVAS_GL(evas_gl_proc_address_get);
+ Evas_GL_Func res = evas_gl_proc_address_getp(evas_gl, name);
+ GL_GET_ERROR();
+ AFTER('p', res, APITYPE_CONTEXT, "", "ps",
+ evas_gl, name);
+ return res;
+}
+
+Eina_Bool evas_gl_native_surface_get(Evas_GL *evas_gl, Evas_GL_Surface *surf,
+ Evas_Native_Surface *ns)
+{
+ typedef Eina_Bool(*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf,
+ Evas_Native_Surface *ns);
+ BEFORE_EVAS_GL(evas_gl_native_surface_get);
+ Eina_Bool res = evas_gl_native_surface_getp(evas_gl, surf, ns);
+ GL_GET_ERROR();
+ AFTER('b', res, APITYPE_CONTEXT, "", "ppp",
+ evas_gl, surf, ns);
+ return res;
+}
+
+Evas_GL_API *evas_gl_api_get(Evas_GL *evas_gl)
+{
+ typedef Evas_GL_API *(*methodType)(Evas_GL *evas_gl);
+ BEFORE_EVAS_GL(evas_gl_api_get);
+ Evas_GL_API *res = evas_gl_api_getp(evas_gl);
+
+ GL_GET_ERROR();
+ AFTER('p', res, APITYPE_CONTEXT, "", "p",
+ evas_gl);
+ return res;
+}
+
+++ /dev/null
-/*
- * DA probe
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- *
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- * Vitaliy Cherepanov <v.cherepanov@samsung.com>
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#ifndef DA_GLES20_H_
-#define DA_GLES20_H_
-
-/*
- * TODO find this headers. need for EGL_Context and other
-#include <egl.h>
-#include <eglext.h>
-#include <gl2.h>
-#include <gl2ext.h>
-*/
-
-#include <Evas_GL.h>
-#include <Evas.h>
-
-#include <errno.h>
-#include "daprobe.h"
-#include "dahelper.h"
-
-/* TODO add egl header for next */
-#define EGLContext void *
-extern EGLContext eglGetCurrentContext(void);
-
-#define NO_RETURN_FORMAT "%s"
-#define NO_RETURN_VALUE 0
-#define APITYPE_INIT 0
-#define APITYPE_CONTEXT 1
-#define APITYPE_NO_CONTEXT 2
-
-#define FUNC(FUNCNAME) FUNCNAME
-#define FUNCSTR(FUNCNAME) #FUNCNAME
-#define FUNCID(FUNCNAME) API_ID_##FUNCNAME
-
-#define PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time) \
- do { /* PACK_GL_ADD_COMMON */ \
- BUF_PTR = pack_int64(BUF_PTR, voidp_to_uint64((void *)eglGetCurrentContext()));\
- BUF_PTR = pack_int32(BUF_PTR, (uint32_t)GL_api_type); \
- BUF_PTR = pack_int64(BUF_PTR, (uint64_t)GL_elapsed_time); \
- } while (0)
-
-#define PACK_GL_ADD(GL_api_type, GL_elapsed_time, GL_context_value) \
- do { /* PACK_GL_ADD */ \
- PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time); \
- BUF_PTR = pack_string(BUF_PTR, GL_context_value); \
- } while (0)
-
-#define PACK_GL_SHADER(GL_api_type, GL_elapsed_time, GL_shader, GL_shader_size) \
- do { /* PACK_GL_SHADER */ \
- PACK_GL_ADD_COMMON(GL_api_type, GL_elapsed_time); \
- uint32_t min = (sizeof(LOCAL_BUF) - (BUF_PTR - LOCAL_BUF)); \
- if (min > MAX_SHADER_LEN) \
- min = MAX_SHADER_LEN; \
- BUF_PTR = pack_string_to_file(BUF_PTR, GL_shader, \
- GL_shader_size, min); \
- } while (0)
-
-#define BEFORE(FUNCNAME) \
- DECLARE_VARIABLE_STANDARD_NORET; \
- GLenum error = GL_NO_ERROR; \
- static methodType FUNCNAME ## p = 0; \
- int32_t vAPI_ID = API_ID_ ## FUNCNAME; \
- uint64_t start_nsec = 0; \
- PRE_PROBEBLOCK(); \
- if(blockresult != 0) \
- start_nsec = get_current_nsec(); \
- if(!FUNCNAME##p) { \
- init_probe_gl(#FUNCNAME, (void **)&FUNCNAME##p, \
- LIBGLES20, blockresult, vAPI_ID); \
- }
-
-#define INIT_LIB_ID_STR(LIB_ID, LIB_STR, KEYS) \
- if (lib_handle[LIB_ID] == ((void *) 0)) { \
- lib_handle[LIB_ID] = dlopen(LIB_STR, RTLD_LAZY | RTLD_GLOBAL); \
- if (lib_handle[LIB_ID] == ((void *) 0)) { \
- char perror_msg[128]; \
- sprintf(perror_msg, "dlopen failed : [%s],%s", \
- __FUNCTION__, LIB_STR); \
- perror(perror_msg); \
- exit(0); \
- } \
- }
-
-#define INIT_LIB(LIB_ID, KEYS) \
- INIT_LIB_ID_STR(LIB_ID, lib_string[LIB_ID], KEYS)
-
-
-#define BEFORE_EGL_NATIVE(FUNCNAME) \
- DECLARE_VARIABLE_STANDARD_NORET; \
- GLenum error = EGL_SUCCESS; \
- static methodType FUNCNAME ## p = 0; \
- int32_t vAPI_ID = API_ID_ ## FUNCNAME; \
- uint64_t start_nsec = 0; \
- PRE_PROBEBLOCK(); \
- if(blockresult != 0) \
- start_nsec = get_current_nsec(); \
- if(!FUNCNAME##p) \
- init_probe_egl(#FUNCNAME, (void **)&FUNCNAME##p, LIBEGL)
-
-#define EGL_GET_ERROR() \
- if (blockresult != 0) { \
- error = eglGetError(); \
- }
-
-#define AFTER(RET_TYPE, RET_VAL, APITYPE, CONTEXT_VAL, INPUTFORMAT, ...) \
- POST_PACK_PROBEBLOCK_BEGIN(); \
- PREPARE_LOCAL_BUF(); \
- PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, INPUTFORMAT, __VA_ARGS__); \
- PACK_COMMON_END(RET_TYPE, RET_VAL, error, blockresult); \
- PACK_GL_ADD(APITYPE, get_current_nsec() - start_nsec, CONTEXT_VAL); \
- FLUSH_LOCAL_BUF(); \
- POST_PACK_PROBEBLOCK_END()
-
-#define AFTER_NO_PARAM(RET_TYPE, RETVAL, APITYPE, CONTEXTVALUE) \
- AFTER(RET_TYPE, RETVAL, APITYPE, CONTEXTVALUE, "", 0)
-
-#define GL_GET_ERROR() \
- if (blockresult != 0) { \
- error = glGetError(); \
- }
-
-#define AFTER_SHADER(RET_TYPE, RET_VAL, APITYPE, CONTEXT_VAL, CONTEXT_SIZE, INPUTFORMAT, ...) \
- POST_PACK_PROBEBLOCK_BEGIN(); \
- PREPARE_LOCAL_BUF(); \
- PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, INPUTFORMAT, __VA_ARGS__); \
- PACK_COMMON_END(RET_TYPE, RET_VAL, error, blockresult); \
- PACK_GL_SHADER(APITYPE, get_current_nsec() - start_nsec, CONTEXT_VAL, CONTEXT_SIZE); \
- FLUSH_LOCAL_BUF(); \
- POST_PACK_PROBEBLOCK_END()
-
-#endif /* DA_GLES20_H_ */
-
static enum DaOptions _sopt = OPT_GLES;
static __thread GLenum gl_error_external = GL_NO_ERROR;
-GLenum glGetError(void);
-void glGetIntegerv(GLenum pname, GLint * params);
-
-static void init_probe_gl(const char *func_name, void **func_pointer,
- ORIGINAL_LIBRARY id, int blockresult, int32_t vAPI_ID)
-{
- void *faddr;
-
- probeBlockStart();
- if (lib_handle[id] == ((void *)0)) {
- lib_handle[id] = dlopen(lib_string[id], RTLD_LAZY);
- if (lib_handle[id] == ((void *)0))
- probe_terminate_with_err("dlopen failed", func_name, id);
-
- probeInfo_t tempProbeInfo;
- setProbePoint(&tempProbeInfo);
- if (blockresult != 0) {
- /* get max value */
- char maxValString[64];
- GLint maxVal[2];
- glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVal[0]);
- glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxVal[1]);
- sprintf(maxValString, "%d,%d", maxVal[0], maxVal[1]);
- PREPARE_LOCAL_BUF();
- PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, "", 0);
- PACK_COMMON_END('p', 1, 0, 0);
- PACK_GL_ADD(APITYPE_INIT, 0, maxValString);
- FLUSH_LOCAL_BUF();
- }
- }
-
- faddr = dlsym(lib_handle[id], func_name);
- if (faddr == NULL || dlerror() != NULL)
- probe_terminate_with_err("dlopen failed", func_name, id);
-
- memcpy(func_pointer, &faddr, sizeof(faddr));
- probeBlockEnd();
-}
// ==================================================================
// A 2
// ==================================================================
#include "dautil.h"
#include "da_memory.h"
#include "binproto.h"
+#include "common_probe_init.h"
static enum DaOptions _sopt = OPT_ALLOC;
ecore_event_evas_mouse_button_up
ecore_event_evas_mouse_move
+evas_gl_free
+evas_gl_config_free
+evas_gl_surface_destroy
+evas_gl_context_destroy
+evas_gl_new
+evas_gl_config_new
+evas_gl_surface_create
+evas_gl_context_create
+evas_gl_make_current
+evas_gl_string_query
+evas_gl_proc_address_get
+evas_gl_native_surface_get
+evas_gl_api_get
+
accept
accept4
bind