[FEATURE] add egl probes. 39/16939/6
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 27 Feb 2014 08:43:11 +0000 (12:43 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 28 Mar 2014 12:19:45 +0000 (05:19 -0700)
Change-Id: Ia73055097f0ed201f7e67153fa2e8c5077546db4
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
Makefile
helper/common_probe_init.cpp [new file with mode: 0644]
include/common_probe_init.h [new file with mode: 0644]
probe_graphics/da_egl_native.cpp [new file with mode: 0644]
probe_graphics/da_egl_tizen.cpp [new file with mode: 0644]
probe_graphics/da_gles20.h
probe_graphics/da_gles20_native.cpp
scripts/api_names.txt

index ae68397c3741d176404664548df82150d2149c35..06d34fe714eb94991126f59a8b1f41f741e9a9a1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -98,6 +98,7 @@ CAPI_SRCS =   $(COMMON_SRCS)                  \
 TIZEN_SRCS =   $(COMMON_SRCS)                          \
                ./helper/appfw-tizen.cpp                \
                ./helper/addr-tizen.c                   \
+               ./helper/common_probe_init.cpp          \
                ./probe_memory/libdanew.cpp             \
                ./probe_tizenapi/tizen_file.cpp         \
                ./probe_tizenapi/tizen_socket.cpp       \
@@ -113,7 +114,9 @@ TIZEN_SRCS =        $(COMMON_SRCS)                          \
                ./probe_ui/tizen_frameani.cpp           \
                ./probe_ui/tizen_display.cpp            \
                ./probe_graphics/da_gles20_tizen.cpp            \
-               ./probe_graphics/da_gles20_native.cpp
+               ./probe_graphics/da_gles20_native.cpp           \
+               ./probe_graphics/da_egl_tizen.cpp                       \
+               ./probe_graphics/da_egl_native.cpp
 
 ASM_SRC = ./helper/da_call_original.S
 
diff --git a/helper/common_probe_init.cpp b/helper/common_probe_init.cpp
new file mode 100644 (file)
index 0000000..0afa7f1
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  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;
+}
+////////////////////////////////////////////////////////////////////////////
+//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)
+{
+       char error_msg[1024];
+       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)) {
+                       sprintf(error_msg, "dlopen failed : [%s],%s",
+                               func_name, lib_string[id]);
+                       perror(error_msg);
+                       PRINTERR(error_msg);
+                       //wait for flush
+                       sleep(1);
+                       exit(0);
+               }
+       };
+       faddr = dlsym(lib_handle[id], func_name);
+       if (faddr == __null || dlerror() != __null) {
+               sprintf(error_msg, "dlsym failed : [%s],%s",
+                       func_name, lib_string[id]);
+               perror(error_msg);
+               PRINTERR(error_msg);
+               //wait for flush
+               sleep(1);
+               exit(0);
+       }
+       memcpy(func_pointer, &faddr, sizeof(faddr));
+       (gProbeBlockCount--);
+}
+#endif
diff --git a/include/common_probe_init.h b/include/common_probe_init.h
new file mode 100644 (file)
index 0000000..102480d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  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
+ *
+ */
+#ifndef __COMMON_PROBE_INIT_H__
+#define __COMMON_PROBE_INIT_H__
+
+#include "dahelper.h"
+
+////////////////////////////////////////////////////////////////////////////
+//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
+void init_probe_egl(const char *func_name, void **func_pointer, ORIGINAL_LIBRARY id);
+
+#endif /* __COMMON_PROBE_INIT_H__ */
diff --git a/probe_graphics/da_egl_native.cpp b/probe_graphics/da_egl_native.cpp
new file mode 100644 (file)
index 0000000..db2f01f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *  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
+ *
+ */
+
+//disable tizen redefines
+#define _EGL_MACRO_H_
+
+//define search real function in library
+#define BEFORE_EGL BEFORE_EGL_NATIVE
+
+/*
+ * this include to make native open egl functions
+ * probe prototypes
+ *
+ */
+
+#include "da_egl_tizen.cpp"
+
+#undef _EGL_MACRO_H_
diff --git a/probe_graphics/da_egl_tizen.cpp b/probe_graphics/da_egl_tizen.cpp
new file mode 100644 (file)
index 0000000..d21fd5c
--- /dev/null
@@ -0,0 +1,625 @@
+/*
+ *  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
+ * - Samsung RnD Institute Russia
+ *
+ */
+
+#include <egl_macro.h>
+#include <egl.h>
+#include "da_gles20.h"
+#include "daprobe.h"
+#include "binproto.h"
+#include "common_probe_init.h"
+
+#ifndef BEFORE_EGL
+#define BEFORE_EGL     BEFORE_EGL_TIZEN
+#endif
+
+static enum DaOptions _sopt = OPT_GLES;
+static __thread EGLint egl_error_external = EGL_SUCCESS;
+
+EGLint eglGetError(void)
+{
+       typedef EGLint (*methodType)(void);
+       BEFORE_EGL(eglGetError);
+       EGLint ret = eglGetErrorp();
+
+       if (egl_error_external == EGL_SUCCESS)
+               egl_error_external = ret;
+
+       if (blockresult) {
+               //external call
+               ret = egl_error_external;
+               egl_error_external = EGL_SUCCESS;
+       }
+
+       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
+
+       return ret;
+}
+
+EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
+{
+       typedef EGLDisplay (*methodType)(EGLNativeDisplayType display_id);
+       /* probe prepare */
+       BEFORE_EGL(eglGetDisplay);
+       /* call original function */
+       EGLDisplay ret = eglGetDisplayp(display_id);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "", "p",
+             voidp_to_uint64(display_id));
+       return ret;
+}
+
+EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint *major,
+                                        EGLint *minor);
+       /* probe prepare */
+       BEFORE_EGL(eglInitialize);
+       /* call original function */
+       EGLBoolean ret = eglInitializep(dpy, major, minor);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "", "ppp", voidp_to_uint64(dpy),
+             voidp_to_uint64(major), voidp_to_uint64(minor));
+       return ret;
+}
+
+EGLBoolean eglTerminate(EGLDisplay dpy)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy);
+       /* probe prepare */
+       BEFORE_EGL(eglTerminate);
+       /* call original function */
+       EGLBoolean ret = eglTerminatep(dpy);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "", "p", voidp_to_uint64(dpy));
+       return ret;
+}
+
+const char *eglQueryString(EGLDisplay dpy, EGLint name)
+{
+       typedef const char *(*methodType)(EGLDisplay dpy, EGLint name);
+       /* probe prepare */
+       BEFORE_EGL(eglQueryString);
+       /* call original function */
+       const char *ret = eglQueryStringp(dpy, name);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('s', ret, APITYPE_CONTEXT, "", "pd", voidp_to_uint64(dpy), name);
+       return ret;
+}
+
+EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
+                        EGLint *num_config)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig *configs,
+                                        EGLint config_size,
+                                        EGLint *num_config);
+       /* probe prepare */
+       BEFORE_EGL(eglGetConfigs);
+       /* call original function */
+       EGLBoolean ret = eglGetConfigsp(dpy, configs, config_size, num_config);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "", "ppdp",
+             voidp_to_uint64(dpy), voidp_to_uint64(configs), config_size,
+             voidp_to_uint64(num_config));
+       return ret;
+}
+
+EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+                          EGLConfig *configs, EGLint config_size,
+                          EGLint *num_config)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy,
+                                        const EGLint *attrib_list,
+                                        EGLConfig *configs, EGLint config_size,
+                                        EGLint *num_config);
+       /* probe prepare */
+       BEFORE_EGL(eglChooseConfig);
+       /* call original function */
+       EGLBoolean ret = eglChooseConfigp(dpy, attrib_list, configs,
+                                         config_size, num_config);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pppdp", voidp_to_uint64(dpy), voidp_to_uint64(attrib_list),
+             voidp_to_uint64(configs), config_size,
+             voidp_to_uint64(num_config));
+       return ret;
+}
+
+EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+                             EGLint attribute, EGLint *value)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig config,
+                                        EGLint attribute, EGLint *value);
+       /* probe prepare */
+       BEFORE_EGL(eglGetConfigAttrib);
+       /* call original function */
+       EGLBoolean ret = eglGetConfigAttribp(dpy, config, attribute, value);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(config), attribute,
+             voidp_to_uint64(value));
+       return ret;
+}
+
+EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+                                 EGLNativeWindowType win,
+                                 const EGLint *attrib_list)
+{
+       typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
+                                        EGLNativeWindowType win,
+                                        const EGLint *attrib_list);
+       /* probe prepare */
+       BEFORE_EGL(eglCreateWindowSurface);
+       /* call original function */
+       EGLSurface ret = eglCreateWindowSurfacep(dpy, config, win, attrib_list);
+
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
+             voidp_to_uint64(win), voidp_to_uint64(attrib_list));
+       return ret;
+}
+
+EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+                                  const EGLint *attrib_list)
+{
+       typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
+                                        const EGLint *attrib_list);
+       /* probe prepare */
+       BEFORE_EGL(eglCreatePbufferSurface);
+       /* call original function */
+       EGLSurface ret = eglCreatePbufferSurfacep(dpy, config, attrib_list);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "ppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
+             voidp_to_uint64(attrib_list));
+       return ret;
+}
+
+EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+                                 EGLNativePixmapType pixmap,
+                                 const EGLint *attrib_list)
+{
+       typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
+                                        EGLNativePixmapType pixmap,
+                                        const EGLint *attrib_list);
+       /* probe prepare */
+       BEFORE_EGL(eglCreatePixmapSurface);
+       /* call original function */
+       EGLSurface ret = eglCreatePixmapSurfacep(dpy, config, pixmap,
+                                                attrib_list);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
+             voidp_to_uint64(pixmap), voidp_to_uint64(attrib_list));
+       return ret;
+}
+
+EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
+       /* probe prepare */
+       BEFORE_EGL(eglDestroySurface);
+       /* call original function */
+       EGLBoolean ret = eglDestroySurfacep(dpy, surface);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
+       return ret;
+}
+
+EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute,
+                          EGLint *value)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
+                                        EGLint attribute, EGLint *value);
+       /* probe prepare */
+       BEFORE_EGL(eglQuerySurface);
+       /* call original function */
+       EGLBoolean ret = eglQuerySurfacep(dpy, surface, attribute, value);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
+             attribute, voidp_to_uint64(value));
+       return ret;
+}
+
+EGLBoolean eglBindAPI(EGLenum api)
+{
+       typedef EGLBoolean (*methodType)(EGLenum api);
+       /* probe prepare */
+       BEFORE_EGL(eglBindAPI);
+       /* call original function */
+       EGLBoolean ret = eglBindAPIp(api);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "d", api);
+       return ret;
+}
+
+EGLenum eglQueryAPI(void)
+{
+       typedef EGLenum (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglQueryAPI);
+       /* call original function */
+       EGLenum ret = eglQueryAPIp();
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLBoolean eglWaitClient(void)
+{
+       typedef EGLBoolean (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglWaitClient);
+       /* call original function */
+       EGLBoolean ret = eglWaitClientp();
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLBoolean eglReleaseThread(void)
+{
+       typedef EGLBoolean (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglReleaseThread);
+       /* call original function */
+       EGLBoolean ret = eglReleaseThreadp();
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
+                                           EGLClientBuffer buffer,
+                                           EGLConfig config,
+                                           const EGLint *attrib_list)
+{
+       typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLenum buftype,
+                                        EGLClientBuffer buffer,
+                                        EGLConfig config,
+                                        const EGLint *attrib_list);
+       /* probe prepare */
+       BEFORE_EGL(eglCreatePbufferFromClientBuffer);
+       /* call original function */
+       EGLSurface ret = eglCreatePbufferFromClientBufferp(dpy, buftype, buffer,
+                                                          config, attrib_list);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "pdppp", voidp_to_uint64(dpy), buftype, voidp_to_uint64(buffer),
+             voidp_to_uint64(config), voidp_to_uint64(attrib_list));
+       return ret;
+}
+
+EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+                           EGLint attribute, EGLint value)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
+                                        EGLint attribute, EGLint value);
+       /* probe prepare */
+       BEFORE_EGL(eglSurfaceAttrib);
+       /* call original function */
+       EGLBoolean ret = eglSurfaceAttribp(dpy, surface, attribute, value);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppdd", voidp_to_uint64(dpy), voidp_to_uint64(surface), attribute,
+             value);
+       return ret;
+}
+
+EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
+                                        EGLint buffer);
+       /* probe prepare */
+       BEFORE_EGL(eglBindTexImage);
+       /* call original function */
+       EGLBoolean ret = eglBindTexImagep(dpy, surface, buffer);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
+       return ret;
+}
+
+EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
+                                        EGLint buffer);
+       /* probe prepare */
+       BEFORE_EGL(eglReleaseTexImage);
+       /* call original function */
+       EGLBoolean ret = eglReleaseTexImagep(dpy, surface, buffer);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
+       return ret;
+}
+
+EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint interval);
+       /* probe prepare */
+       BEFORE_EGL(eglSwapInterval);
+       /* call original function */
+       EGLBoolean ret = eglSwapIntervalp(dpy, interval);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pd", voidp_to_uint64(dpy), interval);
+       return ret;
+}
+
+EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
+                           EGLContext share_context, const EGLint *attrib_list)
+{
+       typedef EGLContext (*methodType)(EGLDisplay dpy, EGLConfig config,
+                                        EGLContext share_context,
+                                        const EGLint *attrib_list);
+       /* probe prepare */
+       BEFORE_EGL(eglCreateContext);
+       /* call original function */
+       EGLContext ret = eglCreateContextp(dpy, config, share_context,
+                                          attrib_list);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
+             voidp_to_uint64(share_context), voidp_to_uint64(attrib_list));
+       return ret;
+}
+
+EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx);
+       /* probe prepare */
+       BEFORE_EGL(eglDestroyContext);
+       /* call original function */
+       EGLBoolean ret = eglDestroyContextp(dpy, ctx);
+       /* get error code */
+       EGL_GET_ERROR()
+
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pp", voidp_to_uint64(dpy), voidp_to_uint64(ctx));
+       return ret;
+}
+
+EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
+                         EGLContext ctx)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface draw,
+                                        EGLSurface read, EGLContext ctx);
+       /* probe prepare */
+       BEFORE_EGL(eglMakeCurrent);
+       /* call original function */
+       EGLBoolean ret = eglMakeCurrentp(dpy, draw, read, ctx);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pppp", voidp_to_uint64(dpy), voidp_to_uint64(draw),
+             voidp_to_uint64(read), voidp_to_uint64(ctx));
+       return ret;
+}
+
+EGLContext eglGetCurrentContext(void)
+{
+       typedef EGLContext (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglGetCurrentContext);
+       /* call original function */
+       EGLContext ret = eglGetCurrentContextp();
+
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLSurface eglGetCurrentSurface(EGLint readdraw)
+{
+       typedef EGLSurface (*methodType)(EGLint readdraw);
+       /* probe prepare */
+       BEFORE_EGL(eglGetCurrentSurface);
+       /* call original function */
+       EGLSurface ret = eglGetCurrentSurfacep(readdraw);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
+             "d", readdraw);
+       return ret;
+}
+
+EGLDisplay eglGetCurrentDisplay(void)
+{
+       typedef EGLDisplay (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglGetCurrentDisplay);
+       /* call original function */
+       EGLDisplay ret = eglGetCurrentDisplayp();
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute,
+                          EGLint *value)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx,
+                                        EGLint attribute, EGLint *value);
+       /* probe prepare */
+       BEFORE_EGL(eglQueryContext);
+       /* call original function */
+       EGLBoolean ret = eglQueryContextp(dpy, ctx, attribute, value);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(ctx),
+             attribute, voidp_to_uint64(value));
+       return ret;
+}
+
+EGLBoolean eglWaitGL(void)
+{
+       typedef EGLBoolean (*methodType)(void);
+       /* probe prepare */
+       BEFORE_EGL(eglWaitGL);
+       /* call original function */
+       EGLBoolean ret = eglWaitGLp();
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
+       return ret;
+}
+
+EGLBoolean eglWaitNative(EGLint engine)
+{
+       typedef EGLBoolean (*methodType)(EGLint engine);
+       /* probe prepare */
+       BEFORE_EGL(eglWaitNative);
+       /* call original function */
+       EGLBoolean ret = eglWaitNativep(engine);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "d", engine);
+       return ret;
+}
+
+EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
+       BEFORE_EGL(eglSwapBuffers);
+       EGLBoolean ret = eglSwapBuffersp(dpy, surface);
+       EGL_GET_ERROR();
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
+       return ret;
+}
+
+EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+                         EGLNativePixmapType target)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
+                                        EGLNativePixmapType target);
+       /* probe prepare */
+       BEFORE_EGL(eglCopyBuffers);
+       /* call original function */
+       EGLBoolean ret = eglCopyBuffersp(dpy, surface, target);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "ppp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
+             voidp_to_uint64(target));
+       return ret;
+}
+
+#define __eglGetProcAddress_t __eglMustCastToProperFunctionPointerType
+EGLAPI __eglGetProcAddress_t eglGetProcAddress(const char *procname)
+{
+       typedef EGLAPI __eglGetProcAddress_t(*methodType)(const char *procname);
+       /* probe prepare */
+       BEFORE_EGL(eglGetProcAddress);
+       /* call original function */
+       __eglGetProcAddress_t ret = eglGetProcAddressp(procname);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('p', voidp_to_uint64((void *)ret), APITYPE_CONTEXT, "",
+             "s", procname);
+       return ret;
+}
+
+EGLBoolean eglUpdateBufferOSP(EGLDisplay dpy, EGLSurface surface)
+{
+       typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
+       /* probe prepare */
+       BEFORE_EGL(eglUpdateBufferOSP);
+       /* call original function */
+       EGLBoolean ret = eglUpdateBufferOSPp(dpy, surface);
+       /* get error code */
+       EGL_GET_ERROR();
+       /* pack and send */
+       AFTER('d', ret, APITYPE_CONTEXT, "",
+             "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
+       return ret;
+}
index 60a3c12b215474c605330d9c4d4dfca70f652ff2..8e995382e428a4d4e07a33594f1f0d8822afee94 100644 (file)
 #define INIT_LIB(LIB_ID, KEYS)                                         \
        INIT_LIB_ID_STR(LIB_ID, lib_string[LIB_ID], KEYS)
 
-#define BEFORE_EGL(FUNCNAME)                                   \
+
+#define BEFORE_EGL_NATIVE(FUNCNAME)                                    \
        DECLARE_VARIABLE_STANDARD_NORET;                                \
-       GLenum error = GL_NO_ERROR;                                     \
+       GLenum error = EGL_SUCCESS;                                     \
        static methodType FUNCNAME ## p = 0;                            \
-       void* tmpPtr = 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) {                                              \
-               probeBlockStart();                                      \
-               INIT_LIB(LIBEGL, RTLD_LAZY | RTLD_GLOBAL);              \
-               tmpPtr = dlsym(lib_handle[LIBEGL], #FUNCNAME);          \
-               if (tmpPtr == NULL || dlerror() != NULL) {              \
-                       perror("dlsym failed : " #FUNCNAME);            \
-                       exit(0);                                        \
-               }                                                       \
-               memcpy(&FUNCNAME##p, &tmpPtr, sizeof(tmpPtr));          \
-               probeBlockEnd();                                        \
+       if(!FUNCNAME##p)                                                \
+               init_probe_egl(#FUNCNAME, (void **)&FUNCNAME##p, LIBEGL)
+
+#define FUNC(FUNCNAME) FUNCNAME
+#define FUNCSTR(FUNCNAME) #FUNCNAME
+#define FUNCID(FUNCNAME) API_ID_##FUNCNAME
+
+#define BEFORE_EGL_TIZEN(FUNCNAME)                                     \
+       DECLARE_VARIABLE_STANDARD_NORET;                                \
+       GLenum error = EGL_SUCCESS;                                     \
+       static methodType FUNCNAME##p = 0;                              \
+       int32_t vAPI_ID = FUNCID(FUNCNAME);                             \
+       uint64_t start_nsec = 0;                                        \
+       PRE_PROBEBLOCK();                                               \
+       if(blockresult != 0)                                            \
+               start_nsec = get_current_nsec();                        \
+       if(!FUNCNAME##p)                                                \
+               init_probe_egl(FUNCSTR(FUNCNAME), (void **)&FUNCNAME##p, LIBOSP_UIFW)
+
+#define EGL_GET_ERROR()                                                        \
+       if (blockresult != 0) {                                         \
+               error = eglGetError();                                  \
        }
 
 #define BEFORE_OSP_UIFW(FUNCNAME)                                      \
index cb41fc2a7952957c83ae7964eec9be5d5a021083..51fbed9690b5a3c87cddee0ea00b7cc54ddc7724 100644 (file)
@@ -30,6 +30,7 @@
 #define _GL2_MACRO_H_
 #define _GL_MACRO_H_
 
+#include "common_probe_init.h"
 extern "C" {
 /*
  * this include to make C native open gl functions
@@ -41,59 +42,5 @@ extern "C" {
 
 } /* extern C */
 
-#undef eglSwapBuffers
-extern "C" EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
-       typedef EGLBoolean (*methodType)(EGLDisplay, EGLSurface);
-       BEFORE_EGL(eglSwapBuffers);
-       EGLBoolean ret = eglSwapBuffersp(dpy, surface);
-       error = eglGetError();
-       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
-
-       return ret;
-}
-#define eglSwapBuffers _SglSwapBuffers
-
-EGLBoolean _SglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
-       typedef EGLBoolean (*methodType)(EGLDisplay, EGLSurface);
-       BEFORE_OSP_UIFW(_SglSwapBuffers);
-       EGLBoolean ret = _SglSwapBuffersp(dpy, surface);
-       error = eglGetError();
-       AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
-
-       return ret;
-}
-
-#undef eglGetProcAddress
-extern "C" EGLAPI __eglMustCastToProperFunctionPointerType
-eglGetProcAddress(const char* procname)
-{
-       typedef EGLAPI __eglMustCastToProperFunctionPointerType
-               (*methodType)(const char* procname);
-       __eglMustCastToProperFunctionPointerType ret = NULL;
-
-       BEFORE_EGL(eglGetProcAddress);
-
-       probeBlockStart();
-       INIT_LIB(LIBSELF, RTLD_LAZY | RTLD_GLOBAL);
-       ret = (typeof(ret)) dlsym(lib_handle[LIBSELF], procname);
-       if (dlerror() != NULL)
-               ret = NULL;
-       probeBlockEnd();
-
-       if (ret == NULL) {
-               // we don't have <procname> function in our lib
-               // so we need find original function
-               ret = eglGetProcAddressp(procname);
-               error = eglGetError();
-       }
-
-       AFTER_NO_PARAM('p', ret, APITYPE_CONTEXT, "");
-       return ret;
-
-}
-#define eglGetProcAddress _eglGetProcAddress
-
 #undef _GL2_MACRO_H_
 #undef _GL_MACRO_H_
index 54b6a432030c7d65b9b09bf8120800c0a9c39201..a95ac35eb365fc2503e2135381f2de94e7b5ca6d 100644 (file)
@@ -537,9 +537,78 @@ glIsRenderbuffer
 glIsShader
 glIsTexture
 
-_SglSwapBuffers
-eglSwapBuffers
+eglBindAPI
+eglBindTexImage
+eglChooseConfig
+eglCopyBuffers
+eglCreateContext
+eglCreatePbufferFromClientBuffer
+eglCreatePbufferSurface
+eglCreatePixmapSurface
+eglCreateWindowSurface
+eglDestroyContext
+eglDestroySurface
+eglGetConfigAttrib
+eglGetConfigs
+eglGetCurrentContext
+eglGetCurrentDisplay
+eglGetCurrentSurface
+eglGetDisplay
+eglGetError
 eglGetProcAddress
+eglInitialize
+eglMakeCurrent
+eglQueryAPI
+eglQueryContext
+eglQueryString
+eglQuerySurface
+eglReleaseTexImage
+eglReleaseThread
+eglSurfaceAttrib
+eglSwapBuffers
+eglSwapInterval
+eglTerminate
+eglUpdateBufferOSP
+eglWaitClient
+eglWaitGL
+eglWaitNative
+
+_SglBindAPI
+_SglBindTexImage
+_SglChooseConfig
+_SglCopyBuffers
+_SglCreateContext
+_SglCreatePbufferFromClientBuffer
+_SglCreatePbufferSurface
+_SglCreatePixmapSurface
+_SglCreateWindowSurface
+_SglDestroyContext
+_SglDestroySurface
+_SglGetConfigAttrib
+_SglGetConfigs
+_SglGetCurrentContext
+_SglGetCurrentDisplay
+_SglGetCurrentSurface
+_SglGetDisplay
+_SglGetError
+_SglGetProcAddress
+_SglInitialize
+_SglMakeCurrent
+_SglQueryAPI
+_SglQueryContext
+_SglQueryString
+_SglQuerySurface
+_SglReleaseTexImage
+_SglReleaseThread
+_SglSurfaceAttrib
+_SglSwapBuffers
+_SglSwapInterval
+_SglTerminate
+_SglUpdateBufferOSP
+_SglWaitClient
+_SglWaitGL
+_SglWaitNative
+
 
 _ZN5Tizen3Net7Sockets6Socket10SetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameEi###Socket::SetSockOpt
 _ZN5Tizen3Net7Sockets6Socket10SetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameERKNS1_12LingerOptionE###Socket::SetSockOpt