Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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" |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 36 | static inline void clearError() { |
| 37 | egl_tls_t::clearError(); |
| 38 | } |
| 39 | |
| 40 | EGLDisplay eglGetDisplay(EGLNativeDisplayType display) { |
| 41 | ATRACE_CALL(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 49 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 50 | egl_connection_t* const cnx = &gEGLImpl; |
| 51 | return cnx->platform.eglGetDisplay(display); |
| 52 | } |
| 53 | |
Courtney Goeltzenleuchter | 4adf75b | 2018-10-11 13:09:40 -0600 | [diff] [blame] | 54 | EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display, |
| 55 | const EGLAttrib* attrib_list) { |
| 56 | ATRACE_CALL(); |
Courtney Goeltzenleuchter | 4adf75b | 2018-10-11 13:09:40 -0600 | [diff] [blame] | 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 |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 64 | clearError(); |
Courtney Goeltzenleuchter | 4adf75b | 2018-10-11 13:09:40 -0600 | [diff] [blame] | 65 | egl_connection_t* const cnx = &gEGLImpl; |
| 66 | return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list); |
| 67 | } |
| 68 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 76 | EGLBoolean eglTerminate(EGLDisplay dpy) { |
| 77 | clearError(); |
| 78 | |
| 79 | egl_connection_t* const cnx = &gEGLImpl; |
| 80 | return cnx->platform.eglTerminate(dpy); |
| 81 | } |
| 82 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
Courtney Goeltzenleuchter | 69476e5 | 2018-10-11 12:59:34 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | 69476e5 | 2018-10-11 12:59:34 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 196 | EGLContext eglGetCurrentContext(void) { |
| 197 | clearError(); |
| 198 | |
| 199 | egl_connection_t* const cnx = &gEGLImpl; |
| 200 | return cnx->platform.eglGetCurrentContext(); |
| 201 | } |
| 202 | |
| 203 | EGLSurface eglGetCurrentSurface(EGLint readdraw) { |
| 204 | clearError(); |
| 205 | |
| 206 | egl_connection_t* const cnx = &gEGLImpl; |
| 207 | return cnx->platform.eglGetCurrentSurface(readdraw); |
| 208 | } |
| 209 | |
| 210 | EGLDisplay eglGetCurrentDisplay(void) { |
| 211 | clearError(); |
| 212 | |
| 213 | egl_connection_t* const cnx = &gEGLImpl; |
| 214 | return cnx->platform.eglGetCurrentDisplay(); |
| 215 | } |
| 216 | |
| 217 | EGLBoolean eglWaitGL(void) { |
| 218 | clearError(); |
| 219 | |
| 220 | egl_connection_t* const cnx = &gEGLImpl; |
| 221 | return cnx->platform.eglWaitGL(); |
| 222 | } |
| 223 | |
| 224 | EGLBoolean eglWaitNative(EGLint engine) { |
| 225 | clearError(); |
| 226 | |
| 227 | egl_connection_t* const cnx = &gEGLImpl; |
| 228 | return cnx->platform.eglWaitNative(engine); |
| 229 | } |
| 230 | |
| 231 | EGLint eglGetError(void) { |
| 232 | egl_connection_t* const cnx = &gEGLImpl; |
Cody Northrop | 9a9a1f4 | 2018-10-15 18:32:41 -0600 | [diff] [blame] | 233 | return cnx->platform.eglGetError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 234 | } |
| 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 Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 241 | if (egl_init_drivers() == EGL_FALSE) { |
| 242 | setError(EGL_BAD_PARAMETER, NULL); |
| 243 | return nullptr; |
| 244 | } |
| 245 | |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 246 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 247 | egl_connection_t* const cnx = &gEGLImpl; |
| 248 | return cnx->platform.eglGetProcAddress(procname); |
| 249 | } |
| 250 | |
Tom Murphy | 790b461 | 2024-07-22 12:11:52 +0000 | [diff] [blame] | 251 | EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, const EGLint* rects, |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 317 | EGLBoolean eglWaitClient(void) { |
| 318 | clearError(); |
| 319 | |
| 320 | egl_connection_t* const cnx = &gEGLImpl; |
| 321 | return cnx->platform.eglWaitClient(); |
| 322 | } |
| 323 | |
| 324 | EGLBoolean eglBindAPI(EGLenum api) { |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 325 | if (egl_init_drivers() == EGL_FALSE) { |
| 326 | return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE); |
| 327 | } |
| 328 | |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 329 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 330 | egl_connection_t* const cnx = &gEGLImpl; |
| 331 | return cnx->platform.eglBindAPI(api); |
| 332 | } |
| 333 | |
| 334 | EGLenum eglQueryAPI(void) { |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 335 | if (egl_init_drivers() == EGL_FALSE) { |
| 336 | return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE); |
| 337 | } |
| 338 | |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 339 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 340 | egl_connection_t* const cnx = &gEGLImpl; |
| 341 | return cnx->platform.eglQueryAPI(); |
| 342 | } |
| 343 | |
| 344 | EGLBoolean eglReleaseThread(void) { |
| 345 | clearError(); |
| 346 | |
| 347 | egl_connection_t* const cnx = &gEGLImpl; |
| 348 | return cnx->platform.eglReleaseThread(); |
| 349 | } |
| 350 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
Courtney Goeltzenleuchter | e498a2d | 2018-07-19 17:11:04 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | e498a2d | 2018-07-19 17:11:04 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | 40627ba | 2018-07-31 10:27:40 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | 40627ba | 2018-07-31 10:27:40 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 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 | |
Courtney Goeltzenleuchter | 40627ba | 2018-07-31 10:27:40 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
Courtney Goeltzenleuchter | 40627ba | 2018-07-31 10:27:40 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
Courtney Goeltzenleuchter | 40627ba | 2018-07-31 10:27:40 -0600 | [diff] [blame] | 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 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 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 | |
| 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 | |
| 587 | EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer* buffer) { |
| 588 | clearError(); |
| 589 | egl_connection_t* const cnx = &gEGLImpl; |
| 590 | return cnx->platform.eglGetNativeClientBufferANDROID(buffer); |
| 591 | } |
| 592 | |
| 593 | EGLuint64NV eglGetSystemTimeFrequencyNV() { |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 594 | if (egl_init_drivers() == EGL_FALSE) { |
| 595 | return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE); |
| 596 | } |
| 597 | |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 598 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 599 | egl_connection_t* const cnx = &gEGLImpl; |
| 600 | return cnx->platform.eglGetSystemTimeFrequencyNV(); |
| 601 | } |
| 602 | |
| 603 | EGLuint64NV eglGetSystemTimeNV() { |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 604 | if (egl_init_drivers() == EGL_FALSE) { |
| 605 | return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE); |
| 606 | } |
| 607 | |
Yiwei Zhang | 86f9f74 | 2019-08-27 00:27:29 -0700 | [diff] [blame] | 608 | clearError(); |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 609 | egl_connection_t* const cnx = &gEGLImpl; |
| 610 | return cnx->platform.eglGetSystemTimeNV(); |
| 611 | } |
| 612 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | |
| 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 | } |