• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // FunctionsEGL.cpp: Implements the FunctionsEGL class.
8 
9 #include "libANGLE/renderer/gl/egl/FunctionsEGL.h"
10 
11 #include <algorithm>
12 
13 #include "common/platform.h"
14 #include "common/string_utils.h"
15 #include "libANGLE/renderer/driver_utils.h"
16 #include "libANGLE/renderer/gl/FunctionsGL.h"
17 #include "libANGLE/renderer/gl/egl/functionsegl_typedefs.h"
18 
19 namespace
20 {
21 
22 template <typename T>
SetPtr(T * dst,void * src)23 bool SetPtr(T *dst, void *src)
24 {
25     if (src)
26     {
27         *dst = reinterpret_cast<T>(src);
28         return true;
29     }
30     return false;
31 }
32 }  // namespace
33 
34 namespace rx
35 {
36 
37 struct FunctionsEGL::EGLDispatchTable
38 {
EGLDispatchTablerx::FunctionsEGL::EGLDispatchTable39     EGLDispatchTable()
40         : bindAPIPtr(nullptr),
41           chooseConfigPtr(nullptr),
42           createContextPtr(nullptr),
43           createPbufferSurfacePtr(nullptr),
44           createWindowSurfacePtr(nullptr),
45           destroyContextPtr(nullptr),
46           destroySurfacePtr(nullptr),
47           getConfigAttribPtr(nullptr),
48           getCurrentSurfacePtr(nullptr),
49           getDisplayPtr(nullptr),
50           getErrorPtr(nullptr),
51           initializePtr(nullptr),
52           makeCurrentPtr(nullptr),
53           queryStringPtr(nullptr),
54           querySurfacePtr(nullptr),
55           swapBuffersPtr(nullptr),
56           terminatePtr(nullptr),
57 
58           bindTexImagePtr(nullptr),
59           releaseTexImagePtr(nullptr),
60           surfaceAttribPtr(nullptr),
61           swapIntervalPtr(nullptr),
62 
63           getCurrentContextPtr(nullptr),
64 
65           createImageKHRPtr(nullptr),
66           destroyImageKHRPtr(nullptr),
67 
68           createSyncKHRPtr(nullptr),
69           destroySyncKHRPtr(nullptr),
70           clientWaitSyncKHRPtr(nullptr),
71           getSyncAttribKHRPtr(nullptr),
72 
73           waitSyncKHRPtr(nullptr),
74 
75           swapBuffersWithDamageKHRPtr(nullptr),
76 
77           presentationTimeANDROIDPtr(nullptr),
78 
79           setBlobCacheFuncsANDROIDPtr(nullptr),
80 
81           getCompositorTimingSupportedANDROIDPtr(nullptr),
82           getCompositorTimingANDROIDPtr(nullptr),
83           getNextFrameIdANDROIDPtr(nullptr),
84           getFrameTimestampSupportedANDROIDPtr(nullptr),
85           getFrameTimestampsANDROIDPtr(nullptr),
86 
87           dupNativeFenceFDANDROIDPtr(nullptr)
88     {}
89 
90     // 1.0
91     PFNEGLBINDAPIPROC bindAPIPtr;
92     PFNEGLCHOOSECONFIGPROC chooseConfigPtr;
93     PFNEGLCREATECONTEXTPROC createContextPtr;
94     PFNEGLCREATEPBUFFERSURFACEPROC createPbufferSurfacePtr;
95     PFNEGLCREATEWINDOWSURFACEPROC createWindowSurfacePtr;
96     PFNEGLDESTROYCONTEXTPROC destroyContextPtr;
97     PFNEGLDESTROYSURFACEPROC destroySurfacePtr;
98     PFNEGLGETCONFIGATTRIBPROC getConfigAttribPtr;
99     PFNEGLGETCURRENTSURFACEPROC getCurrentSurfacePtr;
100     PFNEGLGETDISPLAYPROC getDisplayPtr;
101     PFNEGLGETERRORPROC getErrorPtr;
102     PFNEGLINITIALIZEPROC initializePtr;
103     PFNEGLMAKECURRENTPROC makeCurrentPtr;
104     PFNEGLQUERYSTRINGPROC queryStringPtr;
105     PFNEGLQUERYSURFACEPROC querySurfacePtr;
106     PFNEGLSWAPBUFFERSPROC swapBuffersPtr;
107     PFNEGLTERMINATEPROC terminatePtr;
108 
109     // 1.1
110     PFNEGLBINDTEXIMAGEPROC bindTexImagePtr;
111     PFNEGLRELEASETEXIMAGEPROC releaseTexImagePtr;
112     PFNEGLSURFACEATTRIBPROC surfaceAttribPtr;
113     PFNEGLSWAPINTERVALPROC swapIntervalPtr;
114 
115     // 1.4
116     PFNEGLGETCURRENTCONTEXTPROC getCurrentContextPtr;
117 
118     // EGL_KHR_image
119     PFNEGLCREATEIMAGEKHRPROC createImageKHRPtr;
120     PFNEGLDESTROYIMAGEKHRPROC destroyImageKHRPtr;
121 
122     // EGL_KHR_fence_sync
123     PFNEGLCREATESYNCKHRPROC createSyncKHRPtr;
124     PFNEGLDESTROYSYNCKHRPROC destroySyncKHRPtr;
125     PFNEGLCLIENTWAITSYNCKHRPROC clientWaitSyncKHRPtr;
126     PFNEGLGETSYNCATTRIBKHRPROC getSyncAttribKHRPtr;
127 
128     // EGL_KHR_wait_sync
129     PFNEGLWAITSYNCKHRPROC waitSyncKHRPtr;
130 
131     // EGL_KHR_swap_buffers_with_damage
132     PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC swapBuffersWithDamageKHRPtr;
133 
134     // EGL_ANDROID_presentation_time
135     PFNEGLPRESENTATIONTIMEANDROIDPROC presentationTimeANDROIDPtr;
136 
137     // EGL_ANDROID_blob_cache
138     PFNEGLSETBLOBCACHEFUNCSANDROIDPROC setBlobCacheFuncsANDROIDPtr;
139 
140     // EGL_ANDROID_get_frame_timestamps
141     PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC getCompositorTimingSupportedANDROIDPtr;
142     PFNEGLGETCOMPOSITORTIMINGANDROIDPROC getCompositorTimingANDROIDPtr;
143     PFNEGLGETNEXTFRAMEIDANDROIDPROC getNextFrameIdANDROIDPtr;
144     PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC getFrameTimestampSupportedANDROIDPtr;
145     PFNEGLGETFRAMETIMESTAMPSANDROIDPROC getFrameTimestampsANDROIDPtr;
146 
147     // EGL_ANDROID_native_fence_sync
148     PFNEGLDUPNATIVEFENCEFDANDROIDPROC dupNativeFenceFDANDROIDPtr;
149 };
150 
FunctionsEGL()151 FunctionsEGL::FunctionsEGL()
152     : majorVersion(0), minorVersion(0), mFnPtrs(new EGLDispatchTable()), mEGLDisplay(EGL_NO_DISPLAY)
153 {}
154 
~FunctionsEGL()155 FunctionsEGL::~FunctionsEGL()
156 {
157     SafeDelete(mFnPtrs);
158 }
159 
initialize(EGLNativeDisplayType nativeDisplay)160 egl::Error FunctionsEGL::initialize(EGLNativeDisplayType nativeDisplay)
161 {
162 #define ANGLE_GET_PROC_OR_ERROR(MEMBER, NAME)                                           \
163     do                                                                                  \
164     {                                                                                   \
165         if (!SetPtr(MEMBER, getProcAddress(#NAME)))                                     \
166         {                                                                               \
167             return egl::EglNotInitialized() << "Could not load EGL entry point " #NAME; \
168         }                                                                               \
169     } while (0)
170 
171     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->bindAPIPtr, eglBindAPI);
172     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->chooseConfigPtr, eglChooseConfig);
173     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createContextPtr, eglCreateContext);
174     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createPbufferSurfacePtr, eglCreatePbufferSurface);
175     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createWindowSurfacePtr, eglCreateWindowSurface);
176     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroyContextPtr, eglDestroyContext);
177     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroySurfacePtr, eglDestroySurface);
178     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getConfigAttribPtr, eglGetConfigAttrib);
179     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getCurrentSurfacePtr, eglGetCurrentSurface);
180     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getDisplayPtr, eglGetDisplay);
181     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getErrorPtr, eglGetError);
182     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->initializePtr, eglInitialize);
183     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->makeCurrentPtr, eglMakeCurrent);
184     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->queryStringPtr, eglQueryString);
185     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->querySurfacePtr, eglQuerySurface);
186     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapBuffersPtr, eglSwapBuffers);
187     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->terminatePtr, eglTerminate);
188 
189     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->bindTexImagePtr, eglBindTexImage);
190     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->releaseTexImagePtr, eglReleaseTexImage);
191     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->surfaceAttribPtr, eglSurfaceAttrib);
192     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapIntervalPtr, eglSwapInterval);
193 
194     mEGLDisplay = mFnPtrs->getDisplayPtr(nativeDisplay);
195     if (mEGLDisplay == EGL_NO_DISPLAY)
196     {
197         return egl::EglNotInitialized() << "Failed to get system egl display";
198     }
199     if (mFnPtrs->initializePtr(mEGLDisplay, &majorVersion, &minorVersion) != EGL_TRUE)
200     {
201         return egl::Error(mFnPtrs->getErrorPtr(), "Failed to initialize system egl");
202     }
203     if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 4))
204     {
205         return egl::EglNotInitialized() << "Unsupported EGL version (require at least 1.4).";
206     }
207     if (mFnPtrs->bindAPIPtr(EGL_OPENGL_ES_API) != EGL_TRUE)
208     {
209         return egl::Error(mFnPtrs->getErrorPtr(), "Failed to bind API in system egl");
210     }
211 
212     ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getCurrentContextPtr, eglGetCurrentContext);
213 
214     const char *extensions = queryString(EGL_EXTENSIONS);
215     if (!extensions)
216     {
217         return egl::Error(mFnPtrs->getErrorPtr(), "Faild to query extensions in system egl");
218     }
219     angle::SplitStringAlongWhitespace(extensions, &mExtensions);
220 
221     if (hasExtension("EGL_KHR_image_base"))
222     {
223         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createImageKHRPtr, eglCreateImageKHR);
224         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroyImageKHRPtr, eglDestroyImageKHR);
225     }
226     if (hasExtension("EGL_KHR_fence_sync"))
227     {
228         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createSyncKHRPtr, eglCreateSyncKHR);
229         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroySyncKHRPtr, eglDestroySyncKHR);
230         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->clientWaitSyncKHRPtr, eglClientWaitSyncKHR);
231         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getSyncAttribKHRPtr, eglGetSyncAttribKHR);
232     }
233     if (hasExtension("EGL_KHR_wait_sync"))
234     {
235         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->waitSyncKHRPtr, eglWaitSyncKHR);
236     }
237 
238     if (hasExtension("EGL_KHR_swap_buffers_with_damage"))
239     {
240         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapBuffersWithDamageKHRPtr, eglSwapBuffersWithDamageKHR);
241     }
242 
243     if (hasExtension("EGL_ANDROID_presentation_time"))
244     {
245         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->presentationTimeANDROIDPtr, eglPresentationTimeANDROID);
246     }
247 
248     if (hasExtension("EGL_ANDROID_blob_cache"))
249     {
250         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->setBlobCacheFuncsANDROIDPtr, eglSetBlobCacheFuncsANDROID);
251     }
252 
253     if (hasExtension("EGL_ANDROID_get_frame_timestamps"))
254     {
255         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getCompositorTimingSupportedANDROIDPtr,
256                                 eglGetCompositorTimingSupportedANDROID);
257         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getCompositorTimingANDROIDPtr,
258                                 eglGetCompositorTimingANDROID);
259         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getNextFrameIdANDROIDPtr, eglGetNextFrameIdANDROID);
260         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getFrameTimestampSupportedANDROIDPtr,
261                                 eglGetFrameTimestampSupportedANDROID);
262         ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getFrameTimestampsANDROIDPtr,
263                                 eglGetFrameTimestampsANDROID);
264     }
265 
266     // The native fence sync extension is a bit complicated. It's reported as present for ChromeOS,
267     // but Android currently doesn't report this extension even when it's present, and older devices
268     // may export a useless wrapper function. See crbug.com/775707 for details. In short, if the
269     // symbol is present and we're on Android N or newer, assume that it's usable even if the
270     // extension wasn't reported.
271     if (hasExtension("EGL_ANDROID_native_fence_sync") || GetAndroidSDKVersion() >= 24)
272     {
273         // Don't error trying to load this entry point.
274         if (SetPtr(&mFnPtrs->dupNativeFenceFDANDROIDPtr,
275                    getProcAddress("eglDupNativeFenceFDANDROID")) &&
276             !hasExtension("EGL_ANDROID_native_fence_sync"))
277         {
278             mExtensions.push_back("EGL_ANDROID_native_fence_sync");
279         }
280     }
281 
282 #undef ANGLE_GET_PROC_OR_ERROR
283 
284     return egl::NoError();
285 }
286 
terminate()287 egl::Error FunctionsEGL::terminate()
288 {
289     if (mFnPtrs->terminatePtr == nullptr || mFnPtrs->terminatePtr(mEGLDisplay) == EGL_TRUE)
290     {
291         mEGLDisplay = nullptr;
292         return egl::NoError();
293     }
294     return egl::Error(mFnPtrs->getErrorPtr());
295 }
296 
297 class FunctionsGLEGL : public FunctionsGL
298 {
299   public:
FunctionsGLEGL(const FunctionsEGL & egl)300     FunctionsGLEGL(const FunctionsEGL &egl) : mEGL(egl) {}
301 
~FunctionsGLEGL()302     ~FunctionsGLEGL() override {}
303 
304   private:
loadProcAddress(const std::string & function) const305     void *loadProcAddress(const std::string &function) const override
306     {
307         return mEGL.getProcAddress(function.c_str());
308     }
309 
310     const FunctionsEGL &mEGL;
311 };
312 
makeFunctionsGL(void) const313 FunctionsGL *FunctionsEGL::makeFunctionsGL(void) const
314 {
315     return new FunctionsGLEGL(*this);
316 }
317 
hasExtension(const char * extension) const318 bool FunctionsEGL::hasExtension(const char *extension) const
319 {
320     return std::find(mExtensions.begin(), mExtensions.end(), extension) != mExtensions.end();
321 }
322 
getDisplay() const323 EGLDisplay FunctionsEGL::getDisplay() const
324 {
325     return mEGLDisplay;
326 }
327 
getError() const328 EGLint FunctionsEGL::getError() const
329 {
330     return mFnPtrs->getErrorPtr();
331 }
332 
chooseConfig(EGLint const * attribList,EGLConfig * configs,EGLint configSize,EGLint * numConfig) const333 EGLBoolean FunctionsEGL::chooseConfig(EGLint const *attribList,
334                                       EGLConfig *configs,
335                                       EGLint configSize,
336                                       EGLint *numConfig) const
337 {
338     return mFnPtrs->chooseConfigPtr(mEGLDisplay, attribList, configs, configSize, numConfig);
339 }
340 
getConfigAttrib(EGLConfig config,EGLint attribute,EGLint * value) const341 EGLBoolean FunctionsEGL::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value) const
342 {
343     return mFnPtrs->getConfigAttribPtr(mEGLDisplay, config, attribute, value);
344 }
345 
getCurrentSurface(EGLint readdraw) const346 EGLSurface FunctionsEGL::getCurrentSurface(EGLint readdraw) const
347 {
348     return mFnPtrs->getCurrentSurfacePtr(readdraw);
349 }
350 
createContext(EGLConfig config,EGLContext share_context,EGLint const * attrib_list) const351 EGLContext FunctionsEGL::createContext(EGLConfig config,
352                                        EGLContext share_context,
353                                        EGLint const *attrib_list) const
354 {
355     return mFnPtrs->createContextPtr(mEGLDisplay, config, share_context, attrib_list);
356 }
357 
createPbufferSurface(EGLConfig config,const EGLint * attrib_list) const358 EGLSurface FunctionsEGL::createPbufferSurface(EGLConfig config, const EGLint *attrib_list) const
359 {
360     return mFnPtrs->createPbufferSurfacePtr(mEGLDisplay, config, attrib_list);
361 }
362 
createWindowSurface(EGLConfig config,EGLNativeWindowType win,const EGLint * attrib_list) const363 EGLSurface FunctionsEGL::createWindowSurface(EGLConfig config,
364                                              EGLNativeWindowType win,
365                                              const EGLint *attrib_list) const
366 {
367     return mFnPtrs->createWindowSurfacePtr(mEGLDisplay, config, win, attrib_list);
368 }
369 
destroyContext(EGLContext context) const370 EGLBoolean FunctionsEGL::destroyContext(EGLContext context) const
371 {
372     return mFnPtrs->destroyContextPtr(mEGLDisplay, context);
373 }
374 
destroySurface(EGLSurface surface) const375 EGLBoolean FunctionsEGL::destroySurface(EGLSurface surface) const
376 {
377     return mFnPtrs->destroySurfacePtr(mEGLDisplay, surface);
378 }
379 
makeCurrent(EGLSurface surface,EGLContext context) const380 EGLBoolean FunctionsEGL::makeCurrent(EGLSurface surface, EGLContext context) const
381 {
382     return mFnPtrs->makeCurrentPtr(mEGLDisplay, surface, surface, context);
383 }
384 
queryString(EGLint name) const385 char const *FunctionsEGL::queryString(EGLint name) const
386 {
387     return mFnPtrs->queryStringPtr(mEGLDisplay, name);
388 }
389 
querySurface(EGLSurface surface,EGLint attribute,EGLint * value) const390 EGLBoolean FunctionsEGL::querySurface(EGLSurface surface, EGLint attribute, EGLint *value) const
391 {
392     return mFnPtrs->querySurfacePtr(mEGLDisplay, surface, attribute, value);
393 }
394 
swapBuffers(EGLSurface surface) const395 EGLBoolean FunctionsEGL::swapBuffers(EGLSurface surface) const
396 {
397     return mFnPtrs->swapBuffersPtr(mEGLDisplay, surface);
398 }
399 
bindTexImage(EGLSurface surface,EGLint buffer) const400 EGLBoolean FunctionsEGL::bindTexImage(EGLSurface surface, EGLint buffer) const
401 {
402     return mFnPtrs->bindTexImagePtr(mEGLDisplay, surface, buffer);
403 }
404 
releaseTexImage(EGLSurface surface,EGLint buffer) const405 EGLBoolean FunctionsEGL::releaseTexImage(EGLSurface surface, EGLint buffer) const
406 {
407     return mFnPtrs->releaseTexImagePtr(mEGLDisplay, surface, buffer);
408 }
409 
surfaceAttrib(EGLSurface surface,EGLint attribute,EGLint value) const410 EGLBoolean FunctionsEGL::surfaceAttrib(EGLSurface surface, EGLint attribute, EGLint value) const
411 {
412     return mFnPtrs->surfaceAttribPtr(mEGLDisplay, surface, attribute, value);
413 }
414 
swapInterval(EGLint interval) const415 EGLBoolean FunctionsEGL::swapInterval(EGLint interval) const
416 {
417     return mFnPtrs->swapIntervalPtr(mEGLDisplay, interval);
418 }
419 
getCurrentContext() const420 EGLContext FunctionsEGL::getCurrentContext() const
421 {
422     return mFnPtrs->getCurrentContextPtr();
423 }
424 
createImageKHR(EGLContext context,EGLenum target,EGLClientBuffer buffer,const EGLint * attrib_list) const425 EGLImageKHR FunctionsEGL::createImageKHR(EGLContext context,
426                                          EGLenum target,
427                                          EGLClientBuffer buffer,
428                                          const EGLint *attrib_list) const
429 {
430     return mFnPtrs->createImageKHRPtr(mEGLDisplay, context, target, buffer, attrib_list);
431 }
432 
destroyImageKHR(EGLImageKHR image) const433 EGLBoolean FunctionsEGL::destroyImageKHR(EGLImageKHR image) const
434 {
435     return mFnPtrs->destroyImageKHRPtr(mEGLDisplay, image);
436 }
437 
createSyncKHR(EGLenum type,const EGLint * attrib_list) const438 EGLSyncKHR FunctionsEGL::createSyncKHR(EGLenum type, const EGLint *attrib_list) const
439 {
440     return mFnPtrs->createSyncKHRPtr(mEGLDisplay, type, attrib_list);
441 }
442 
destroySyncKHR(EGLSyncKHR sync) const443 EGLBoolean FunctionsEGL::destroySyncKHR(EGLSyncKHR sync) const
444 {
445     return mFnPtrs->destroySyncKHRPtr(mEGLDisplay, sync);
446 }
447 
clientWaitSyncKHR(EGLSyncKHR sync,EGLint flags,EGLTimeKHR timeout) const448 EGLint FunctionsEGL::clientWaitSyncKHR(EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) const
449 {
450     return mFnPtrs->clientWaitSyncKHRPtr(mEGLDisplay, sync, flags, timeout);
451 }
452 
getSyncAttribKHR(EGLSyncKHR sync,EGLint attribute,EGLint * value) const453 EGLBoolean FunctionsEGL::getSyncAttribKHR(EGLSyncKHR sync, EGLint attribute, EGLint *value) const
454 {
455     return mFnPtrs->getSyncAttribKHRPtr(mEGLDisplay, sync, attribute, value);
456 }
457 
waitSyncKHR(EGLSyncKHR sync,EGLint flags) const458 EGLint FunctionsEGL::waitSyncKHR(EGLSyncKHR sync, EGLint flags) const
459 {
460     return mFnPtrs->waitSyncKHRPtr(mEGLDisplay, sync, flags);
461 }
462 
swapBuffersWithDamageKHR(EGLSurface surface,const EGLint * rects,EGLint n_rects) const463 EGLBoolean FunctionsEGL::swapBuffersWithDamageKHR(EGLSurface surface,
464                                                   const EGLint *rects,
465                                                   EGLint n_rects) const
466 {
467     return mFnPtrs->swapBuffersWithDamageKHRPtr(mEGLDisplay, surface, rects, n_rects);
468 }
469 
presentationTimeANDROID(EGLSurface surface,EGLnsecsANDROID time) const470 EGLBoolean FunctionsEGL::presentationTimeANDROID(EGLSurface surface, EGLnsecsANDROID time) const
471 {
472     return mFnPtrs->presentationTimeANDROIDPtr(mEGLDisplay, surface, time);
473 }
474 
setBlobCacheFuncsANDROID(EGLSetBlobFuncANDROID set,EGLGetBlobFuncANDROID get) const475 void FunctionsEGL::setBlobCacheFuncsANDROID(EGLSetBlobFuncANDROID set,
476                                             EGLGetBlobFuncANDROID get) const
477 {
478     return mFnPtrs->setBlobCacheFuncsANDROIDPtr(mEGLDisplay, set, get);
479 }
480 
getCompositorTimingSupportedANDROID(EGLSurface surface,EGLint name) const481 EGLBoolean FunctionsEGL::getCompositorTimingSupportedANDROID(EGLSurface surface, EGLint name) const
482 {
483     return mFnPtrs->getCompositorTimingSupportedANDROIDPtr(mEGLDisplay, surface, name);
484 }
485 
getCompositorTimingANDROID(EGLSurface surface,EGLint numTimestamps,const EGLint * names,EGLnsecsANDROID * values) const486 EGLBoolean FunctionsEGL::getCompositorTimingANDROID(EGLSurface surface,
487                                                     EGLint numTimestamps,
488                                                     const EGLint *names,
489                                                     EGLnsecsANDROID *values) const
490 {
491     return mFnPtrs->getCompositorTimingANDROIDPtr(mEGLDisplay, surface, numTimestamps, names,
492                                                   values);
493 }
494 
getNextFrameIdANDROID(EGLSurface surface,EGLuint64KHR * frameId) const495 EGLBoolean FunctionsEGL::getNextFrameIdANDROID(EGLSurface surface, EGLuint64KHR *frameId) const
496 {
497     return mFnPtrs->getNextFrameIdANDROIDPtr(mEGLDisplay, surface, frameId);
498 }
499 
getFrameTimestampSupportedANDROID(EGLSurface surface,EGLint timestamp) const500 EGLBoolean FunctionsEGL::getFrameTimestampSupportedANDROID(EGLSurface surface,
501                                                            EGLint timestamp) const
502 {
503     return mFnPtrs->getFrameTimestampSupportedANDROIDPtr(mEGLDisplay, surface, timestamp);
504 }
505 
getFrameTimestampsANDROID(EGLSurface surface,EGLuint64KHR frameId,EGLint numTimestamps,const EGLint * timestamps,EGLnsecsANDROID * values) const506 EGLBoolean FunctionsEGL::getFrameTimestampsANDROID(EGLSurface surface,
507                                                    EGLuint64KHR frameId,
508                                                    EGLint numTimestamps,
509                                                    const EGLint *timestamps,
510                                                    EGLnsecsANDROID *values) const
511 {
512     return mFnPtrs->getFrameTimestampsANDROIDPtr(mEGLDisplay, surface, frameId, numTimestamps,
513                                                  timestamps, values);
514 }
515 
dupNativeFenceFDANDROID(EGLSync sync) const516 EGLint FunctionsEGL::dupNativeFenceFDANDROID(EGLSync sync) const
517 {
518     return mFnPtrs->dupNativeFenceFDANDROIDPtr(mEGLDisplay, sync);
519 }
520 
521 }  // namespace rx
522