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