blob: c51a1295e70cf3ae060828b1c2504c330d54e608 [file] [log] [blame]
Cody Northrop68d10352018-10-15 07:22:09 -06001/*
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
29using namespace android;
30
31namespace android {
32
33extern EGLBoolean egl_init_drivers();
34
35} // namespace android
36
37static inline void clearError() {
38 egl_tls_t::clearError();
39}
40
41EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
42 ATRACE_CALL();
Cody Northrop68d10352018-10-15 07:22:09 -060043
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
Yiwei Zhang86f9f742019-08-27 00:27:29 -070050 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -060051 egl_connection_t* const cnx = &gEGLImpl;
52 return cnx->platform.eglGetDisplay(display);
53}
54
Courtney Goeltzenleuchter4adf75b2018-10-11 13:09:40 -060055EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display,
56 const EGLAttrib* attrib_list) {
57 ATRACE_CALL();
Courtney Goeltzenleuchter4adf75b2018-10-11 13:09:40 -060058
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
Yiwei Zhang86f9f742019-08-27 00:27:29 -070065 clearError();
Courtney Goeltzenleuchter4adf75b2018-10-11 13:09:40 -060066 egl_connection_t* const cnx = &gEGLImpl;
67 return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list);
68}
69
Cody Northrop68d10352018-10-15 07:22:09 -060070EGLBoolean 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
77EGLBoolean eglTerminate(EGLDisplay dpy) {
78 clearError();
79
80 egl_connection_t* const cnx = &gEGLImpl;
81 return cnx->platform.eglTerminate(dpy);
82}
83
84EGLBoolean 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
92EGLBoolean 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
100EGLBoolean 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
107EGLSurface 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
Courtney Goeltzenleuchter69476e52018-10-11 12:59:34 -0600115EGLSurface 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
Cody Northrop68d10352018-10-15 07:22:09 -0600123EGLSurface 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
Courtney Goeltzenleuchter69476e52018-10-11 12:59:34 -0600131EGLSurface 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
Cody Northrop68d10352018-10-15 07:22:09 -0600139EGLSurface 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
146EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
147 clearError();
148
149 egl_connection_t* const cnx = &gEGLImpl;
150 return cnx->platform.eglDestroySurface(dpy, surface);
151}
152
153EGLBoolean 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
160void 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
168EGLContext 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
176EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
177 clearError();
178
179 egl_connection_t* const cnx = &gEGLImpl;
180 return cnx->platform.eglDestroyContext(dpy, ctx);
181}
182
183EGLBoolean 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
190EGLBoolean 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
197EGLContext eglGetCurrentContext(void) {
198 clearError();
199
200 egl_connection_t* const cnx = &gEGLImpl;
201 return cnx->platform.eglGetCurrentContext();
202}
203
204EGLSurface eglGetCurrentSurface(EGLint readdraw) {
205 clearError();
206
207 egl_connection_t* const cnx = &gEGLImpl;
208 return cnx->platform.eglGetCurrentSurface(readdraw);
209}
210
211EGLDisplay eglGetCurrentDisplay(void) {
212 clearError();
213
214 egl_connection_t* const cnx = &gEGLImpl;
215 return cnx->platform.eglGetCurrentDisplay();
216}
217
218EGLBoolean eglWaitGL(void) {
219 clearError();
220
221 egl_connection_t* const cnx = &gEGLImpl;
222 return cnx->platform.eglWaitGL();
223}
224
225EGLBoolean eglWaitNative(EGLint engine) {
226 clearError();
227
228 egl_connection_t* const cnx = &gEGLImpl;
229 return cnx->platform.eglWaitNative(engine);
230}
231
232EGLint eglGetError(void) {
233 egl_connection_t* const cnx = &gEGLImpl;
Cody Northrop9a9a1f42018-10-15 18:32:41 -0600234 return cnx->platform.eglGetError();
Cody Northrop68d10352018-10-15 07:22:09 -0600235}
236
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
Cody Northrop68d10352018-10-15 07:22:09 -0600242 if (egl_init_drivers() == EGL_FALSE) {
243 setError(EGL_BAD_PARAMETER, NULL);
244 return nullptr;
245 }
246
Yiwei Zhang86f9f742019-08-27 00:27:29 -0700247 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -0600248 egl_connection_t* const cnx = &gEGLImpl;
249 return cnx->platform.eglGetProcAddress(procname);
250}
251
252EGLBoolean 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
261EGLBoolean 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
269EGLBoolean 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
276const 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
283extern "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
290EGLBoolean 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
297EGLBoolean 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
304EGLBoolean 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
311EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
312 clearError();
313
314 egl_connection_t* const cnx = &gEGLImpl;
315 return cnx->platform.eglSwapInterval(dpy, interval);
316}
317
318EGLBoolean eglWaitClient(void) {
319 clearError();
320
321 egl_connection_t* const cnx = &gEGLImpl;
322 return cnx->platform.eglWaitClient();
323}
324
325EGLBoolean eglBindAPI(EGLenum api) {
Cody Northrop68d10352018-10-15 07:22:09 -0600326 if (egl_init_drivers() == EGL_FALSE) {
327 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
328 }
329
Yiwei Zhang86f9f742019-08-27 00:27:29 -0700330 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -0600331 egl_connection_t* const cnx = &gEGLImpl;
332 return cnx->platform.eglBindAPI(api);
333}
334
335EGLenum eglQueryAPI(void) {
Cody Northrop68d10352018-10-15 07:22:09 -0600336 if (egl_init_drivers() == EGL_FALSE) {
337 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
338 }
339
Yiwei Zhang86f9f742019-08-27 00:27:29 -0700340 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -0600341 egl_connection_t* const cnx = &gEGLImpl;
342 return cnx->platform.eglQueryAPI();
343}
344
345EGLBoolean eglReleaseThread(void) {
346 clearError();
347
348 egl_connection_t* const cnx = &gEGLImpl;
349 return cnx->platform.eglReleaseThread();
350}
351
352EGLSurface 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
361EGLBoolean 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
368EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface) {
369 clearError();
370
371 egl_connection_t* const cnx = &gEGLImpl;
372 return cnx->platform.eglUnlockSurfaceKHR(dpy, surface);
373}
374
375EGLImageKHR 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
Courtney Goeltzenleuchtere498a2d2018-07-19 17:11:04 -0600383EGLImage 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
Cody Northrop68d10352018-10-15 07:22:09 -0600391EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) {
392 clearError();
393
394 egl_connection_t* const cnx = &gEGLImpl;
395 return cnx->platform.eglDestroyImageKHR(dpy, img);
396}
397
Courtney Goeltzenleuchtere498a2d2018-07-19 17:11:04 -0600398EGLBoolean 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
Courtney Goeltzenleuchter40627ba2018-07-31 10:27:40 -0600409EGLSyncKHR 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
Cody Northrop68d10352018-10-15 07:22:09 -0600416EGLSyncKHR 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
Courtney Goeltzenleuchter40627ba2018-07-31 10:27:40 -0600423EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync) {
424 clearError();
425
426 egl_connection_t* const cnx = &gEGLImpl;
427 return cnx->platform.eglDestroySync(dpy, sync);
428}
429
Cody Northrop68d10352018-10-15 07:22:09 -0600430EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) {
431 clearError();
432
433 egl_connection_t* const cnx = &gEGLImpl;
434 return cnx->platform.eglDestroySyncKHR(dpy, sync);
435}
436
437EGLBoolean 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
Courtney Goeltzenleuchter40627ba2018-07-31 10:27:40 -0600444EGLint 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
Cody Northrop68d10352018-10-15 07:22:09 -0600451EGLint 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
Courtney Goeltzenleuchter40627ba2018-07-31 10:27:40 -0600458EGLBoolean 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
Cody Northrop68d10352018-10-15 07:22:09 -0600465EGLBoolean 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
472EGLStreamKHR 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
479EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) {
480 clearError();
481
482 egl_connection_t* const cnx = &gEGLImpl;
483 return cnx->platform.eglDestroyStreamKHR(dpy, stream);
484}
485
486EGLBoolean 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
494EGLBoolean 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
502EGLBoolean 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
510EGLBoolean 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
518EGLSurface 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
526EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream) {
527 clearError();
528
529 egl_connection_t* const cnx = &gEGLImpl;
530 return cnx->platform.eglStreamConsumerGLTextureExternalKHR(dpy, stream);
531}
532
533EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream) {
534 clearError();
535
536 egl_connection_t* const cnx = &gEGLImpl;
537 return cnx->platform.eglStreamConsumerAcquireKHR(dpy, stream);
538}
539
540EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream) {
541 clearError();
542
543 egl_connection_t* const cnx = &gEGLImpl;
544 return cnx->platform.eglStreamConsumerReleaseKHR(dpy, stream);
545}
546
547EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream) {
548 clearError();
549
550 egl_connection_t* const cnx = &gEGLImpl;
551 return cnx->platform.eglGetStreamFileDescriptorKHR(dpy, stream);
552}
553
554EGLStreamKHR 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
562EGLint 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
Courtney Goeltzenleuchter40627ba2018-07-31 10:27:40 -0600568EGLBoolean 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
Cody Northrop68d10352018-10-15 07:22:09 -0600574EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync) {
575 clearError();
576
577 egl_connection_t* const cnx = &gEGLImpl;
578 return cnx->platform.eglDupNativeFenceFDANDROID(dpy, sync);
579}
580
581EGLBoolean 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
588EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer* buffer) {
589 clearError();
590 egl_connection_t* const cnx = &gEGLImpl;
591 return cnx->platform.eglGetNativeClientBufferANDROID(buffer);
592}
593
594EGLuint64NV eglGetSystemTimeFrequencyNV() {
Cody Northrop68d10352018-10-15 07:22:09 -0600595 if (egl_init_drivers() == EGL_FALSE) {
596 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
597 }
598
Yiwei Zhang86f9f742019-08-27 00:27:29 -0700599 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -0600600 egl_connection_t* const cnx = &gEGLImpl;
601 return cnx->platform.eglGetSystemTimeFrequencyNV();
602}
603
604EGLuint64NV eglGetSystemTimeNV() {
Cody Northrop68d10352018-10-15 07:22:09 -0600605 if (egl_init_drivers() == EGL_FALSE) {
606 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
607 }
608
Yiwei Zhang86f9f742019-08-27 00:27:29 -0700609 clearError();
Cody Northrop68d10352018-10-15 07:22:09 -0600610 egl_connection_t* const cnx = &gEGLImpl;
611 return cnx->platform.eglGetSystemTimeNV();
612}
613
614EGLBoolean 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
622EGLBoolean 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
629EGLBoolean 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
637EGLBoolean 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
644EGLBoolean 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
654EGLBoolean 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}