[FEATURE] add evas_gl_ probes
[platform/core/system/swap-probe.git] / probe_graphics / da_evas_gl.c
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Vitaliy Cherepanov <v.cherepanov@samsung.com>
9  *
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)
13  * any later version.
14  *
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.
19  *
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
23  *
24  * Contributors:
25  * - Samsung RnD Institute Russia
26  *
27  */
28
29 #include "da_gles20.h"
30 #include "daprobe.h"
31 #include "binproto.h"
32 #include "common_probe_init.h"
33
34 static enum DaOptions _sopt = OPT_GLES;
35
36 /* Evas open gl API functions */
37
38 void evas_gl_free(Evas_GL *evas_gl)
39 {
40         typedef void (*methodType)(Evas_GL *evas_gl);
41         BEFORE_EVAS_GL(evas_gl_free);
42         evas_gl_freep(evas_gl);
43         GL_GET_ERROR();
44         AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "p",
45               evas_gl);
46 }
47
48 void evas_gl_config_free(Evas_GL_Config *cfg)
49 {
50         typedef void (*methodType)(Evas_GL_Config *cfg);
51         BEFORE_EVAS_GL(evas_gl_config_free);
52         evas_gl_config_freep(cfg);
53         GL_GET_ERROR();
54         AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "p",
55               cfg);
56 }
57
58 void evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf)
59 {
60         typedef void (*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf);
61         BEFORE_EVAS_GL(evas_gl_surface_destroy);
62         evas_gl_surface_destroyp(evas_gl, surf);
63         GL_GET_ERROR();
64         AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "pp",
65               evas_gl, surf);
66 }
67
68 void evas_gl_context_destroy(Evas_GL *evas_gl, Evas_GL_Context *ctx)
69 {
70         typedef void (*methodType)(Evas_GL *evas_gl, Evas_GL_Context *ctx);
71         BEFORE_EVAS_GL(evas_gl_context_destroy);
72         evas_gl_context_destroyp(evas_gl, ctx);
73         GL_GET_ERROR();
74         AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "pp",
75               evas_gl, ctx);
76 }
77
78
79 Evas_GL *evas_gl_new(Evas *e)
80 {
81         typedef Evas_GL *(*methodType)(Evas *e);
82         BEFORE_EVAS_GL(evas_gl_new);
83         Evas_GL *res = evas_gl_newp(e);
84         GL_GET_ERROR();
85         AFTER('p', res, APITYPE_CONTEXT, "", "p",
86               e);
87         return res;
88 }
89
90 Evas_GL_Config *evas_gl_config_new(void)
91 {
92         typedef Evas_GL_Config *(*methodType)(void);
93         BEFORE_EVAS_GL(evas_gl_config_new);
94         Evas_GL_Config *res = evas_gl_config_newp();
95         GL_GET_ERROR();
96         AFTER_NO_PARAM('p', res, APITYPE_CONTEXT, "");
97         return res;
98 }
99
100 Evas_GL_Surface *evas_gl_surface_create(Evas_GL *evas_gl, Evas_GL_Config *cfg,
101                                         int w, int h)
102 {
103         typedef Evas_GL_Surface *(*methodType)(Evas_GL *evas_gl,
104                                                Evas_GL_Config *cfg,
105                                                int w, int h);
106         BEFORE_EVAS_GL(evas_gl_surface_create);
107         Evas_GL_Surface *res = evas_gl_surface_createp(evas_gl, cfg, w, h);
108         GL_GET_ERROR();
109         AFTER('p', res, APITYPE_CONTEXT, "", "ppdd",
110               evas_gl, cfg, w, h);
111         return res;
112 }
113
114 Evas_GL_Context *evas_gl_context_create(Evas_GL *evas_gl,
115                                         Evas_GL_Context *share_ctx)
116 {
117         typedef Evas_GL_Context *(*methodType)(Evas_GL *evas_gl, Evas_GL_Context *share_ctx);
118         BEFORE_EVAS_GL(evas_gl_context_create);
119         Evas_GL_Context *res = evas_gl_context_createp(evas_gl, share_ctx);
120         GL_GET_ERROR();
121         AFTER('p', res, APITYPE_CONTEXT, "", "pp",
122               evas_gl, share_ctx);
123         return res;
124 }
125
126 Eina_Bool evas_gl_make_current(Evas_GL *evas_gl, Evas_GL_Surface *surf,
127                                Evas_GL_Context *ctx)
128 {
129         typedef Eina_Bool (*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf,
130                                         Evas_GL_Context *ctx);
131         BEFORE_EVAS_GL(evas_gl_make_current);
132         Eina_Bool res = evas_gl_make_currentp(evas_gl, surf, ctx);
133         GL_GET_ERROR();
134         AFTER('b', res, APITYPE_CONTEXT, "", "ppp",
135               evas_gl, surf, ctx);
136         return res;
137 }
138
139 const char *evas_gl_string_query(Evas_GL *evas_gl, int name)
140 {
141         typedef const char *(*methodType)(Evas_GL *evas_gl, int name);
142         BEFORE_EVAS_GL(evas_gl_string_query);
143         const char *res = evas_gl_string_queryp(evas_gl, name);
144         GL_GET_ERROR();
145         AFTER('s', res, APITYPE_CONTEXT, "", "pd",
146               evas_gl, name);
147         return res;
148 }
149
150 Evas_GL_Func evas_gl_proc_address_get(Evas_GL *evas_gl, const char *name)
151 {
152         typedef Evas_GL_Func(*methodType)(Evas_GL *evas_gl, const char *name);
153         BEFORE_EVAS_GL(evas_gl_proc_address_get);
154         Evas_GL_Func res = evas_gl_proc_address_getp(evas_gl, name);
155         GL_GET_ERROR();
156         AFTER('p', res, APITYPE_CONTEXT, "", "ps",
157               evas_gl, name);
158         return res;
159 }
160
161 Eina_Bool evas_gl_native_surface_get(Evas_GL *evas_gl, Evas_GL_Surface *surf,
162                                      Evas_Native_Surface *ns)
163 {
164         typedef Eina_Bool(*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf,
165                                    Evas_Native_Surface *ns);
166         BEFORE_EVAS_GL(evas_gl_native_surface_get);
167         Eina_Bool res = evas_gl_native_surface_getp(evas_gl, surf, ns);
168         GL_GET_ERROR();
169         AFTER('b', res, APITYPE_CONTEXT, "", "ppp",
170               evas_gl, surf, ns);
171         return res;
172 }
173
174 Evas_GL_API *evas_gl_api_get(Evas_GL *evas_gl)
175 {
176         typedef Evas_GL_API *(*methodType)(Evas_GL *evas_gl);
177         BEFORE_EVAS_GL(evas_gl_api_get);
178         Evas_GL_API *res = evas_gl_api_getp(evas_gl);
179
180         GL_GET_ERROR();
181         AFTER('p', res, APITYPE_CONTEXT, "", "p",
182               evas_gl);
183         return res;
184 }
185