4 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
8 * Vitaliy Cherepanov <v.cherepanov@samsung.com>
10 * This library is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU Lesser General Public License as published by the
12 * Free Software Foundation; either version 2.1 of the License, or (at your option)
15 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
16 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software Foundation, Inc., 51
22 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 * - Samsung RnD Institute Russia
30 #include <egl_macro.h>
32 #include "da_gles20.h"
35 #include "common_probe_init.h"
38 #define BEFORE_EGL BEFORE_EGL_TIZEN
41 static enum DaOptions _sopt = OPT_GLES;
42 static __thread EGLint egl_error_external = EGL_SUCCESS;
44 EGLint eglGetError(void)
46 typedef EGLint (*methodType)(void);
47 BEFORE_EGL(eglGetError);
48 EGLint ret = eglGetErrorp();
50 if (egl_error_external == EGL_SUCCESS)
51 egl_error_external = ret;
55 ret = egl_error_external;
56 egl_error_external = EGL_SUCCESS;
59 AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
64 EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
66 typedef EGLDisplay (*methodType)(EGLNativeDisplayType display_id);
68 BEFORE_EGL(eglGetDisplay);
69 /* call original function */
70 EGLDisplay ret = eglGetDisplayp(display_id);
74 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "", "p",
75 voidp_to_uint64(display_id));
79 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
81 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint *major,
84 BEFORE_EGL(eglInitialize);
85 /* call original function */
86 EGLBoolean ret = eglInitializep(dpy, major, minor);
90 AFTER('d', ret, APITYPE_CONTEXT, "", "ppp", voidp_to_uint64(dpy),
91 voidp_to_uint64(major), voidp_to_uint64(minor));
95 EGLBoolean eglTerminate(EGLDisplay dpy)
97 typedef EGLBoolean (*methodType)(EGLDisplay dpy);
99 BEFORE_EGL(eglTerminate);
100 /* call original function */
101 EGLBoolean ret = eglTerminatep(dpy);
105 AFTER('d', ret, APITYPE_CONTEXT, "", "p", voidp_to_uint64(dpy));
109 const char *eglQueryString(EGLDisplay dpy, EGLint name)
111 typedef const char *(*methodType)(EGLDisplay dpy, EGLint name);
113 BEFORE_EGL(eglQueryString);
114 /* call original function */
115 const char *ret = eglQueryStringp(dpy, name);
119 AFTER('s', ret, APITYPE_CONTEXT, "", "pd", voidp_to_uint64(dpy), name);
123 EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
126 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig *configs,
130 BEFORE_EGL(eglGetConfigs);
131 /* call original function */
132 EGLBoolean ret = eglGetConfigsp(dpy, configs, config_size, num_config);
136 AFTER('d', ret, APITYPE_CONTEXT, "", "ppdp",
137 voidp_to_uint64(dpy), voidp_to_uint64(configs), config_size,
138 voidp_to_uint64(num_config));
142 EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
143 EGLConfig *configs, EGLint config_size,
146 typedef EGLBoolean (*methodType)(EGLDisplay dpy,
147 const EGLint *attrib_list,
148 EGLConfig *configs, EGLint config_size,
151 BEFORE_EGL(eglChooseConfig);
152 /* call original function */
153 EGLBoolean ret = eglChooseConfigp(dpy, attrib_list, configs,
154 config_size, num_config);
158 AFTER('d', ret, APITYPE_CONTEXT, "",
159 "pppdp", voidp_to_uint64(dpy), voidp_to_uint64(attrib_list),
160 voidp_to_uint64(configs), config_size,
161 voidp_to_uint64(num_config));
165 EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
166 EGLint attribute, EGLint *value)
168 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLConfig config,
169 EGLint attribute, EGLint *value);
171 BEFORE_EGL(eglGetConfigAttrib);
172 /* call original function */
173 EGLBoolean ret = eglGetConfigAttribp(dpy, config, attribute, value);
177 AFTER('d', ret, APITYPE_CONTEXT, "",
178 "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(config), attribute,
179 voidp_to_uint64(value));
183 EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
184 EGLNativeWindowType win,
185 const EGLint *attrib_list)
187 typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
188 EGLNativeWindowType win,
189 const EGLint *attrib_list);
191 BEFORE_EGL(eglCreateWindowSurface);
192 /* call original function */
193 EGLSurface ret = eglCreateWindowSurfacep(dpy, config, win, attrib_list);
198 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
199 "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
200 voidp_to_uint64(win), voidp_to_uint64(attrib_list));
204 EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
205 const EGLint *attrib_list)
207 typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
208 const EGLint *attrib_list);
210 BEFORE_EGL(eglCreatePbufferSurface);
211 /* call original function */
212 EGLSurface ret = eglCreatePbufferSurfacep(dpy, config, attrib_list);
216 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
217 "ppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
218 voidp_to_uint64(attrib_list));
222 EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
223 EGLNativePixmapType pixmap,
224 const EGLint *attrib_list)
226 typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLConfig config,
227 EGLNativePixmapType pixmap,
228 const EGLint *attrib_list);
230 BEFORE_EGL(eglCreatePixmapSurface);
231 /* call original function */
232 EGLSurface ret = eglCreatePixmapSurfacep(dpy, config, pixmap,
237 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
238 "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
239 voidp_to_uint64(pixmap), voidp_to_uint64(attrib_list));
243 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
245 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
247 BEFORE_EGL(eglDestroySurface);
248 /* call original function */
249 EGLBoolean ret = eglDestroySurfacep(dpy, surface);
253 AFTER('d', ret, APITYPE_CONTEXT, "",
254 "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
258 EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute,
261 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
262 EGLint attribute, EGLint *value);
264 BEFORE_EGL(eglQuerySurface);
265 /* call original function */
266 EGLBoolean ret = eglQuerySurfacep(dpy, surface, attribute, value);
270 AFTER('d', ret, APITYPE_CONTEXT, "",
271 "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
272 attribute, voidp_to_uint64(value));
276 EGLBoolean eglBindAPI(EGLenum api)
278 typedef EGLBoolean (*methodType)(EGLenum api);
280 BEFORE_EGL(eglBindAPI);
281 /* call original function */
282 EGLBoolean ret = eglBindAPIp(api);
286 AFTER('d', ret, APITYPE_CONTEXT, "",
291 EGLenum eglQueryAPI(void)
293 typedef EGLenum (*methodType)(void);
295 BEFORE_EGL(eglQueryAPI);
296 /* call original function */
297 EGLenum ret = eglQueryAPIp();
301 AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
305 EGLBoolean eglWaitClient(void)
307 typedef EGLBoolean (*methodType)(void);
309 BEFORE_EGL(eglWaitClient);
310 /* call original function */
311 EGLBoolean ret = eglWaitClientp();
315 AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
319 EGLBoolean eglReleaseThread(void)
321 typedef EGLBoolean (*methodType)(void);
323 BEFORE_EGL(eglReleaseThread);
324 /* call original function */
325 EGLBoolean ret = eglReleaseThreadp();
329 AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
333 EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
334 EGLClientBuffer buffer,
336 const EGLint *attrib_list)
338 typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLenum buftype,
339 EGLClientBuffer buffer,
341 const EGLint *attrib_list);
343 BEFORE_EGL(eglCreatePbufferFromClientBuffer);
344 /* call original function */
345 EGLSurface ret = eglCreatePbufferFromClientBufferp(dpy, buftype, buffer,
346 config, attrib_list);
350 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
351 "pdppp", voidp_to_uint64(dpy), buftype, voidp_to_uint64(buffer),
352 voidp_to_uint64(config), voidp_to_uint64(attrib_list));
356 EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
357 EGLint attribute, EGLint value)
359 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
360 EGLint attribute, EGLint value);
362 BEFORE_EGL(eglSurfaceAttrib);
363 /* call original function */
364 EGLBoolean ret = eglSurfaceAttribp(dpy, surface, attribute, value);
368 AFTER('d', ret, APITYPE_CONTEXT, "",
369 "ppdd", voidp_to_uint64(dpy), voidp_to_uint64(surface), attribute,
374 EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
376 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
379 BEFORE_EGL(eglBindTexImage);
380 /* call original function */
381 EGLBoolean ret = eglBindTexImagep(dpy, surface, buffer);
385 AFTER('d', ret, APITYPE_CONTEXT, "",
386 "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
390 EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
392 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
395 BEFORE_EGL(eglReleaseTexImage);
396 /* call original function */
397 EGLBoolean ret = eglReleaseTexImagep(dpy, surface, buffer);
401 AFTER('d', ret, APITYPE_CONTEXT, "",
402 "ppd", voidp_to_uint64(dpy), voidp_to_uint64(surface), buffer);
406 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
408 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLint interval);
410 BEFORE_EGL(eglSwapInterval);
411 /* call original function */
412 EGLBoolean ret = eglSwapIntervalp(dpy, interval);
416 AFTER('d', ret, APITYPE_CONTEXT, "",
417 "pd", voidp_to_uint64(dpy), interval);
421 EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
422 EGLContext share_context, const EGLint *attrib_list)
424 typedef EGLContext (*methodType)(EGLDisplay dpy, EGLConfig config,
425 EGLContext share_context,
426 const EGLint *attrib_list);
428 BEFORE_EGL(eglCreateContext);
429 /* call original function */
430 EGLContext ret = eglCreateContextp(dpy, config, share_context,
436 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
437 "pppp", voidp_to_uint64(dpy), voidp_to_uint64(config),
438 voidp_to_uint64(share_context), voidp_to_uint64(attrib_list));
442 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
444 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx);
446 BEFORE_EGL(eglDestroyContext);
447 /* call original function */
448 EGLBoolean ret = eglDestroyContextp(dpy, ctx);
453 AFTER('d', ret, APITYPE_CONTEXT, "",
454 "pp", voidp_to_uint64(dpy), voidp_to_uint64(ctx));
458 EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
461 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface draw,
462 EGLSurface read, EGLContext ctx);
464 BEFORE_EGL(eglMakeCurrent);
465 /* call original function */
466 EGLBoolean ret = eglMakeCurrentp(dpy, draw, read, ctx);
470 AFTER('d', ret, APITYPE_CONTEXT, "",
471 "pppp", voidp_to_uint64(dpy), voidp_to_uint64(draw),
472 voidp_to_uint64(read), voidp_to_uint64(ctx));
476 EGLContext eglGetCurrentContext(void)
478 typedef EGLContext (*methodType)(void);
480 BEFORE_EGL(eglGetCurrentContext);
481 /* call original function */
482 EGLContext ret = eglGetCurrentContextp();
487 AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
491 EGLSurface eglGetCurrentSurface(EGLint readdraw)
493 typedef EGLSurface (*methodType)(EGLint readdraw);
495 BEFORE_EGL(eglGetCurrentSurface);
496 /* call original function */
497 EGLSurface ret = eglGetCurrentSurfacep(readdraw);
501 AFTER('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "",
506 EGLDisplay eglGetCurrentDisplay(void)
508 typedef EGLDisplay (*methodType)(void);
510 BEFORE_EGL(eglGetCurrentDisplay);
511 /* call original function */
512 EGLDisplay ret = eglGetCurrentDisplayp();
516 AFTER_NO_PARAM('p', voidp_to_uint64(ret), APITYPE_CONTEXT, "");
520 EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute,
523 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLContext ctx,
524 EGLint attribute, EGLint *value);
526 BEFORE_EGL(eglQueryContext);
527 /* call original function */
528 EGLBoolean ret = eglQueryContextp(dpy, ctx, attribute, value);
532 AFTER('d', ret, APITYPE_CONTEXT, "",
533 "ppdp", voidp_to_uint64(dpy), voidp_to_uint64(ctx),
534 attribute, voidp_to_uint64(value));
538 EGLBoolean eglWaitGL(void)
540 typedef EGLBoolean (*methodType)(void);
542 BEFORE_EGL(eglWaitGL);
543 /* call original function */
544 EGLBoolean ret = eglWaitGLp();
548 AFTER_NO_PARAM('d', ret, APITYPE_CONTEXT, "");
552 EGLBoolean eglWaitNative(EGLint engine)
554 typedef EGLBoolean (*methodType)(EGLint engine);
556 BEFORE_EGL(eglWaitNative);
557 /* call original function */
558 EGLBoolean ret = eglWaitNativep(engine);
562 AFTER('d', ret, APITYPE_CONTEXT, "",
567 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
569 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface);
570 BEFORE_EGL(eglSwapBuffers);
571 EGLBoolean ret = eglSwapBuffersp(dpy, surface);
573 AFTER('d', ret, APITYPE_CONTEXT, "",
574 "pp", voidp_to_uint64(dpy), voidp_to_uint64(surface));
578 EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
579 EGLNativePixmapType target)
581 typedef EGLBoolean (*methodType)(EGLDisplay dpy, EGLSurface surface,
582 EGLNativePixmapType target);
584 BEFORE_EGL(eglCopyBuffers);
585 /* call original function */
586 EGLBoolean ret = eglCopyBuffersp(dpy, surface, target);
590 AFTER('d', ret, APITYPE_CONTEXT, "",
591 "ppp", voidp_to_uint64(dpy), voidp_to_uint64(surface),
592 voidp_to_uint64(target));
596 #define __eglGetProcAddress_t __eglMustCastToProperFunctionPointerType
597 EGLAPI __eglGetProcAddress_t eglGetProcAddress(const char *procname)
599 typedef EGLAPI __eglGetProcAddress_t(*methodType)(const char *procname);
601 BEFORE_EGL(eglGetProcAddress);
602 /* call original function */
603 __eglGetProcAddress_t ret = eglGetProcAddressp(procname);
607 AFTER('p', voidp_to_uint64((void *)ret), APITYPE_CONTEXT, "",