# ./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.
*/
#include <unistd.h>
+#include "da_gles20.h"
+#include "binproto.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];
+ const char *lib_name = "unknown";
- sprintf(error_msg, "%s : [%s], %s", msg, func_name, lib_string[id]);
+ 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
// 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)
{
probe_terminate_with_err("dlopen failed", func_name, id);
};
faddr = dlsym(lib_handle[id], func_name);
- if (faddr == __null || dlerror() != __null)
+ 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();
+}
#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__ */
#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()));\
+ /* 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)
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;
+}
+
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