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 #include "egl_layers.h"
24 #include "egl_platform_entries.h"
25 #include "egl_tls.h"
26 #include "egl_trace.h"
27
28 using namespace android;
29
30 namespace android {
31
32 extern EGLBoolean egl_init_drivers();
33
34 } // namespace android
35
clearError()36 static inline void clearError() {
37 egl_tls_t::clearError();
38 }
39
eglGetDisplay(EGLNativeDisplayType display)40 EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
41 ATRACE_CALL();
42
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
49 clearError();
50 egl_connection_t* const cnx = &gEGLImpl;
51 return cnx->platform.eglGetDisplay(display);
52 }
53
eglGetPlatformDisplay(EGLenum platform,EGLNativeDisplayType display,const EGLAttrib * attrib_list)54 EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display,
55 const EGLAttrib* attrib_list) {
56 ATRACE_CALL();
57
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
64 clearError();
65 egl_connection_t* const cnx = &gEGLImpl;
66 return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list);
67 }
68
eglInitialize(EGLDisplay dpy,EGLint * major,EGLint * minor)69 EGLBoolean 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
eglTerminate(EGLDisplay dpy)76 EGLBoolean eglTerminate(EGLDisplay dpy) {
77 clearError();
78
79 egl_connection_t* const cnx = &gEGLImpl;
80 return cnx->platform.eglTerminate(dpy);
81 }
82
eglGetConfigs(EGLDisplay dpy,EGLConfig * configs,EGLint config_size,EGLint * num_config)83 EGLBoolean 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
eglChooseConfig(EGLDisplay dpy,const EGLint * attrib_list,EGLConfig * configs,EGLint config_size,EGLint * num_config)91 EGLBoolean 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
eglGetConfigAttrib(EGLDisplay dpy,EGLConfig config,EGLint attribute,EGLint * value)99 EGLBoolean 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
eglCreateWindowSurface(EGLDisplay dpy,EGLConfig config,NativeWindowType window,const EGLint * attrib_list)106 EGLSurface 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
eglCreatePlatformWindowSurface(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLAttrib * attrib_list)114 EGLSurface 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
eglCreatePixmapSurface(EGLDisplay dpy,EGLConfig config,NativePixmapType pixmap,const EGLint * attrib_list)122 EGLSurface 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
eglCreatePlatformPixmapSurface(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLAttrib * attrib_list)130 EGLSurface 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
eglCreatePbufferSurface(EGLDisplay dpy,EGLConfig config,const EGLint * attrib_list)138 EGLSurface 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
eglDestroySurface(EGLDisplay dpy,EGLSurface surface)145 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
146 clearError();
147
148 egl_connection_t* const cnx = &gEGLImpl;
149 return cnx->platform.eglDestroySurface(dpy, surface);
150 }
151
eglQuerySurface(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint * value)152 EGLBoolean 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
eglBeginFrame(EGLDisplay dpy,EGLSurface surface)159 void 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
eglCreateContext(EGLDisplay dpy,EGLConfig config,EGLContext share_list,const EGLint * attrib_list)167 EGLContext 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
eglDestroyContext(EGLDisplay dpy,EGLContext ctx)175 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
176 clearError();
177
178 egl_connection_t* const cnx = &gEGLImpl;
179 return cnx->platform.eglDestroyContext(dpy, ctx);
180 }
181
eglMakeCurrent(EGLDisplay dpy,EGLSurface draw,EGLSurface read,EGLContext ctx)182 EGLBoolean 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
eglQueryContext(EGLDisplay dpy,EGLContext ctx,EGLint attribute,EGLint * value)189 EGLBoolean 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
eglGetCurrentContext(void)196 EGLContext eglGetCurrentContext(void) {
197 clearError();
198
199 egl_connection_t* const cnx = &gEGLImpl;
200 return cnx->platform.eglGetCurrentContext();
201 }
202
eglGetCurrentSurface(EGLint readdraw)203 EGLSurface eglGetCurrentSurface(EGLint readdraw) {
204 clearError();
205
206 egl_connection_t* const cnx = &gEGLImpl;
207 return cnx->platform.eglGetCurrentSurface(readdraw);
208 }
209
eglGetCurrentDisplay(void)210 EGLDisplay eglGetCurrentDisplay(void) {
211 clearError();
212
213 egl_connection_t* const cnx = &gEGLImpl;
214 return cnx->platform.eglGetCurrentDisplay();
215 }
216
eglWaitGL(void)217 EGLBoolean eglWaitGL(void) {
218 clearError();
219
220 egl_connection_t* const cnx = &gEGLImpl;
221 return cnx->platform.eglWaitGL();
222 }
223
eglWaitNative(EGLint engine)224 EGLBoolean eglWaitNative(EGLint engine) {
225 clearError();
226
227 egl_connection_t* const cnx = &gEGLImpl;
228 return cnx->platform.eglWaitNative(engine);
229 }
230
eglGetError(void)231 EGLint eglGetError(void) {
232 egl_connection_t* const cnx = &gEGLImpl;
233 return cnx->platform.eglGetError();
234 }
235
eglGetProcAddress(const char * procname)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
241 if (egl_init_drivers() == EGL_FALSE) {
242 setError(EGL_BAD_PARAMETER, NULL);
243 return nullptr;
244 }
245
246 clearError();
247 egl_connection_t* const cnx = &gEGLImpl;
248 return cnx->platform.eglGetProcAddress(procname);
249 }
250
eglSwapBuffersWithDamageKHR(EGLDisplay dpy,EGLSurface draw,EGLint * rects,EGLint n_rects)251 EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, EGLint* rects,
252 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
eglSwapBuffers(EGLDisplay dpy,EGLSurface surface)260 EGLBoolean 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
eglCopyBuffers(EGLDisplay dpy,EGLSurface surface,NativePixmapType target)268 EGLBoolean 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
eglQueryString(EGLDisplay dpy,EGLint name)275 const 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
eglQueryStringImplementationANDROID(EGLDisplay dpy,EGLint name)282 extern "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
eglSurfaceAttrib(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLint value)289 EGLBoolean 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
eglBindTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)296 EGLBoolean 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
eglReleaseTexImage(EGLDisplay dpy,EGLSurface surface,EGLint buffer)303 EGLBoolean 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
eglSwapInterval(EGLDisplay dpy,EGLint interval)310 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
311 clearError();
312
313 egl_connection_t* const cnx = &gEGLImpl;
314 return cnx->platform.eglSwapInterval(dpy, interval);
315 }
316
eglWaitClient(void)317 EGLBoolean eglWaitClient(void) {
318 clearError();
319
320 egl_connection_t* const cnx = &gEGLImpl;
321 return cnx->platform.eglWaitClient();
322 }
323
eglBindAPI(EGLenum api)324 EGLBoolean eglBindAPI(EGLenum api) {
325 if (egl_init_drivers() == EGL_FALSE) {
326 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
327 }
328
329 clearError();
330 egl_connection_t* const cnx = &gEGLImpl;
331 return cnx->platform.eglBindAPI(api);
332 }
333
eglQueryAPI(void)334 EGLenum eglQueryAPI(void) {
335 if (egl_init_drivers() == EGL_FALSE) {
336 return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
337 }
338
339 clearError();
340 egl_connection_t* const cnx = &gEGLImpl;
341 return cnx->platform.eglQueryAPI();
342 }
343
eglReleaseThread(void)344 EGLBoolean eglReleaseThread(void) {
345 clearError();
346
347 egl_connection_t* const cnx = &gEGLImpl;
348 return cnx->platform.eglReleaseThread();
349 }
350
eglCreatePbufferFromClientBuffer(EGLDisplay dpy,EGLenum buftype,EGLClientBuffer buffer,EGLConfig config,const EGLint * attrib_list)351 EGLSurface 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
eglLockSurfaceKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * attrib_list)360 EGLBoolean 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
eglUnlockSurfaceKHR(EGLDisplay dpy,EGLSurface surface)367 EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface) {
368 clearError();
369
370 egl_connection_t* const cnx = &gEGLImpl;
371 return cnx->platform.eglUnlockSurfaceKHR(dpy, surface);
372 }
373
eglCreateImageKHR(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLint * attrib_list)374 EGLImageKHR 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
eglCreateImage(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLAttrib * attrib_list)382 EGLImage 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
eglDestroyImageKHR(EGLDisplay dpy,EGLImageKHR img)390 EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) {
391 clearError();
392
393 egl_connection_t* const cnx = &gEGLImpl;
394 return cnx->platform.eglDestroyImageKHR(dpy, img);
395 }
396
eglDestroyImage(EGLDisplay dpy,EGLImageKHR img)397 EGLBoolean 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
eglCreateSync(EGLDisplay dpy,EGLenum type,const EGLAttrib * attrib_list)408 EGLSyncKHR 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
eglCreateSyncKHR(EGLDisplay dpy,EGLenum type,const EGLint * attrib_list)415 EGLSyncKHR 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
eglDestroySync(EGLDisplay dpy,EGLSyncKHR sync)422 EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync) {
423 clearError();
424
425 egl_connection_t* const cnx = &gEGLImpl;
426 return cnx->platform.eglDestroySync(dpy, sync);
427 }
428
eglDestroySyncKHR(EGLDisplay dpy,EGLSyncKHR sync)429 EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) {
430 clearError();
431
432 egl_connection_t* const cnx = &gEGLImpl;
433 return cnx->platform.eglDestroySyncKHR(dpy, sync);
434 }
435
eglSignalSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLenum mode)436 EGLBoolean 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
eglClientWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags,EGLTimeKHR timeout)443 EGLint 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
eglClientWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags,EGLTimeKHR timeout)450 EGLint 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
eglGetSyncAttrib(EGLDisplay dpy,EGLSync sync,EGLint attribute,EGLAttrib * value)457 EGLBoolean 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
eglGetSyncAttribKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint attribute,EGLint * value)464 EGLBoolean 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
eglCreateStreamKHR(EGLDisplay dpy,const EGLint * attrib_list)471 EGLStreamKHR 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
eglDestroyStreamKHR(EGLDisplay dpy,EGLStreamKHR stream)478 EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) {
479 clearError();
480
481 egl_connection_t* const cnx = &gEGLImpl;
482 return cnx->platform.eglDestroyStreamKHR(dpy, stream);
483 }
484
eglStreamAttribKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint value)485 EGLBoolean 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
eglQueryStreamKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint * value)493 EGLBoolean 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
eglQueryStreamu64KHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLuint64KHR * value)501 EGLBoolean 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
eglQueryStreamTimeKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLTimeKHR * value)509 EGLBoolean 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
eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy,EGLConfig config,EGLStreamKHR stream,const EGLint * attrib_list)517 EGLSurface 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
eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy,EGLStreamKHR stream)525 EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream) {
526 clearError();
527
528 egl_connection_t* const cnx = &gEGLImpl;
529 return cnx->platform.eglStreamConsumerGLTextureExternalKHR(dpy, stream);
530 }
531
eglStreamConsumerAcquireKHR(EGLDisplay dpy,EGLStreamKHR stream)532 EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream) {
533 clearError();
534
535 egl_connection_t* const cnx = &gEGLImpl;
536 return cnx->platform.eglStreamConsumerAcquireKHR(dpy, stream);
537 }
538
eglStreamConsumerReleaseKHR(EGLDisplay dpy,EGLStreamKHR stream)539 EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream) {
540 clearError();
541
542 egl_connection_t* const cnx = &gEGLImpl;
543 return cnx->platform.eglStreamConsumerReleaseKHR(dpy, stream);
544 }
545
eglGetStreamFileDescriptorKHR(EGLDisplay dpy,EGLStreamKHR stream)546 EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream) {
547 clearError();
548
549 egl_connection_t* const cnx = &gEGLImpl;
550 return cnx->platform.eglGetStreamFileDescriptorKHR(dpy, stream);
551 }
552
eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy,EGLNativeFileDescriptorKHR file_descriptor)553 EGLStreamKHR 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
eglWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags)561 EGLint 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
eglWaitSync(EGLDisplay dpy,EGLSync sync,EGLint flags)567 EGLBoolean 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
eglDupNativeFenceFDANDROID(EGLDisplay dpy,EGLSyncKHR sync)573 EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync) {
574 clearError();
575
576 egl_connection_t* const cnx = &gEGLImpl;
577 return cnx->platform.eglDupNativeFenceFDANDROID(dpy, sync);
578 }
579
eglPresentationTimeANDROID(EGLDisplay dpy,EGLSurface surface,EGLnsecsANDROID time)580 EGLBoolean 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
eglGetNativeClientBufferANDROID(const AHardwareBuffer * buffer)587 EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer* buffer) {
588 clearError();
589 egl_connection_t* const cnx = &gEGLImpl;
590 return cnx->platform.eglGetNativeClientBufferANDROID(buffer);
591 }
592
eglGetSystemTimeFrequencyNV()593 EGLuint64NV eglGetSystemTimeFrequencyNV() {
594 if (egl_init_drivers() == EGL_FALSE) {
595 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
596 }
597
598 clearError();
599 egl_connection_t* const cnx = &gEGLImpl;
600 return cnx->platform.eglGetSystemTimeFrequencyNV();
601 }
602
eglGetSystemTimeNV()603 EGLuint64NV eglGetSystemTimeNV() {
604 if (egl_init_drivers() == EGL_FALSE) {
605 return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
606 }
607
608 clearError();
609 egl_connection_t* const cnx = &gEGLImpl;
610 return cnx->platform.eglGetSystemTimeNV();
611 }
612
eglSetDamageRegionKHR(EGLDisplay dpy,EGLSurface surface,EGLint * rects,EGLint n_rects)613 EGLBoolean 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
eglGetNextFrameIdANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * frameId)621 EGLBoolean 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
eglGetCompositorTimingANDROID(EGLDisplay dpy,EGLSurface surface,EGLint numTimestamps,const EGLint * names,EGLnsecsANDROID * values)628 EGLBoolean 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
eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint name)636 EGLBoolean 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
eglGetFrameTimestampsANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR frameId,EGLint numTimestamps,const EGLint * timestamps,EGLnsecsANDROID * values)643 EGLBoolean 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
eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint timestamp)653 EGLBoolean 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 }
660