eglApi.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  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. #define ATRACE_TAG ATRACE_TAG_GRAPHICS
  17. #include <EGL/egl.h>
  18. #include <EGL/eglext.h>
  19. #include "../egl_impl.h"
  20. #include "egl_layers.h"
  21. #include "egl_platform_entries.h"
  22. #include "egl_tls.h"
  23. #include "egl_trace.h"
  24. using namespace android;
  25. namespace android {
  26. extern EGLBoolean egl_init_drivers();
  27. } // namespace android
  28. static inline void clearError() {
  29. egl_tls_t::clearError();
  30. }
  31. EGLDisplay eglGetDisplay(EGLNativeDisplayType display) {
  32. ATRACE_CALL();
  33. clearError();
  34. if (egl_init_drivers() == EGL_FALSE) {
  35. return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
  36. }
  37. // Call down the chain, which usually points directly to the impl
  38. // but may also be routed through layers
  39. egl_connection_t* const cnx = &gEGLImpl;
  40. return cnx->platform.eglGetDisplay(display);
  41. }
  42. EGLDisplay eglGetPlatformDisplay(EGLenum platform, EGLNativeDisplayType display,
  43. const EGLAttrib* attrib_list) {
  44. ATRACE_CALL();
  45. clearError();
  46. if (egl_init_drivers() == EGL_FALSE) {
  47. return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
  48. }
  49. // Call down the chain, which usually points directly to the impl
  50. // but may also be routed through layers
  51. egl_connection_t* const cnx = &gEGLImpl;
  52. return cnx->platform.eglGetPlatformDisplay(platform, display, attrib_list);
  53. }
  54. EGLBoolean eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor) {
  55. clearError();
  56. egl_connection_t* const cnx = &gEGLImpl;
  57. return cnx->platform.eglInitialize(dpy, major, minor);
  58. }
  59. EGLBoolean eglTerminate(EGLDisplay dpy) {
  60. clearError();
  61. egl_connection_t* const cnx = &gEGLImpl;
  62. return cnx->platform.eglTerminate(dpy);
  63. }
  64. EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig* configs, EGLint config_size,
  65. EGLint* num_config) {
  66. clearError();
  67. egl_connection_t* const cnx = &gEGLImpl;
  68. return cnx->platform.eglGetConfigs(dpy, configs, config_size, num_config);
  69. }
  70. EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs,
  71. EGLint config_size, EGLint* num_config) {
  72. clearError();
  73. egl_connection_t* const cnx = &gEGLImpl;
  74. return cnx->platform.eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
  75. }
  76. EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value) {
  77. clearError();
  78. egl_connection_t* const cnx = &gEGLImpl;
  79. return cnx->platform.eglGetConfigAttrib(dpy, config, attribute, value);
  80. }
  81. EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
  82. const EGLint* attrib_list) {
  83. clearError();
  84. egl_connection_t* const cnx = &gEGLImpl;
  85. return cnx->platform.eglCreateWindowSurface(dpy, config, window, attrib_list);
  86. }
  87. EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void* native_window,
  88. const EGLAttrib* attrib_list) {
  89. clearError();
  90. egl_connection_t* const cnx = &gEGLImpl;
  91. return cnx->platform.eglCreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
  92. }
  93. EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap,
  94. const EGLint* attrib_list) {
  95. clearError();
  96. egl_connection_t* const cnx = &gEGLImpl;
  97. return cnx->platform.eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
  98. }
  99. EGLSurface eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void* native_pixmap,
  100. const EGLAttrib* attrib_list) {
  101. clearError();
  102. egl_connection_t* const cnx = &gEGLImpl;
  103. return cnx->platform.eglCreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
  104. }
  105. EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) {
  106. clearError();
  107. egl_connection_t* const cnx = &gEGLImpl;
  108. return cnx->platform.eglCreatePbufferSurface(dpy, config, attrib_list);
  109. }
  110. EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) {
  111. clearError();
  112. egl_connection_t* const cnx = &gEGLImpl;
  113. return cnx->platform.eglDestroySurface(dpy, surface);
  114. }
  115. EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value) {
  116. clearError();
  117. egl_connection_t* const cnx = &gEGLImpl;
  118. return cnx->platform.eglQuerySurface(dpy, surface, attribute, value);
  119. }
  120. void EGLAPI eglBeginFrame(EGLDisplay dpy, EGLSurface surface) {
  121. ATRACE_CALL();
  122. clearError();
  123. egl_connection_t* const cnx = &gEGLImpl;
  124. cnx->platform.eglBeginFrame(dpy, surface);
  125. }
  126. EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
  127. const EGLint* attrib_list) {
  128. clearError();
  129. egl_connection_t* const cnx = &gEGLImpl;
  130. return cnx->platform.eglCreateContext(dpy, config, share_list, attrib_list);
  131. }
  132. EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
  133. clearError();
  134. egl_connection_t* const cnx = &gEGLImpl;
  135. return cnx->platform.eglDestroyContext(dpy, ctx);
  136. }
  137. EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) {
  138. clearError();
  139. egl_connection_t* const cnx = &gEGLImpl;
  140. return cnx->platform.eglMakeCurrent(dpy, draw, read, ctx);
  141. }
  142. EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value) {
  143. clearError();
  144. egl_connection_t* const cnx = &gEGLImpl;
  145. return cnx->platform.eglQueryContext(dpy, ctx, attribute, value);
  146. }
  147. EGLContext eglGetCurrentContext(void) {
  148. clearError();
  149. egl_connection_t* const cnx = &gEGLImpl;
  150. return cnx->platform.eglGetCurrentContext();
  151. }
  152. EGLSurface eglGetCurrentSurface(EGLint readdraw) {
  153. clearError();
  154. egl_connection_t* const cnx = &gEGLImpl;
  155. return cnx->platform.eglGetCurrentSurface(readdraw);
  156. }
  157. EGLDisplay eglGetCurrentDisplay(void) {
  158. clearError();
  159. egl_connection_t* const cnx = &gEGLImpl;
  160. return cnx->platform.eglGetCurrentDisplay();
  161. }
  162. EGLBoolean eglWaitGL(void) {
  163. clearError();
  164. egl_connection_t* const cnx = &gEGLImpl;
  165. return cnx->platform.eglWaitGL();
  166. }
  167. EGLBoolean eglWaitNative(EGLint engine) {
  168. clearError();
  169. egl_connection_t* const cnx = &gEGLImpl;
  170. return cnx->platform.eglWaitNative(engine);
  171. }
  172. EGLint eglGetError(void) {
  173. egl_connection_t* const cnx = &gEGLImpl;
  174. return cnx->platform.eglGetError();
  175. }
  176. __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* procname) {
  177. // eglGetProcAddress() could be the very first function called
  178. // in which case we must make sure we've initialized ourselves, this
  179. // happens the first time egl_get_display() is called.
  180. clearError();
  181. if (egl_init_drivers() == EGL_FALSE) {
  182. setError(EGL_BAD_PARAMETER, NULL);
  183. return nullptr;
  184. }
  185. egl_connection_t* const cnx = &gEGLImpl;
  186. return cnx->platform.eglGetProcAddress(procname);
  187. }
  188. EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, EGLint* rects,
  189. EGLint n_rects) {
  190. ATRACE_CALL();
  191. clearError();
  192. egl_connection_t* const cnx = &gEGLImpl;
  193. return cnx->platform.eglSwapBuffersWithDamageKHR(dpy, draw, rects, n_rects);
  194. }
  195. EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
  196. ATRACE_CALL();
  197. clearError();
  198. egl_connection_t* const cnx = &gEGLImpl;
  199. return cnx->platform.eglSwapBuffers(dpy, surface);
  200. }
  201. EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target) {
  202. clearError();
  203. egl_connection_t* const cnx = &gEGLImpl;
  204. return cnx->platform.eglCopyBuffers(dpy, surface, target);
  205. }
  206. const char* eglQueryString(EGLDisplay dpy, EGLint name) {
  207. clearError();
  208. egl_connection_t* const cnx = &gEGLImpl;
  209. return cnx->platform.eglQueryString(dpy, name);
  210. }
  211. extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name) {
  212. clearError();
  213. egl_connection_t* const cnx = &gEGLImpl;
  214. return cnx->platform.eglQueryStringImplementationANDROID(dpy, name);
  215. }
  216. EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) {
  217. clearError();
  218. egl_connection_t* const cnx = &gEGLImpl;
  219. return cnx->platform.eglSurfaceAttrib(dpy, surface, attribute, value);
  220. }
  221. EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
  222. clearError();
  223. egl_connection_t* const cnx = &gEGLImpl;
  224. return cnx->platform.eglBindTexImage(dpy, surface, buffer);
  225. }
  226. EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) {
  227. clearError();
  228. egl_connection_t* const cnx = &gEGLImpl;
  229. return cnx->platform.eglReleaseTexImage(dpy, surface, buffer);
  230. }
  231. EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
  232. clearError();
  233. egl_connection_t* const cnx = &gEGLImpl;
  234. return cnx->platform.eglSwapInterval(dpy, interval);
  235. }
  236. EGLBoolean eglWaitClient(void) {
  237. clearError();
  238. egl_connection_t* const cnx = &gEGLImpl;
  239. return cnx->platform.eglWaitClient();
  240. }
  241. EGLBoolean eglBindAPI(EGLenum api) {
  242. clearError();
  243. if (egl_init_drivers() == EGL_FALSE) {
  244. return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
  245. }
  246. egl_connection_t* const cnx = &gEGLImpl;
  247. return cnx->platform.eglBindAPI(api);
  248. }
  249. EGLenum eglQueryAPI(void) {
  250. clearError();
  251. if (egl_init_drivers() == EGL_FALSE) {
  252. return setError(EGL_BAD_PARAMETER, (EGLBoolean)EGL_FALSE);
  253. }
  254. egl_connection_t* const cnx = &gEGLImpl;
  255. return cnx->platform.eglQueryAPI();
  256. }
  257. EGLBoolean eglReleaseThread(void) {
  258. clearError();
  259. egl_connection_t* const cnx = &gEGLImpl;
  260. return cnx->platform.eglReleaseThread();
  261. }
  262. EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
  263. EGLConfig config, const EGLint* attrib_list) {
  264. clearError();
  265. egl_connection_t* const cnx = &gEGLImpl;
  266. return cnx->platform.eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config,
  267. attrib_list);
  268. }
  269. EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface, const EGLint* attrib_list) {
  270. clearError();
  271. egl_connection_t* const cnx = &gEGLImpl;
  272. return cnx->platform.eglLockSurfaceKHR(dpy, surface, attrib_list);
  273. }
  274. EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface) {
  275. clearError();
  276. egl_connection_t* const cnx = &gEGLImpl;
  277. return cnx->platform.eglUnlockSurfaceKHR(dpy, surface);
  278. }
  279. EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
  280. EGLClientBuffer buffer, const EGLint* attrib_list) {
  281. clearError();
  282. egl_connection_t* const cnx = &gEGLImpl;
  283. return cnx->platform.eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
  284. }
  285. EGLImage eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer,
  286. const EGLAttrib* attrib_list) {
  287. clearError();
  288. egl_connection_t* const cnx = &gEGLImpl;
  289. return cnx->platform.eglCreateImage(dpy, ctx, target, buffer, attrib_list);
  290. }
  291. EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) {
  292. clearError();
  293. egl_connection_t* const cnx = &gEGLImpl;
  294. return cnx->platform.eglDestroyImageKHR(dpy, img);
  295. }
  296. EGLBoolean eglDestroyImage(EGLDisplay dpy, EGLImageKHR img) {
  297. clearError();
  298. egl_connection_t* const cnx = &gEGLImpl;
  299. return cnx->platform.eglDestroyImage(dpy, img);
  300. }
  301. // ----------------------------------------------------------------------------
  302. // EGL_EGLEXT_VERSION 5
  303. // ----------------------------------------------------------------------------
  304. EGLSyncKHR eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib* attrib_list) {
  305. clearError();
  306. egl_connection_t* const cnx = &gEGLImpl;
  307. return cnx->platform.eglCreateSync(dpy, type, attrib_list);
  308. }
  309. EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) {
  310. clearError();
  311. egl_connection_t* const cnx = &gEGLImpl;
  312. return cnx->platform.eglCreateSyncKHR(dpy, type, attrib_list);
  313. }
  314. EGLBoolean eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync) {
  315. clearError();
  316. egl_connection_t* const cnx = &gEGLImpl;
  317. return cnx->platform.eglDestroySync(dpy, sync);
  318. }
  319. EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) {
  320. clearError();
  321. egl_connection_t* const cnx = &gEGLImpl;
  322. return cnx->platform.eglDestroySyncKHR(dpy, sync);
  323. }
  324. EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) {
  325. clearError();
  326. egl_connection_t* const cnx = &gEGLImpl;
  327. return cnx->platform.eglSignalSyncKHR(dpy, sync, mode);
  328. }
  329. EGLint eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTimeKHR timeout) {
  330. clearError();
  331. egl_connection_t* const cnx = &gEGLImpl;
  332. return cnx->platform.eglClientWaitSyncKHR(dpy, sync, flags, timeout);
  333. }
  334. EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) {
  335. clearError();
  336. egl_connection_t* const cnx = &gEGLImpl;
  337. return cnx->platform.eglClientWaitSyncKHR(dpy, sync, flags, timeout);
  338. }
  339. EGLBoolean eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib* value) {
  340. clearError();
  341. egl_connection_t* const cnx = &gEGLImpl;
  342. return cnx->platform.eglGetSyncAttrib(dpy, sync, attribute, value);
  343. }
  344. EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint* value) {
  345. clearError();
  346. egl_connection_t* const cnx = &gEGLImpl;
  347. return cnx->platform.eglGetSyncAttribKHR(dpy, sync, attribute, value);
  348. }
  349. EGLStreamKHR eglCreateStreamKHR(EGLDisplay dpy, const EGLint* attrib_list) {
  350. clearError();
  351. egl_connection_t* const cnx = &gEGLImpl;
  352. return cnx->platform.eglCreateStreamKHR(dpy, attrib_list);
  353. }
  354. EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) {
  355. clearError();
  356. egl_connection_t* const cnx = &gEGLImpl;
  357. return cnx->platform.eglDestroyStreamKHR(dpy, stream);
  358. }
  359. EGLBoolean eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
  360. EGLint value) {
  361. clearError();
  362. egl_connection_t* const cnx = &gEGLImpl;
  363. return cnx->platform.eglStreamAttribKHR(dpy, stream, attribute, value);
  364. }
  365. EGLBoolean eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
  366. EGLint* value) {
  367. clearError();
  368. egl_connection_t* const cnx = &gEGLImpl;
  369. return cnx->platform.eglQueryStreamKHR(dpy, stream, attribute, value);
  370. }
  371. EGLBoolean eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
  372. EGLuint64KHR* value) {
  373. clearError();
  374. egl_connection_t* const cnx = &gEGLImpl;
  375. return cnx->platform.eglQueryStreamu64KHR(dpy, stream, attribute, value);
  376. }
  377. EGLBoolean eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute,
  378. EGLTimeKHR* value) {
  379. clearError();
  380. egl_connection_t* const cnx = &gEGLImpl;
  381. return cnx->platform.eglQueryStreamTimeKHR(dpy, stream, attribute, value);
  382. }
  383. EGLSurface eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream,
  384. const EGLint* attrib_list) {
  385. clearError();
  386. egl_connection_t* const cnx = &gEGLImpl;
  387. return cnx->platform.eglCreateStreamProducerSurfaceKHR(dpy, config, stream, attrib_list);
  388. }
  389. EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream) {
  390. clearError();
  391. egl_connection_t* const cnx = &gEGLImpl;
  392. return cnx->platform.eglStreamConsumerGLTextureExternalKHR(dpy, stream);
  393. }
  394. EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream) {
  395. clearError();
  396. egl_connection_t* const cnx = &gEGLImpl;
  397. return cnx->platform.eglStreamConsumerAcquireKHR(dpy, stream);
  398. }
  399. EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream) {
  400. clearError();
  401. egl_connection_t* const cnx = &gEGLImpl;
  402. return cnx->platform.eglStreamConsumerReleaseKHR(dpy, stream);
  403. }
  404. EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream) {
  405. clearError();
  406. egl_connection_t* const cnx = &gEGLImpl;
  407. return cnx->platform.eglGetStreamFileDescriptorKHR(dpy, stream);
  408. }
  409. EGLStreamKHR eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy,
  410. EGLNativeFileDescriptorKHR file_descriptor) {
  411. clearError();
  412. egl_connection_t* const cnx = &gEGLImpl;
  413. return cnx->platform.eglCreateStreamFromFileDescriptorKHR(dpy, file_descriptor);
  414. }
  415. EGLint eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) {
  416. clearError();
  417. egl_connection_t* const cnx = &gEGLImpl;
  418. return cnx->platform.eglWaitSyncKHR(dpy, sync, flags);
  419. }
  420. EGLBoolean eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) {
  421. clearError();
  422. egl_connection_t* const cnx = &gEGLImpl;
  423. return cnx->platform.eglWaitSync(dpy, sync, flags);
  424. }
  425. EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync) {
  426. clearError();
  427. egl_connection_t* const cnx = &gEGLImpl;
  428. return cnx->platform.eglDupNativeFenceFDANDROID(dpy, sync);
  429. }
  430. EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time) {
  431. clearError();
  432. egl_connection_t* const cnx = &gEGLImpl;
  433. return cnx->platform.eglPresentationTimeANDROID(dpy, surface, time);
  434. }
  435. EGLClientBuffer eglGetNativeClientBufferANDROID(const AHardwareBuffer* buffer) {
  436. clearError();
  437. egl_connection_t* const cnx = &gEGLImpl;
  438. return cnx->platform.eglGetNativeClientBufferANDROID(buffer);
  439. }
  440. EGLuint64NV eglGetSystemTimeFrequencyNV() {
  441. clearError();
  442. if (egl_init_drivers() == EGL_FALSE) {
  443. return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
  444. }
  445. egl_connection_t* const cnx = &gEGLImpl;
  446. return cnx->platform.eglGetSystemTimeFrequencyNV();
  447. }
  448. EGLuint64NV eglGetSystemTimeNV() {
  449. clearError();
  450. if (egl_init_drivers() == EGL_FALSE) {
  451. return setError(EGL_BAD_PARAMETER, (EGLuint64NV)EGL_FALSE);
  452. }
  453. egl_connection_t* const cnx = &gEGLImpl;
  454. return cnx->platform.eglGetSystemTimeNV();
  455. }
  456. EGLBoolean eglSetDamageRegionKHR(EGLDisplay dpy, EGLSurface surface, EGLint* rects,
  457. EGLint n_rects) {
  458. clearError();
  459. egl_connection_t* const cnx = &gEGLImpl;
  460. return cnx->platform.eglSetDamageRegionKHR(dpy, surface, rects, n_rects);
  461. }
  462. EGLBoolean eglGetNextFrameIdANDROID(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId) {
  463. clearError();
  464. egl_connection_t* const cnx = &gEGLImpl;
  465. return cnx->platform.eglGetNextFrameIdANDROID(dpy, surface, frameId);
  466. }
  467. EGLBoolean eglGetCompositorTimingANDROID(EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps,
  468. const EGLint* names, EGLnsecsANDROID* values) {
  469. clearError();
  470. egl_connection_t* const cnx = &gEGLImpl;
  471. return cnx->platform.eglGetCompositorTimingANDROID(dpy, surface, numTimestamps, names, values);
  472. }
  473. EGLBoolean eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy, EGLSurface surface, EGLint name) {
  474. clearError();
  475. egl_connection_t* const cnx = &gEGLImpl;
  476. return cnx->platform.eglGetCompositorTimingSupportedANDROID(dpy, surface, name);
  477. }
  478. EGLBoolean eglGetFrameTimestampsANDROID(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId,
  479. EGLint numTimestamps, const EGLint* timestamps,
  480. EGLnsecsANDROID* values) {
  481. clearError();
  482. egl_connection_t* const cnx = &gEGLImpl;
  483. return cnx->platform.eglGetFrameTimestampsANDROID(dpy, surface, frameId, numTimestamps,
  484. timestamps, values);
  485. }
  486. EGLBoolean eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy, EGLSurface surface,
  487. EGLint timestamp) {
  488. clearError();
  489. egl_connection_t* const cnx = &gEGLImpl;
  490. return cnx->platform.eglGetFrameTimestampSupportedANDROID(dpy, surface, timestamp);
  491. }