1 /*
2 ** Copyright 2018, The Android Open Source Project
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
18
19 #include <EGL/egl.h>
20 #include <EGL/eglext.h>
21
22 #include "../egl_impl.h"
23
24 #include "egl_layers.h"
25 #include "egl_platform_entries.h"
26 #include "egl_tls.h"
27 #include "egl_trace.h"
28
29 using namespace android;
30
31 namespace android {
32
33 extern EGLBoolean egl_init_drivers();
34
35 } // namespace android
36
clearError()37 static inline void clearError() {
38 egl_tls_t::clearError();
39 }
40
eglGetDisplay(EGLNativeDisplayType display)41 EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
42 ATRACE_CALL();
43
44 if (egl_init_drivers() == EGL_FALSE) {
45 return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
46 }
47
48 // Call down the chain, which usually points directly to the impl
49 // but may also be routed through layers
50 clearError();
51 egl_connection_t* const cnx = &gEGLImpl;
52 return cnx->platform.eglGetDisplay(display);
53 }
54
eglGetPlatformDisplay(EGLenum platform,EGLNativeDisplayType display,const EGLAttrib * attrib_list)55 EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display,
56 const EGLAttrib* attrib_list) {
57 ATRACE_CALL();
58
59 if (egl_init_drivers() == EGL_FALSE) {
60 return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
61 }
62
63 // Call down the chain, which usually points directly to the impl
64 // but may also be routed through layers
65 clearError();
66 egl_connection_t* const cnx = &gEGLImpl;
67 return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list);
68 }
69
eglInitialize(EGLDisplay dpy,EGLint * major,EGLint * minor)70 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
71 clearError();
72
73 egl_connection_t* const cnx = &gEGLImpl;
74 return cnx->platform.eglInitialize(dpy, major, minor);
75 }
76
eglTerminate(EGLDisplay dpy)77 EGLBoolean eglTerminate(EGLDisplay dpy) {
78 clearError();
79
80 egl_connection_t* const cnx = &gEGLImpl;
81 return cnx->platform.eglTerminate(dpy);
82 }
83
eglGetConfigs(EGLDisplay dpy,EGLConfig * configs,EGLint config_size,EGLint * num_config)84 EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size,
85 EGLint* num_config) {
86 clearError();
87
88 egl_connection_t* const cnx = &gEGLImpl;
89 return cnx->platform.eglGetConfigs(dpy, configs, config_size, num_config);
90 }
91
eglChooseConfig(EGLDisplay dpy,const EGLint * attrib_list,EGLConfig * configs,EGLint config_size,EGLint * num_config)92 EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs,
93 EGLint config_size, EGLint* num_config) {
94 clearError();
95
96 egl_connection_t* const cnx = &gEGLImpl;
97 return cnx->platform.eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
98 }
99
eglGetConfigAttrib(EGLDisplay dpy,EGLConfig config,EGLint attribute,EGLint * value)100 EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
101 clearError();
102
103 egl_connection_t* const cnx = &gEGLImpl;
104 return cnx->platform.eglGetConfigAttrib(dpy, config, attribute, value);
105 }
106
eglCreateWindowSurface(EGLDisplay dpy,EGLConfig config,NativeWindowType window,const EGLint * attrib_list)107 EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
108 const EGLint* attrib_list) {
109 clearError();
110
111 egl_connection_t* const cnx = &gEGLImpl;
112 return cnx->platform.eglCreateWindowSurface(dpy, config, window, attrib_list);
113 }
114
eglCreatePlatformWindowSurface(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLAttrib * attrib_list)115 EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
116 const EGLAttrib* attrib_list) {
117 clearError();
118
119 egl_connection_t* const cnx = &gEGLImpl;
120 return cnx->platform.eglCreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
121 }
122
eglCreatePixmapSurface(EGLDisplay dpy,EGLConfig config,NativePixmapType pixmap,const EGLint * attrib_list)123 EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap,
124 const EGLint* attrib_list) {
125 clearError();
126
127 egl_connection_t* const cnx = &gEGLImpl;
128 return cnx->platform.eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
129 }
130
eglCreatePlatformPixmapSurface(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLAttrib * attrib_list)131 EGLSurface eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
132 const EGLAttrib* attrib_list) {
133 clearError();
134
135 egl_connection_t* const cnx = &gEGLImpl;
136 return cnx->platform.eglCreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
137 }
138
eglCreatePbufferSurface(EGLDisplay dpy,EGLConfig config,const EGLint * attrib_list)139 EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
140 clearError();
141
142 egl_connection_t* const cnx = &gEGLImpl;
143 return cnx->platform.eglCreatePbufferSurface(dpy, config, attrib_list);
144 }
145
eglDestroySurface(EGLDisplay dpy,EGLSurface surface)146 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
147 clearError();
148
149 egl_connection_t* const cnx = &gEGLImpl;
150 return cnx->platform.eglDestroySurface(dpy, surface);
151 }
152
eglQuerySurface(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint * value)153 EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value) {
154 clearError();
155
156 egl_connection_t* const cnx = &gEGLImpl;
157 return cnx->platform.eglQuerySurface(dpy, surface, attribute, value);
158 }
159
eglBeginFrame(EGLDisplay dpy,EGLSurface surface)160 void EGLAPI eglBeginFrame(EGLDisplay dpy, EGLSurface surface) {
161 ATRACE_CALL();
162 clearError();
163
164 egl_connection_t* const cnx = &gEGLImpl;
165 cnx->platform.eglBeginFrame(dpy, surface);
166 }
167
eglCreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_list,const EGLint * attrib_list)168 EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
169 const EGLint* attrib_list) {
170 clearError();
171
172 egl_connection_t* const cnx = &gEGLImpl;
173 return cnx->platform.eglCreateContext(dpy, config, share_list, attrib_list);
174 }
175
eglDestroyContext(EGLDisplay dpy,EGLContext ctx)176 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
177 clearError();
178
179 egl_connection_t* const cnx = &gEGLImpl;
180 return cnx->platform.eglDestroyContext(dpy, ctx);
181 }
182
eglMakeCurrent(EGLDisplay dpy,EGLSurface draw,EGLSurface read,EGLContext ctx)183 EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
184 clearError();
185
186 egl_connection_t* const cnx = &gEGLImpl;
187 return cnx->platform.eglMakeCurrent(dpy, draw, read, ctx);
188 }
189
eglQueryContext(EGLDisplay dpy,EGLContext ctx,EGLint attribute,EGLint * value)190 EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
191 clearError();
192
193 egl_connection_t* const cnx = &gEGLImpl;
194 return cnx->platform.eglQueryContext(dpy, ctx, attribute, value);
195 }
196
eglGetCurrentContext(void)197 EGLContext eglGetCurrentContext(void) {
198 clearError();
199
200 egl_connection_t* const cnx = &gEGLImpl;
201 return cnx->platform.eglGetCurrentContext();
202 }
203
eglGetCurrentSurface(EGLint readdraw)204 EGLSurface eglGetCurrentSurface(EGLint readdraw) {
205 clearError();
206
207 egl_connection_t* const cnx = &gEGLImpl;
208 return cnx->platform.eglGetCurrentSurface(readdraw);
209 }
210
eglGetCurrentDisplay(void)211 EGLDisplay eglGetCurrentDisplay(void) {
212 clearError();
213
214 egl_connection_t* const cnx = &gEGLImpl;
215 return cnx->platform.eglGetCurrentDisplay();
216 }
217
eglWaitGL(void)218 EGLBoolean eglWaitGL(void) {
219 clearError();
220
221 egl_connection_t* const cnx = &gEGLImpl;
222 return cnx->platform.eglWaitGL();
223 }
224
eglWaitNative(EGLint engine)225 EGLBoolean eglWaitNative(EGLint engine) {
226 clearError();
227
228 egl_connection_t* const cnx = &gEGLImpl;
229 return cnx->platform.eglWaitNative(engine);
230 }
231
eglGetError(void)232 EGLint eglGetError(void) {
233 egl_connection_t* const cnx = &gEGLImpl;
234 return cnx->platform.eglGetError();
235 }
236
eglGetProcAddress(const char * procname)237 __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* procname) {
238 // eglGetProcAddress() could be the very first function called
239 // in which case we must make sure we've initialized ourselves, this
240 // happens the first time egl_get_display() is called.
241
242 if (egl_init_drivers() == EGL_FALSE) {
243 setError(EGL_BAD_PARAMETER, NULL);
244 return nullptr;
245 }
246
247 clearError();
248 egl_connection_t* const cnx = &gEGLImpl;
249 return cnx->platform.eglGetProcAddress(procname);
250 }
251
eglSwapBuffersWithDamageKHR(EGLDisplay dpy,EGLSurface draw,EGLint * rects,EGLint n_rects)252 EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, EGLint* rects,
253 EGLint n_rects) {
254 ATRACE_CALL();
255 clearError();
256
257 egl_connection_t* const cnx = &gEGLImpl;
258 return cnx->platform.eglSwapBuffersWithDamageKHR(dpy, draw, rects, n_rects);
259 }
260
eglSwapBuffers(EGLDisplay dpy,EGLSurface surface)261 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
262 ATRACE_CALL();
263 clearError();
264
265 egl_connection_t* const cnx = &gEGLImpl;
266 return cnx->platform.eglSwapBuffers(dpy, surface);
267 }
268
eglCopyBuffers(EGLDisplay dpy,EGLSurface surface,NativePixmapType target)269 EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target) {
270 clearError();
271
272 egl_connection_t* const cnx = &gEGLImpl;
273 return cnx->platform.eglCopyBuffers(dpy, surface, target);
274 }
275
eglQueryString(EGLDisplay dpy,EGLint name)276 const char* eglQueryString(EGLDisplay dpy, EGLint name) {
277 clearError();
278
279 egl_connection_t* const cnx = &gEGLImpl;
280 return cnx->platform.eglQueryString(dpy, name);
281 }
282
eglQueryStringImplementationANDROID(EGLDisplay dpy,EGLint name)283 extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name) {
284 clearError();
285
286 egl_connection_t* const cnx = &gEGLImpl;
287 return cnx->platform.eglQueryStringImplementationANDROID(dpy, name);
288 }
289
eglSurfaceAttrib(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint value)290 EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
291 clearError();
292
293 egl_connection_t* const cnx = &gEGLImpl;
294 return cnx->platform.eglSurfaceAttrib(dpy, surface, attribute, value);
295 }
296
eglBindTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)297 EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
298 clearError();
299
300 egl_connection_t* const cnx = &gEGLImpl;
301 return cnx->platform.eglBindTexImage(dpy, surface, buffer);
302 }
303
eglReleaseTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)304 EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
305 clearError();
306
307 egl_connection_t* const cnx = &gEGLImpl;
308 return cnx->platform.eglReleaseTexImage(dpy, surface, buffer);
309 }
310
eglSwapInterval(EGLDisplay dpy,EGLint interval)311 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
312 clearError();
313
314 egl_connection_t* const cnx = &gEGLImpl;
315 return cnx->platform.eglSwapInterval(dpy, interval);
316 }
317
eglWaitClient(void)318 EGLBoolean eglWaitClient(void) {
319 clearError();
320
321 egl_connection_t* const cnx = &gEGLImpl;
322 return cnx->platform.eglWaitClient();
323 }
324
eglBindAPI(EGLenum api)325 EGLBoolean eglBindAPI(EGLenum api) {
326 if (egl_init_drivers() == EGL_FALSE) {
327 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
328 }
329
330 clearError();
331 egl_connection_t* const cnx = &gEGLImpl;
332 return cnx->platform.eglBindAPI(api);
333 }
334
eglQueryAPI(void)335 EGLenum eglQueryAPI(void) {
336 if (egl_init_drivers() == EGL_FALSE) {
337 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
338 }
339
340 clearError();
341 egl_connection_t* const cnx = &gEGLImpl;
342 return cnx->platform.eglQueryAPI();
343 }
344
eglReleaseThread(void)345 EGLBoolean eglReleaseThread(void) {
346 clearError();
347
348 egl_connection_t* const cnx = &gEGLImpl;
349 return cnx->platform.eglReleaseThread();
350 }
351
eglCreatePbufferFromClientBuffer(EGLDisplay dpy,EGLenum buftype,EGLClientBuffer buffer,EGLConfig config,const EGLint * attrib_list)352 EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
353 EGLConfig config, const EGLint* attrib_list) {
354 clearError();
355
356 egl_connection_t* const cnx = &gEGLImpl;
357 return cnx->platform.eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config,
358 attrib_list);
359 }
360
eglLockSurfaceKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * attrib_list)361 EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface, const EGLint* attrib_list) {
362 clearError();
363
364 egl_connection_t* const cnx = &gEGLImpl;
365 return cnx->platform.eglLockSurfaceKHR(dpy, surface, attrib_list);
366 }
367
eglUnlockSurfaceKHR(EGLDisplay dpy,EGLSurface surface)368 EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface) {
369 clearError();
370
371 egl_connection_t* const cnx = &gEGLImpl;
372 return cnx->platform.eglUnlockSurfaceKHR(dpy, surface);
373 }
374
eglCreateImageKHR(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLint * attrib_list)375 EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
376 EGLClientBuffer buffer, const EGLint* attrib_list) {
377 clearError();
378
379 egl_connection_t* const cnx = &gEGLImpl;
380 return cnx->platform.eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
381 }
382
eglCreateImage(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLAttrib * attrib_list)383 EGLImage eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
384 const EGLAttrib* attrib_list) {
385 clearError();
386
387 egl_connection_t* const cnx = &gEGLImpl;
388 return cnx->platform.eglCreateImage(dpy, ctx, target, buffer, attrib_list);
389 }
390
eglDestroyImageKHR(EGLDisplay dpy,EGLImageKHR img)391 EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) {
392 clearError();
393
394 egl_connection_t* const cnx = &gEGLImpl;
395 return cnx->platform.eglDestroyImageKHR(dpy, img);
396 }
397
eglDestroyImage(EGLDisplay dpy,EGLImageKHR img)398 EGLBoolean eglDestroyImage(EGLDisplay dpy, EGLImageKHR img) {
399 clearError();
400
401 egl_connection_t* const cnx = &gEGLImpl;
402 return cnx->platform.eglDestroyImage(dpy, img);
403 }
404
405 // ----------------------------------------------------------------------------
406 // EGL_EGLEXT_VERSION 5
407 // ----------------------------------------------------------------------------
408
eglCreateSync(EGLDisplay dpy,EGLenum type,const EGLAttrib * attrib_list)409 EGLSyncKHR eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
410 clearError();
411
412 egl_connection_t* const cnx = &gEGLImpl;
413 return cnx->platform.eglCreateSync(dpy, type, attrib_list);
414 }
415
eglCreateSyncKHR(EGLDisplay dpy,EGLenum type,const EGLint * attrib_list)416 EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) {
417 clearError();
418
419 egl_connection_t* const cnx = &gEGLImpl;
420 return cnx->platform.eglCreateSyncKHR(dpy, type, attrib_list);
421 }
422
eglDestroySync(EGLDisplay dpy,EGLSyncKHR sync)423 EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync) {
424 clearError();
425
426 egl_connection_t* const cnx = &gEGLImpl;
427 return cnx->platform.eglDestroySync(dpy, sync);
428 }
429
eglDestroySyncKHR(EGLDisplay dpy,EGLSyncKHR sync)430 EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) {
431 clearError();
432
433 egl_connection_t* const cnx = &gEGLImpl;
434 return cnx->platform.eglDestroySyncKHR(dpy, sync);
435 }
436
eglSignalSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLenum mode)437 EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) {
438 clearError();
439
440 egl_connection_t* const cnx = &gEGLImpl;
441 return cnx->platform.eglSignalSyncKHR(dpy, sync, mode);
442 }
443
eglClientWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags,EGLTimeKHR timeout)444 EGLint eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTimeKHR timeout) {
445 clearError();
446
447 egl_connection_t* const cnx = &gEGLImpl;
448 return cnx->platform.eglClientWaitSyncKHR(dpy, sync, flags, timeout);
449 }
450
eglClientWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags,EGLTimeKHR timeout)451 EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) {
452 clearError();
453
454 egl_connection_t* const cnx = &gEGLImpl;
455 return cnx->platform.eglClientWaitSyncKHR(dpy, sync, flags, timeout);
456 }
457
eglGetSyncAttrib(EGLDisplay dpy,EGLSync sync,EGLint attribute,EGLAttrib * value)458 EGLBoolean eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
459 clearError();
460
461 egl_connection_t* const cnx = &gEGLImpl;
462 return cnx->platform.eglGetSyncAttrib(dpy, sync, attribute, value);
463 }
464
eglGetSyncAttribKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint attribute,EGLint * value)465 EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint* value) {
466 clearError();
467
468 egl_connection_t* const cnx = &gEGLImpl;
469 return cnx->platform.eglGetSyncAttribKHR(dpy, sync, attribute, value);
470 }
471
eglCreateStreamKHR(EGLDisplay dpy,const EGLint * attrib_list)472 EGLStreamKHR eglCreateStreamKHR(EGLDisplay dpy, const EGLint* attrib_list) {
473 clearError();
474
475 egl_connection_t* const cnx = &gEGLImpl;
476 return cnx->platform.eglCreateStreamKHR(dpy, attrib_list);
477 }
478
eglDestroyStreamKHR(EGLDisplay dpy,EGLStreamKHR stream)479 EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) {
480 clearError();
481
482 egl_connection_t* const cnx = &gEGLImpl;
483 return cnx->platform.eglDestroyStreamKHR(dpy, stream);
484 }
485
eglStreamAttribKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint value)486 EGLBoolean eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
487 EGLint value) {
488 clearError();
489
490 egl_connection_t* const cnx = &gEGLImpl;
491 return cnx->platform.eglStreamAttribKHR(dpy, stream, attribute, value);
492 }
493
eglQueryStreamKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint * value)494 EGLBoolean eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
495 EGLint* value) {
496 clearError();
497
498 egl_connection_t* const cnx = &gEGLImpl;
499 return cnx->platform.eglQueryStreamKHR(dpy, stream, attribute, value);
500 }
501
eglQueryStreamu64KHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLuint64KHR * value)502 EGLBoolean eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
503 EGLuint64KHR* value) {
504 clearError();
505
506 egl_connection_t* const cnx = &gEGLImpl;
507 return cnx->platform.eglQueryStreamu64KHR(dpy, stream, attribute, value);
508 }
509
eglQueryStreamTimeKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLTimeKHR * value)510 EGLBoolean eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
511 EGLTimeKHR* value) {
512 clearError();
513
514 egl_connection_t* const cnx = &gEGLImpl;
515 return cnx->platform.eglQueryStreamTimeKHR(dpy, stream, attribute, value);
516 }
517
eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy,EGLConfig config,EGLStreamKHR stream,const EGLint * attrib_list)518 EGLSurface eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream,
519 const EGLint* attrib_list) {
520 clearError();
521
522 egl_connection_t* const cnx = &gEGLImpl;
523 return cnx->platform.eglCreateStreamProducerSurfaceKHR(dpy, config, stream, attrib_list);
524 }
525
eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy,EGLStreamKHR stream)526 EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream) {
527 clearError();
528
529 egl_connection_t* const cnx = &gEGLImpl;
530 return cnx->platform.eglStreamConsumerGLTextureExternalKHR(dpy, stream);
531 }
532
eglStreamConsumerAcquireKHR(EGLDisplay dpy,EGLStreamKHR stream)533 EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream) {
534 clearError();
535
536 egl_connection_t* const cnx = &gEGLImpl;
537 return cnx->platform.eglStreamConsumerAcquireKHR(dpy, stream);
538 }
539
eglStreamConsumerReleaseKHR(EGLDisplay dpy,EGLStreamKHR stream)540 EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream) {
541 clearError();
542
543 egl_connection_t* const cnx = &gEGLImpl;
544 return cnx->platform.eglStreamConsumerReleaseKHR(dpy, stream);
545 }
546
eglGetStreamFileDescriptorKHR(EGLDisplay dpy,EGLStreamKHR stream)547 EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream) {
548 clearError();
549
550 egl_connection_t* const cnx = &gEGLImpl;
551 return cnx->platform.eglGetStreamFileDescriptorKHR(dpy, stream);
552 }
553
eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy,EGLNativeFileDescriptorKHR file_descriptor)554 EGLStreamKHR eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy,
555 EGLNativeFileDescriptorKHR file_descriptor) {
556 clearError();
557
558 egl_connection_t* const cnx = &gEGLImpl;
559 return cnx->platform.eglCreateStreamFromFileDescriptorKHR(dpy, file_descriptor);
560 }
561
eglWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags)562 EGLint eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) {
563 clearError();
564 egl_connection_t* const cnx = &gEGLImpl;
565 return cnx->platform.eglWaitSyncKHR(dpy, sync, flags);
566 }
567
eglWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags)568 EGLBoolean eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
569 clearError();
570 egl_connection_t* const cnx = &gEGLImpl;
571 return cnx->platform.eglWaitSync(dpy, sync, flags);
572 }
573
eglDupNativeFenceFDANDROID(EGLDisplay dpy,EGLSyncKHR sync)574 EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync) {
575 clearError();
576
577 egl_connection_t* const cnx = &gEGLImpl;
578 return cnx->platform.eglDupNativeFenceFDANDROID(dpy, sync);
579 }
580
eglPresentationTimeANDROID(EGLDisplay dpy,EGLSurface surface,EGLnsecsANDROID time)581 EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time) {
582 clearError();
583
584 egl_connection_t* const cnx = &gEGLImpl;
585 return cnx->platform.eglPresentationTimeANDROID(dpy, surface, time);
586 }
587
eglGetNativeClientBufferANDROID(const AHardwareBuffer * buffer)588 EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer* buffer) {
589 clearError();
590 egl_connection_t* const cnx = &gEGLImpl;
591 return cnx->platform.eglGetNativeClientBufferANDROID(buffer);
592 }
593
eglGetSystemTimeFrequencyNV()594 EGLuint64NV eglGetSystemTimeFrequencyNV() {
595 if (egl_init_drivers() == EGL_FALSE) {
596 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
597 }
598
599 clearError();
600 egl_connection_t* const cnx = &gEGLImpl;
601 return cnx->platform.eglGetSystemTimeFrequencyNV();
602 }
603
eglGetSystemTimeNV()604 EGLuint64NV eglGetSystemTimeNV() {
605 if (egl_init_drivers() == EGL_FALSE) {
606 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
607 }
608
609 clearError();
610 egl_connection_t* const cnx = &gEGLImpl;
611 return cnx->platform.eglGetSystemTimeNV();
612 }
613
eglSetDamageRegionKHR(EGLDisplay dpy,EGLSurface surface,EGLint * rects,EGLint n_rects)614 EGLBoolean eglSetDamageRegionKHR(EGLDisplay dpy, EGLSurface surface, EGLint* rects,
615 EGLint n_rects) {
616 clearError();
617
618 egl_connection_t* const cnx = &gEGLImpl;
619 return cnx->platform.eglSetDamageRegionKHR(dpy, surface, rects, n_rects);
620 }
621
eglGetNextFrameIdANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * frameId)622 EGLBoolean eglGetNextFrameIdANDROID(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId) {
623 clearError();
624
625 egl_connection_t* const cnx = &gEGLImpl;
626 return cnx->platform.eglGetNextFrameIdANDROID(dpy, surface, frameId);
627 }
628
eglGetCompositorTimingANDROID(EGLDisplay dpy,EGLSurface surface,EGLint numTimestamps,const EGLint * names,EGLnsecsANDROID * values)629 EGLBoolean eglGetCompositorTimingANDROID(EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps,
630 const EGLint* names, EGLnsecsANDROID* values) {
631 clearError();
632
633 egl_connection_t* const cnx = &gEGLImpl;
634 return cnx->platform.eglGetCompositorTimingANDROID(dpy, surface, numTimestamps, names, values);
635 }
636
eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint name)637 EGLBoolean eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy, EGLSurface surface, EGLint name) {
638 clearError();
639
640 egl_connection_t* const cnx = &gEGLImpl;
641 return cnx->platform.eglGetCompositorTimingSupportedANDROID(dpy, surface, name);
642 }
643
eglGetFrameTimestampsANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR frameId,EGLint numTimestamps,const EGLint * timestamps,EGLnsecsANDROID * values)644 EGLBoolean eglGetFrameTimestampsANDROID(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId,
645 EGLint numTimestamps, const EGLint* timestamps,
646 EGLnsecsANDROID* values) {
647 clearError();
648
649 egl_connection_t* const cnx = &gEGLImpl;
650 return cnx->platform.eglGetFrameTimestampsANDROID(dpy, surface, frameId, numTimestamps,
651 timestamps, values);
652 }
653
eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint timestamp)654 EGLBoolean eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy, EGLSurface surface,
655 EGLint timestamp) {
656 clearError();
657
658 egl_connection_t* const cnx = &gEGLImpl;
659 return cnx->platform.eglGetFrameTimestampSupportedANDROID(dpy, surface, timestamp);
660 }
661