[FEATURE] add evas_gl_ probes 03/25003/5
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Fri, 25 Jul 2014 08:38:58 +0000 (12:38 +0400)
committerVitaliy Andreevich <v.cherepanov@samsung.com>
Mon, 4 Aug 2014 09:48:25 +0000 (02:48 -0700)
Change-Id: If427748901885dc2ae44e06f36f9ac59e1d8d86b
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
12 files changed:
Makefile
helper/common_probe_init.c [new file with mode: 0644]
helper/common_probe_init.cpp [deleted file]
include/common_probe_init.h
include/da_gles20.h [new file with mode: 0644]
include/daprobe.h
probe_capi/capi_appfw.c
probe_graphics/da_evas_gl.c [new file with mode: 0644]
probe_graphics/da_gles20.h [deleted file]
probe_graphics/da_gles20_tizen.cpp
probe_memory/libdamemmanage.c
scripts/api_names.txt

index 593e6f8eddc74e39dae8cc1d8e29faae6e64d36e..43836725e5e8d6cb200667fce07b5e8bf14528ae 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -94,13 +94,13 @@ CAPI_SRCS =         $(COMMON_SRCS)                  \
 #              ./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.
diff --git a/helper/common_probe_init.c b/helper/common_probe_init.c
new file mode 100644 (file)
index 0000000..4ecabd7
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ *  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();
+}
diff --git a/helper/common_probe_init.cpp b/helper/common_probe_init.cpp
deleted file mode 100644 (file)
index 7b4883f..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  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
index 541f9bbb4b091c537b143bd8ffb1578042ce528d..f2daf2555b9622029f65757008c2a1edca8eb3c1 100644 (file)
 #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__ */
diff --git a/include/da_gles20.h b/include/da_gles20.h
new file mode 100644 (file)
index 0000000..d3e3cf8
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ *  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_ */
+
index 3c37edbaeed98be7bbd34deaa961b7918805ab9a..3e6279848da159bb1c6cbb91f2b643944c8bf69a 100644 (file)
@@ -178,14 +178,16 @@ typedef struct {
 // =========================== 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
@@ -230,10 +232,8 @@ typedef struct {
                        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)
index 716e250408729ebc8168a480be898b84f18f74f2..5578450201a8052d8adcdf317643a85ac2ad498a 100644 (file)
 
 #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
@@ -54,25 +56,19 @@ app_event_callback_s gAppCallback;
 #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",
@@ -83,10 +79,8 @@ static bool _dalc_app_create(void *user_data)
 
 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);
 
@@ -96,10 +90,8 @@ static void _dalc_app_terminate(void *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);
 
@@ -109,10 +101,8 @@ static void _dalc_app_pause(void *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);
 
@@ -126,10 +116,8 @@ static void _dalc_app_control(app_control_h handle, void *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);
diff --git a/probe_graphics/da_evas_gl.c b/probe_graphics/da_evas_gl.c
new file mode 100644 (file)
index 0000000..4ed385f
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ *  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;
+}
+
diff --git a/probe_graphics/da_gles20.h b/probe_graphics/da_gles20.h
deleted file mode 100644 (file)
index dcdaa38..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *  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_ */
-
index 610950ca5da19c01fccbb3b05289727993c8aebf..2b6f58e4c2b09d9d8e36eda8446bef00b67a93b2 100644 (file)
@@ -38,44 +38,6 @@ static char contextValue[MAX_GL_CONTEXT_VALUE_SIZE];
 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
 // ==================================================================
index 7e757801e79ca990698372a4115dbfef53fea117..117259fe0f6e8bb0be32c7c45c89abf090159481 100644 (file)
@@ -42,6 +42,7 @@
 #include "dautil.h"
 #include "da_memory.h"
 #include "binproto.h"
+#include "common_probe_init.h"
 
 static enum DaOptions _sopt = OPT_ALLOC;
 
index a95ac35eb365fc2503e2135381f2de94e7b5ca6d..d1ffa3ca9470d94c83b039ad02ed64ddc9fc13df 100644 (file)
@@ -285,6 +285,20 @@ ecore_event_evas_mouse_button_down
 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