• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // GENERATED FILE - DO NOT EDIT.
2 // Generated by generate_entry_points.py using data from egl.xml and egl_angle_ext.xml.
3 //
4 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file.
7 //
8 // entry_points_egl_ext_autogen.cpp:
9 //   Defines the EGL Extension entry points.
10 
11 #include "libGLESv2/entry_points_egl_ext_autogen.h"
12 
13 #include "libANGLE/capture/capture_egl_autogen.h"
14 #include "libANGLE/entry_points_utils.h"
15 #include "libANGLE/validationEGL_autogen.h"
16 #include "libGLESv2/egl_context_lock_impl.h"
17 #include "libGLESv2/egl_ext_stubs_autogen.h"
18 #include "libGLESv2/global_state.h"
19 
20 using namespace egl;
21 
22 extern "C" {
23 
24 // EGL_ANDROID_blob_cache
EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,EGLSetBlobFuncANDROID set,EGLGetBlobFuncANDROID get)25 void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
26                                               EGLSetBlobFuncANDROID set,
27                                               EGLGetBlobFuncANDROID get)
28 {
29 
30     Thread *thread = egl::GetCurrentThread();
31     {
32         ANGLE_SCOPED_GLOBAL_LOCK();
33         EGL_EVENT(SetBlobCacheFuncsANDROID,
34                   "dpy = 0x%016" PRIxPTR ", set = 0x%016" PRIxPTR ", get = 0x%016" PRIxPTR "",
35                   (uintptr_t)dpy, (uintptr_t)set, (uintptr_t)get);
36 
37         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
38 
39         {
40             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SetBlobCacheFuncsANDROID, thread, dpyPacked);
41             ANGLE_EGL_VALIDATE_VOID(thread, SetBlobCacheFuncsANDROID, GetDisplayIfValid(dpyPacked),
42                                     dpyPacked, set, get);
43 
44             SetBlobCacheFuncsANDROID(thread, dpyPacked, set, get);
45         }
46 
47         ANGLE_CAPTURE_EGL(SetBlobCacheFuncsANDROID, true, thread, dpyPacked, set, get);
48     }
49     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
50 }
51 
52 // EGL_ANDROID_create_native_client_buffer
EGL_CreateNativeClientBufferANDROID(const EGLint * attrib_list)53 EGLClientBuffer EGLAPIENTRY EGL_CreateNativeClientBufferANDROID(const EGLint *attrib_list)
54 {
55 
56     Thread *thread = egl::GetCurrentThread();
57     EGLClientBuffer returnValue;
58     {
59         ANGLE_SCOPED_GLOBAL_LOCK();
60         EGL_EVENT(CreateNativeClientBufferANDROID, "attrib_list = 0x%016" PRIxPTR "",
61                   (uintptr_t)attrib_list);
62 
63         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
64 
65         {
66             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateNativeClientBufferANDROID, thread);
67             ANGLE_EGL_VALIDATE(thread, CreateNativeClientBufferANDROID, nullptr, EGLClientBuffer,
68                                attrib_listPacked);
69 
70             returnValue = CreateNativeClientBufferANDROID(thread, attrib_listPacked);
71         }
72 
73         ANGLE_CAPTURE_EGL(CreateNativeClientBufferANDROID, true, thread, attrib_listPacked,
74                           returnValue);
75     }
76     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
77     return returnValue;
78 }
79 
80 // EGL_ANDROID_get_frame_timestamps
EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint name)81 EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
82                                                                EGLSurface surface,
83                                                                EGLint name)
84 {
85 
86     Thread *thread = egl::GetCurrentThread();
87     EGLBoolean returnValue;
88     {
89         ANGLE_SCOPED_GLOBAL_LOCK();
90         EGL_EVENT(GetCompositorTimingSupportedANDROID,
91                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", name = %d", (uintptr_t)dpy,
92                   (uintptr_t)surface, name);
93 
94         egl::Display *dpyPacked     = PackParam<egl::Display *>(dpy);
95         SurfaceID surfacePacked     = PackParam<SurfaceID>(surface);
96         CompositorTiming namePacked = PackParam<CompositorTiming>(name);
97 
98         {
99             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCompositorTimingSupportedANDROID, thread, dpyPacked);
100             ANGLE_EGL_VALIDATE(thread, GetCompositorTimingSupportedANDROID,
101                                GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, surfacePacked,
102                                namePacked);
103 
104             returnValue =
105                 GetCompositorTimingSupportedANDROID(thread, dpyPacked, surfacePacked, namePacked);
106         }
107 
108         ANGLE_CAPTURE_EGL(GetCompositorTimingSupportedANDROID, true, thread, dpyPacked,
109                           surfacePacked, namePacked, returnValue);
110     }
111     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
112     return returnValue;
113 }
114 
EGL_GetCompositorTimingANDROID(EGLDisplay dpy,EGLSurface surface,EGLint numTimestamps,const EGLint * names,EGLnsecsANDROID * values)115 EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
116                                                       EGLSurface surface,
117                                                       EGLint numTimestamps,
118                                                       const EGLint *names,
119                                                       EGLnsecsANDROID *values)
120 {
121 
122     Thread *thread = egl::GetCurrentThread();
123     EGLBoolean returnValue;
124     {
125         ANGLE_SCOPED_GLOBAL_LOCK();
126         EGL_EVENT(GetCompositorTimingANDROID,
127                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
128                   ", numTimestamps = %d, names = 0x%016" PRIxPTR ", values = 0x%016" PRIxPTR "",
129                   (uintptr_t)dpy, (uintptr_t)surface, numTimestamps, (uintptr_t)names,
130                   (uintptr_t)values);
131 
132         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
133         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
134 
135         {
136             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetCompositorTimingANDROID, thread, dpyPacked);
137             ANGLE_EGL_VALIDATE(thread, GetCompositorTimingANDROID, GetDisplayIfValid(dpyPacked),
138                                EGLBoolean, dpyPacked, surfacePacked, numTimestamps, names, values);
139 
140             returnValue = GetCompositorTimingANDROID(thread, dpyPacked, surfacePacked,
141                                                      numTimestamps, names, values);
142         }
143 
144         ANGLE_CAPTURE_EGL(GetCompositorTimingANDROID, true, thread, dpyPacked, surfacePacked,
145                           numTimestamps, names, values, returnValue);
146     }
147     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
148     return returnValue;
149 }
150 
EGL_GetNextFrameIdANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * frameId)151 EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
152                                                  EGLSurface surface,
153                                                  EGLuint64KHR *frameId)
154 {
155 
156     Thread *thread = egl::GetCurrentThread();
157     EGLBoolean returnValue;
158     {
159         ANGLE_SCOPED_GLOBAL_LOCK();
160         EGL_EVENT(GetNextFrameIdANDROID,
161                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frameId = 0x%016" PRIxPTR
162                   "",
163                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)frameId);
164 
165         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
166         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
167 
168         {
169             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetNextFrameIdANDROID, thread, dpyPacked);
170             ANGLE_EGL_VALIDATE(thread, GetNextFrameIdANDROID, GetDisplayIfValid(dpyPacked),
171                                EGLBoolean, dpyPacked, surfacePacked, frameId);
172 
173             returnValue = GetNextFrameIdANDROID(thread, dpyPacked, surfacePacked, frameId);
174         }
175 
176         ANGLE_CAPTURE_EGL(GetNextFrameIdANDROID, true, thread, dpyPacked, surfacePacked, frameId,
177                           returnValue);
178     }
179     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
180     return returnValue;
181 }
182 
EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,EGLSurface surface,EGLint timestamp)183 EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
184                                                              EGLSurface surface,
185                                                              EGLint timestamp)
186 {
187 
188     Thread *thread = egl::GetCurrentThread();
189     EGLBoolean returnValue;
190     {
191         ANGLE_SCOPED_GLOBAL_LOCK();
192         EGL_EVENT(GetFrameTimestampSupportedANDROID,
193                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", timestamp = %d",
194                   (uintptr_t)dpy, (uintptr_t)surface, timestamp);
195 
196         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
197         SurfaceID surfacePacked   = PackParam<SurfaceID>(surface);
198         Timestamp timestampPacked = PackParam<Timestamp>(timestamp);
199 
200         {
201             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetFrameTimestampSupportedANDROID, thread, dpyPacked);
202             ANGLE_EGL_VALIDATE(thread, GetFrameTimestampSupportedANDROID,
203                                GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, surfacePacked,
204                                timestampPacked);
205 
206             returnValue = GetFrameTimestampSupportedANDROID(thread, dpyPacked, surfacePacked,
207                                                             timestampPacked);
208         }
209 
210         ANGLE_CAPTURE_EGL(GetFrameTimestampSupportedANDROID, true, thread, dpyPacked, surfacePacked,
211                           timestampPacked, returnValue);
212     }
213     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
214     return returnValue;
215 }
216 
EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR frameId,EGLint numTimestamps,const EGLint * timestamps,EGLnsecsANDROID * values)217 EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
218                                                      EGLSurface surface,
219                                                      EGLuint64KHR frameId,
220                                                      EGLint numTimestamps,
221                                                      const EGLint *timestamps,
222                                                      EGLnsecsANDROID *values)
223 {
224 
225     Thread *thread = egl::GetCurrentThread();
226     EGLBoolean returnValue;
227     {
228         ANGLE_SCOPED_GLOBAL_LOCK();
229         EGL_EVENT(GetFrameTimestampsANDROID,
230                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
231                   ", frameId = %llu, numTimestamps = %d, timestamps = 0x%016" PRIxPTR
232                   ", values = 0x%016" PRIxPTR "",
233                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frameId),
234                   numTimestamps, (uintptr_t)timestamps, (uintptr_t)values);
235 
236         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
237         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
238 
239         {
240             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetFrameTimestampsANDROID, thread, dpyPacked);
241             ANGLE_EGL_VALIDATE(thread, GetFrameTimestampsANDROID, GetDisplayIfValid(dpyPacked),
242                                EGLBoolean, dpyPacked, surfacePacked, frameId, numTimestamps,
243                                timestamps, values);
244 
245             returnValue = GetFrameTimestampsANDROID(thread, dpyPacked, surfacePacked, frameId,
246                                                     numTimestamps, timestamps, values);
247         }
248 
249         ANGLE_CAPTURE_EGL(GetFrameTimestampsANDROID, true, thread, dpyPacked, surfacePacked,
250                           frameId, numTimestamps, timestamps, values, returnValue);
251     }
252     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
253     return returnValue;
254 }
255 
256 // EGL_ANDROID_get_native_client_buffer
EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer * buffer)257 EGLClientBuffer EGLAPIENTRY EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
258 {
259 
260     Thread *thread = egl::GetCurrentThread();
261     EGLClientBuffer returnValue;
262     {
263         ANGLE_SCOPED_GLOBAL_LOCK();
264         EGL_EVENT(GetNativeClientBufferANDROID, "buffer = 0x%016" PRIxPTR "", (uintptr_t)buffer);
265 
266         {
267             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetNativeClientBufferANDROID, thread);
268             ANGLE_EGL_VALIDATE(thread, GetNativeClientBufferANDROID, nullptr, EGLClientBuffer,
269                                buffer);
270 
271             returnValue = GetNativeClientBufferANDROID(thread, buffer);
272         }
273 
274         ANGLE_CAPTURE_EGL(GetNativeClientBufferANDROID, true, thread, buffer, returnValue);
275     }
276     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
277     return returnValue;
278 }
279 
280 // EGL_ANDROID_native_fence_sync
EGL_DupNativeFenceFDANDROID(EGLDisplay dpy,EGLSyncKHR sync)281 EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
282 {
283 
284     Thread *thread = egl::GetCurrentThread();
285     EGLint returnValue;
286     {
287         ANGLE_SCOPED_GLOBAL_LOCK();
288         EGL_EVENT(DupNativeFenceFDANDROID, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
289                   (uintptr_t)dpy, (uintptr_t)sync);
290 
291         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
292         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
293 
294         {
295             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DupNativeFenceFDANDROID, thread, dpyPacked);
296             ANGLE_EGL_VALIDATE(thread, DupNativeFenceFDANDROID, GetDisplayIfValid(dpyPacked),
297                                EGLint, dpyPacked, syncPacked);
298 
299             returnValue = DupNativeFenceFDANDROID(thread, dpyPacked, syncPacked);
300         }
301 
302         ANGLE_CAPTURE_EGL(DupNativeFenceFDANDROID, true, thread, dpyPacked, syncPacked,
303                           returnValue);
304     }
305     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
306     return returnValue;
307 }
308 
309 // EGL_ANDROID_presentation_time
EGL_PresentationTimeANDROID(EGLDisplay dpy,EGLSurface surface,EGLnsecsANDROID time)310 EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
311                                                    EGLSurface surface,
312                                                    EGLnsecsANDROID time)
313 {
314 
315     Thread *thread = egl::GetCurrentThread();
316     EGLBoolean returnValue;
317     {
318         ANGLE_SCOPED_GLOBAL_LOCK();
319         EGL_EVENT(PresentationTimeANDROID,
320                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", time = %llu",
321                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(time));
322 
323         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
324         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
325 
326         {
327             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PresentationTimeANDROID, thread, dpyPacked);
328             ANGLE_EGL_VALIDATE(thread, PresentationTimeANDROID, GetDisplayIfValid(dpyPacked),
329                                EGLBoolean, dpyPacked, surfacePacked, time);
330 
331             returnValue = PresentationTimeANDROID(thread, dpyPacked, surfacePacked, time);
332         }
333 
334         ANGLE_CAPTURE_EGL(PresentationTimeANDROID, true, thread, dpyPacked, surfacePacked, time,
335                           returnValue);
336     }
337     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
338     return returnValue;
339 }
340 
341 // EGL_ANGLE_device_creation
EGL_CreateDeviceANGLE(EGLint device_type,void * native_device,const EGLAttrib * attrib_list)342 EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
343                                                void *native_device,
344                                                const EGLAttrib *attrib_list)
345 {
346 
347     Thread *thread = egl::GetCurrentThread();
348     EGLDeviceEXT returnValue;
349     {
350         ANGLE_SCOPED_GLOBAL_LOCK();
351         EGL_EVENT(CreateDeviceANGLE,
352                   "device_type = %d, native_device = 0x%016" PRIxPTR
353                   ", attrib_list = 0x%016" PRIxPTR "",
354                   device_type, (uintptr_t)native_device, (uintptr_t)attrib_list);
355 
356         {
357             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateDeviceANGLE, thread);
358             ANGLE_EGL_VALIDATE(thread, CreateDeviceANGLE, nullptr, EGLDeviceEXT, device_type,
359                                native_device, attrib_list);
360 
361             returnValue = CreateDeviceANGLE(thread, device_type, native_device, attrib_list);
362         }
363 
364         ANGLE_CAPTURE_EGL(CreateDeviceANGLE, true, thread, device_type, native_device, attrib_list,
365                           returnValue);
366     }
367     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
368     return returnValue;
369 }
370 
EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)371 EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)
372 {
373 
374     Thread *thread = egl::GetCurrentThread();
375     EGLBoolean returnValue;
376     {
377         ANGLE_SCOPED_GLOBAL_LOCK();
378         EGL_EVENT(ReleaseDeviceANGLE, "device = 0x%016" PRIxPTR "", (uintptr_t)device);
379 
380         egl::Device *devicePacked = PackParam<egl::Device *>(device);
381 
382         {
383             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseDeviceANGLE, thread);
384             ANGLE_EGL_VALIDATE(thread, ReleaseDeviceANGLE, nullptr, EGLBoolean, devicePacked);
385 
386             returnValue = ReleaseDeviceANGLE(thread, devicePacked);
387         }
388 
389         ANGLE_CAPTURE_EGL(ReleaseDeviceANGLE, true, thread, devicePacked, returnValue);
390     }
391     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
392     return returnValue;
393 }
394 
395 // EGL_ANGLE_external_context_and_surface
EGL_AcquireExternalContextANGLE(EGLDisplay dpy,EGLSurface drawAndRead)396 void EGLAPIENTRY EGL_AcquireExternalContextANGLE(EGLDisplay dpy, EGLSurface drawAndRead)
397 {
398 
399     Thread *thread = egl::GetCurrentThread();
400     {
401         ANGLE_SCOPED_GLOBAL_LOCK();
402         EGL_EVENT(AcquireExternalContextANGLE,
403                   "dpy = 0x%016" PRIxPTR ", drawAndRead = 0x%016" PRIxPTR "", (uintptr_t)dpy,
404                   (uintptr_t)drawAndRead);
405 
406         egl::Display *dpyPacked     = PackParam<egl::Display *>(dpy);
407         SurfaceID drawAndReadPacked = PackParam<SurfaceID>(drawAndRead);
408 
409         {
410             ANGLE_EGL_SCOPED_CONTEXT_LOCK(AcquireExternalContextANGLE, thread, dpyPacked);
411             ANGLE_EGL_VALIDATE_VOID(thread, AcquireExternalContextANGLE,
412                                     GetDisplayIfValid(dpyPacked), dpyPacked, drawAndReadPacked);
413 
414             AcquireExternalContextANGLE(thread, dpyPacked, drawAndReadPacked);
415         }
416 
417         ANGLE_CAPTURE_EGL(AcquireExternalContextANGLE, true, thread, dpyPacked, drawAndReadPacked);
418     }
419     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
420 }
421 
EGL_ReleaseExternalContextANGLE(EGLDisplay dpy)422 void EGLAPIENTRY EGL_ReleaseExternalContextANGLE(EGLDisplay dpy)
423 {
424 
425     Thread *thread = egl::GetCurrentThread();
426     {
427         ANGLE_SCOPED_GLOBAL_LOCK();
428         EGL_EVENT(ReleaseExternalContextANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
429 
430         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
431 
432         {
433             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseExternalContextANGLE, thread, dpyPacked);
434             ANGLE_EGL_VALIDATE_VOID(thread, ReleaseExternalContextANGLE,
435                                     GetDisplayIfValid(dpyPacked), dpyPacked);
436 
437             ReleaseExternalContextANGLE(thread, dpyPacked);
438         }
439 
440         ANGLE_CAPTURE_EGL(ReleaseExternalContextANGLE, true, thread, dpyPacked);
441     }
442     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
443 }
444 
445 // EGL_ANGLE_feature_control
EGL_QueryStringiANGLE(EGLDisplay dpy,EGLint name,EGLint index)446 const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index)
447 {
448 
449     Thread *thread = egl::GetCurrentThread();
450     const char *returnValue;
451     {
452         ANGLE_SCOPED_GLOBAL_LOCK();
453         EGL_EVENT(QueryStringiANGLE, "dpy = 0x%016" PRIxPTR ", name = %d, index = %d",
454                   (uintptr_t)dpy, name, index);
455 
456         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
457 
458         {
459             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStringiANGLE, thread, dpyPacked);
460             ANGLE_EGL_VALIDATE(thread, QueryStringiANGLE, GetDisplayIfValid(dpyPacked),
461                                const char *, dpyPacked, name, index);
462 
463             returnValue = QueryStringiANGLE(thread, dpyPacked, name, index);
464         }
465 
466         ANGLE_CAPTURE_EGL(QueryStringiANGLE, true, thread, dpyPacked, name, index, returnValue);
467     }
468     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
469     return returnValue;
470 }
471 
EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,EGLint attribute,EGLAttrib * value)472 EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
473                                                    EGLint attribute,
474                                                    EGLAttrib *value)
475 {
476 
477     Thread *thread = egl::GetCurrentThread();
478     EGLBoolean returnValue;
479     {
480         ANGLE_SCOPED_GLOBAL_LOCK();
481         EGL_EVENT(QueryDisplayAttribANGLE,
482                   "dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
483                   (uintptr_t)dpy, attribute, (uintptr_t)value);
484 
485         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
486 
487         {
488             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDisplayAttribANGLE, thread, dpyPacked, attribute);
489             ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribANGLE, GetDisplayIfValid(dpyPacked),
490                                EGLBoolean, dpyPacked, attribute, value);
491 
492             returnValue = QueryDisplayAttribANGLE(thread, dpyPacked, attribute, value);
493         }
494 
495         ANGLE_CAPTURE_EGL(QueryDisplayAttribANGLE, true, thread, dpyPacked, attribute, value,
496                           returnValue);
497     }
498     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
499     return returnValue;
500 }
501 
502 // EGL_ANGLE_metal_shared_event_sync
EGL_CopyMetalSharedEventANGLE(EGLDisplay dpy,EGLSyncKHR sync)503 void *EGLAPIENTRY EGL_CopyMetalSharedEventANGLE(EGLDisplay dpy, EGLSyncKHR sync)
504 {
505 
506     Thread *thread = egl::GetCurrentThread();
507     void *returnValue;
508     {
509         ANGLE_SCOPED_GLOBAL_LOCK();
510         EGL_EVENT(CopyMetalSharedEventANGLE, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
511                   (uintptr_t)dpy, (uintptr_t)sync);
512 
513         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
514         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
515 
516         {
517             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CopyMetalSharedEventANGLE, thread, dpyPacked);
518             ANGLE_EGL_VALIDATE(thread, CopyMetalSharedEventANGLE, GetDisplayIfValid(dpyPacked),
519                                void *, dpyPacked, syncPacked);
520 
521             returnValue = CopyMetalSharedEventANGLE(thread, dpyPacked, syncPacked);
522         }
523 
524         ANGLE_CAPTURE_EGL(CopyMetalSharedEventANGLE, true, thread, dpyPacked, syncPacked,
525                           returnValue);
526     }
527     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
528     return returnValue;
529 }
530 
531 // EGL_ANGLE_power_preference
EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy,EGLContext ctx)532 void EGLAPIENTRY EGL_ReleaseHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
533 {
534 
535     Thread *thread = egl::GetCurrentThread();
536     {
537         ANGLE_SCOPED_GLOBAL_LOCK();
538         EGL_EVENT(ReleaseHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
539                   (uintptr_t)dpy, (uintptr_t)ctx);
540 
541         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
542         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
543 
544         {
545             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReleaseHighPowerGPUANGLE, thread, dpyPacked, ctxPacked);
546             ANGLE_EGL_VALIDATE_VOID(thread, ReleaseHighPowerGPUANGLE, GetDisplayIfValid(dpyPacked),
547                                     dpyPacked, ctxPacked);
548 
549             ReleaseHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
550         }
551 
552         ANGLE_CAPTURE_EGL(ReleaseHighPowerGPUANGLE, true, thread, dpyPacked, ctxPacked);
553     }
554     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
555 }
556 
EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy,EGLContext ctx)557 void EGLAPIENTRY EGL_ReacquireHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx)
558 {
559 
560     Thread *thread = egl::GetCurrentThread();
561     {
562         ANGLE_SCOPED_GLOBAL_LOCK();
563         EGL_EVENT(ReacquireHighPowerGPUANGLE, "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR "",
564                   (uintptr_t)dpy, (uintptr_t)ctx);
565 
566         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
567         gl::ContextID ctxPacked = PackParam<gl::ContextID>(ctx);
568 
569         {
570             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ReacquireHighPowerGPUANGLE, thread, dpyPacked, ctxPacked);
571             ANGLE_EGL_VALIDATE_VOID(thread, ReacquireHighPowerGPUANGLE,
572                                     GetDisplayIfValid(dpyPacked), dpyPacked, ctxPacked);
573 
574             ReacquireHighPowerGPUANGLE(thread, dpyPacked, ctxPacked);
575         }
576 
577         ANGLE_CAPTURE_EGL(ReacquireHighPowerGPUANGLE, true, thread, dpyPacked, ctxPacked);
578     }
579     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
580 }
581 
EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)582 void EGLAPIENTRY EGL_HandleGPUSwitchANGLE(EGLDisplay dpy)
583 {
584 
585     Thread *thread = egl::GetCurrentThread();
586     {
587         ANGLE_SCOPED_GLOBAL_LOCK();
588         EGL_EVENT(HandleGPUSwitchANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
589 
590         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
591 
592         {
593             ANGLE_EGL_SCOPED_CONTEXT_LOCK(HandleGPUSwitchANGLE, thread, dpyPacked);
594             ANGLE_EGL_VALIDATE_VOID(thread, HandleGPUSwitchANGLE, GetDisplayIfValid(dpyPacked),
595                                     dpyPacked);
596 
597             HandleGPUSwitchANGLE(thread, dpyPacked);
598         }
599 
600         ANGLE_CAPTURE_EGL(HandleGPUSwitchANGLE, true, thread, dpyPacked);
601     }
602     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
603 }
604 
EGL_ForceGPUSwitchANGLE(EGLDisplay dpy,EGLint gpuIDHigh,EGLint gpuIDLow)605 void EGLAPIENTRY EGL_ForceGPUSwitchANGLE(EGLDisplay dpy, EGLint gpuIDHigh, EGLint gpuIDLow)
606 {
607 
608     Thread *thread = egl::GetCurrentThread();
609     {
610         ANGLE_SCOPED_GLOBAL_LOCK();
611         EGL_EVENT(ForceGPUSwitchANGLE, "dpy = 0x%016" PRIxPTR ", gpuIDHigh = %d, gpuIDLow = %d",
612                   (uintptr_t)dpy, gpuIDHigh, gpuIDLow);
613 
614         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
615 
616         {
617             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ForceGPUSwitchANGLE, thread, dpyPacked);
618             ANGLE_EGL_VALIDATE_VOID(thread, ForceGPUSwitchANGLE, GetDisplayIfValid(dpyPacked),
619                                     dpyPacked, gpuIDHigh, gpuIDLow);
620 
621             ForceGPUSwitchANGLE(thread, dpyPacked, gpuIDHigh, gpuIDLow);
622         }
623 
624         ANGLE_CAPTURE_EGL(ForceGPUSwitchANGLE, true, thread, dpyPacked, gpuIDHigh, gpuIDLow);
625     }
626     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
627 }
628 
629 // EGL_ANGLE_prepare_swap_buffers
EGL_PrepareSwapBuffersANGLE(EGLDisplay dpy,EGLSurface surface)630 EGLBoolean EGLAPIENTRY EGL_PrepareSwapBuffersANGLE(EGLDisplay dpy, EGLSurface surface)
631 {
632 
633     Thread *thread = egl::GetCurrentThread();
634     EGLBoolean returnValue;
635     {
636         ANGLE_SCOPED_GLOBAL_LOCK();
637         EGL_EVENT(PrepareSwapBuffersANGLE, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
638                   (uintptr_t)dpy, (uintptr_t)surface);
639 
640         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
641         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
642 
643         {
644             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PrepareSwapBuffersANGLE, thread, dpyPacked);
645             ANGLE_EGL_VALIDATE(thread, PrepareSwapBuffersANGLE, GetDisplayIfValid(dpyPacked),
646                                EGLBoolean, dpyPacked, surfacePacked);
647 
648             returnValue = PrepareSwapBuffersANGLE(thread, dpyPacked, surfacePacked);
649         }
650 
651         ANGLE_CAPTURE_EGL(PrepareSwapBuffersANGLE, true, thread, dpyPacked, surfacePacked,
652                           returnValue);
653     }
654     egl::Display::GetCurrentThreadUnlockedTailCall()->run();
655     return returnValue;
656 }
657 
658 // EGL_ANGLE_program_cache_control
EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy,EGLenum attrib)659 EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
660 {
661 
662     Thread *thread = egl::GetCurrentThread();
663     EGLint returnValue;
664     {
665         ANGLE_SCOPED_GLOBAL_LOCK();
666         EGL_EVENT(ProgramCacheGetAttribANGLE, "dpy = 0x%016" PRIxPTR ", attrib = 0x%X",
667                   (uintptr_t)dpy, attrib);
668 
669         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
670 
671         {
672             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheGetAttribANGLE, thread, dpyPacked);
673             ANGLE_EGL_VALIDATE(thread, ProgramCacheGetAttribANGLE, GetDisplayIfValid(dpyPacked),
674                                EGLint, dpyPacked, attrib);
675 
676             returnValue = ProgramCacheGetAttribANGLE(thread, dpyPacked, attrib);
677         }
678 
679         ANGLE_CAPTURE_EGL(ProgramCacheGetAttribANGLE, true, thread, dpyPacked, attrib, returnValue);
680     }
681     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
682     return returnValue;
683 }
684 
EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,EGLint index,void * key,EGLint * keysize,void * binary,EGLint * binarysize)685 void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
686                                             EGLint index,
687                                             void *key,
688                                             EGLint *keysize,
689                                             void *binary,
690                                             EGLint *binarysize)
691 {
692 
693     Thread *thread = egl::GetCurrentThread();
694     {
695         ANGLE_SCOPED_GLOBAL_LOCK();
696         EGL_EVENT(ProgramCacheQueryANGLE,
697                   "dpy = 0x%016" PRIxPTR ", index = %d, key = 0x%016" PRIxPTR
698                   ", keysize = 0x%016" PRIxPTR ", binary = 0x%016" PRIxPTR
699                   ", binarysize = 0x%016" PRIxPTR "",
700                   (uintptr_t)dpy, index, (uintptr_t)key, (uintptr_t)keysize, (uintptr_t)binary,
701                   (uintptr_t)binarysize);
702 
703         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
704 
705         {
706             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheQueryANGLE, thread, dpyPacked);
707             ANGLE_EGL_VALIDATE_VOID(thread, ProgramCacheQueryANGLE, GetDisplayIfValid(dpyPacked),
708                                     dpyPacked, index, key, keysize, binary, binarysize);
709 
710             ProgramCacheQueryANGLE(thread, dpyPacked, index, key, keysize, binary, binarysize);
711         }
712 
713         ANGLE_CAPTURE_EGL(ProgramCacheQueryANGLE, true, thread, dpyPacked, index, key, keysize,
714                           binary, binarysize);
715     }
716     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
717 }
718 
EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,const void * key,EGLint keysize,const void * binary,EGLint binarysize)719 void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
720                                                const void *key,
721                                                EGLint keysize,
722                                                const void *binary,
723                                                EGLint binarysize)
724 {
725 
726     Thread *thread = egl::GetCurrentThread();
727     {
728         ANGLE_SCOPED_GLOBAL_LOCK();
729         EGL_EVENT(ProgramCachePopulateANGLE,
730                   "dpy = 0x%016" PRIxPTR ", key = 0x%016" PRIxPTR
731                   ", keysize = %d, binary = 0x%016" PRIxPTR ", binarysize = %d",
732                   (uintptr_t)dpy, (uintptr_t)key, keysize, (uintptr_t)binary, binarysize);
733 
734         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
735 
736         {
737             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCachePopulateANGLE, thread, dpyPacked);
738             ANGLE_EGL_VALIDATE_VOID(thread, ProgramCachePopulateANGLE, GetDisplayIfValid(dpyPacked),
739                                     dpyPacked, key, keysize, binary, binarysize);
740 
741             ProgramCachePopulateANGLE(thread, dpyPacked, key, keysize, binary, binarysize);
742         }
743 
744         ANGLE_CAPTURE_EGL(ProgramCachePopulateANGLE, true, thread, dpyPacked, key, keysize, binary,
745                           binarysize);
746     }
747     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
748 }
749 
EGL_ProgramCacheResizeANGLE(EGLDisplay dpy,EGLint limit,EGLint mode)750 EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLint mode)
751 {
752 
753     Thread *thread = egl::GetCurrentThread();
754     EGLint returnValue;
755     {
756         ANGLE_SCOPED_GLOBAL_LOCK();
757         EGL_EVENT(ProgramCacheResizeANGLE, "dpy = 0x%016" PRIxPTR ", limit = %d, mode = %d",
758                   (uintptr_t)dpy, limit, mode);
759 
760         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
761 
762         {
763             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ProgramCacheResizeANGLE, thread, dpyPacked);
764             ANGLE_EGL_VALIDATE(thread, ProgramCacheResizeANGLE, GetDisplayIfValid(dpyPacked),
765                                EGLint, dpyPacked, limit, mode);
766 
767             returnValue = ProgramCacheResizeANGLE(thread, dpyPacked, limit, mode);
768         }
769 
770         ANGLE_CAPTURE_EGL(ProgramCacheResizeANGLE, true, thread, dpyPacked, limit, mode,
771                           returnValue);
772     }
773     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
774     return returnValue;
775 }
776 
777 // EGL_ANGLE_query_surface_pointer
EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,EGLSurface surface,EGLint attribute,void ** value)778 EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
779                                                     EGLSurface surface,
780                                                     EGLint attribute,
781                                                     void **value)
782 {
783 
784     Thread *thread = egl::GetCurrentThread();
785     EGLBoolean returnValue;
786     {
787         ANGLE_SCOPED_GLOBAL_LOCK();
788         EGL_EVENT(QuerySurfacePointerANGLE,
789                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
790                   ", attribute = %d, value = 0x%016" PRIxPTR "",
791                   (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
792 
793         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
794         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
795 
796         {
797             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QuerySurfacePointerANGLE, thread, dpyPacked, attribute);
798             ANGLE_EGL_VALIDATE(thread, QuerySurfacePointerANGLE, GetDisplayIfValid(dpyPacked),
799                                EGLBoolean, dpyPacked, surfacePacked, attribute, value);
800 
801             returnValue =
802                 QuerySurfacePointerANGLE(thread, dpyPacked, surfacePacked, attribute, value);
803         }
804 
805         ANGLE_CAPTURE_EGL(QuerySurfacePointerANGLE, true, thread, dpyPacked, surfacePacked,
806                           attribute, value, returnValue);
807     }
808     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
809     return returnValue;
810 }
811 
812 // EGL_ANGLE_stream_producer_d3d_texture
EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,EGLStreamKHR stream,const EGLAttrib * attrib_list)813 EGLBoolean EGLAPIENTRY EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
814                                                                EGLStreamKHR stream,
815                                                                const EGLAttrib *attrib_list)
816 {
817 
818     Thread *thread = egl::GetCurrentThread();
819     EGLBoolean returnValue;
820     {
821         ANGLE_SCOPED_GLOBAL_LOCK();
822         EGL_EVENT(CreateStreamProducerD3DTextureANGLE,
823                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
824                   ", attrib_list = 0x%016" PRIxPTR "",
825                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
826 
827         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
828         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
829         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
830 
831         {
832             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateStreamProducerD3DTextureANGLE, thread, dpyPacked);
833             ANGLE_EGL_VALIDATE(thread, CreateStreamProducerD3DTextureANGLE,
834                                GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, streamPacked,
835                                attrib_listPacked);
836 
837             returnValue = CreateStreamProducerD3DTextureANGLE(thread, dpyPacked, streamPacked,
838                                                               attrib_listPacked);
839         }
840 
841         ANGLE_CAPTURE_EGL(CreateStreamProducerD3DTextureANGLE, true, thread, dpyPacked,
842                           streamPacked, attrib_listPacked, returnValue);
843     }
844     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
845     return returnValue;
846 }
847 
EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,EGLStreamKHR stream,void * texture,const EGLAttrib * attrib_list)848 EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
849                                                      EGLStreamKHR stream,
850                                                      void *texture,
851                                                      const EGLAttrib *attrib_list)
852 {
853 
854     Thread *thread = egl::GetCurrentThread();
855     EGLBoolean returnValue;
856     {
857         ANGLE_SCOPED_GLOBAL_LOCK();
858         EGL_EVENT(StreamPostD3DTextureANGLE,
859                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR ", texture = 0x%016" PRIxPTR
860                   ", attrib_list = 0x%016" PRIxPTR "",
861                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)texture, (uintptr_t)attrib_list);
862 
863         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
864         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
865         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
866 
867         {
868             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamPostD3DTextureANGLE, thread, dpyPacked);
869             ANGLE_EGL_VALIDATE(thread, StreamPostD3DTextureANGLE, GetDisplayIfValid(dpyPacked),
870                                EGLBoolean, dpyPacked, streamPacked, texture, attrib_listPacked);
871 
872             returnValue = StreamPostD3DTextureANGLE(thread, dpyPacked, streamPacked, texture,
873                                                     attrib_listPacked);
874         }
875 
876         ANGLE_CAPTURE_EGL(StreamPostD3DTextureANGLE, true, thread, dpyPacked, streamPacked, texture,
877                           attrib_listPacked, returnValue);
878     }
879     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
880     return returnValue;
881 }
882 
883 // EGL_ANGLE_swap_with_frame_token
EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,EGLSurface surface,EGLFrameTokenANGLE frametoken)884 EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithFrameTokenANGLE(EGLDisplay dpy,
885                                                           EGLSurface surface,
886                                                           EGLFrameTokenANGLE frametoken)
887 {
888     ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
889     Thread *thread = egl::GetCurrentThread();
890     EGLBoolean returnValue;
891     {
892         ANGLE_SCOPED_GLOBAL_LOCK();
893         EGL_EVENT(SwapBuffersWithFrameTokenANGLE,
894                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", frametoken = 0x%llX",
895                   (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(frametoken));
896 
897         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
898         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
899 
900         {
901             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapBuffersWithFrameTokenANGLE, thread, dpyPacked);
902             ANGLE_EGL_VALIDATE(thread, SwapBuffersWithFrameTokenANGLE, GetDisplayIfValid(dpyPacked),
903                                EGLBoolean, dpyPacked, surfacePacked, frametoken);
904 
905             returnValue =
906                 SwapBuffersWithFrameTokenANGLE(thread, dpyPacked, surfacePacked, frametoken);
907         }
908 
909         ANGLE_CAPTURE_EGL(SwapBuffersWithFrameTokenANGLE, true, thread, dpyPacked, surfacePacked,
910                           frametoken, returnValue);
911     }
912     egl::Display::GetCurrentThreadUnlockedTailCall()->run();
913     return returnValue;
914 }
915 
916 // EGL_ANGLE_sync_control_rate
EGL_GetMscRateANGLE(EGLDisplay dpy,EGLSurface surface,EGLint * numerator,EGLint * denominator)917 EGLBoolean EGLAPIENTRY EGL_GetMscRateANGLE(EGLDisplay dpy,
918                                            EGLSurface surface,
919                                            EGLint *numerator,
920                                            EGLint *denominator)
921 {
922 
923     Thread *thread = egl::GetCurrentThread();
924     EGLBoolean returnValue;
925     {
926         ANGLE_SCOPED_GLOBAL_LOCK();
927         EGL_EVENT(GetMscRateANGLE,
928                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", numerator = 0x%016" PRIxPTR
929                   ", denominator = 0x%016" PRIxPTR "",
930                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)numerator, (uintptr_t)denominator);
931 
932         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
933         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
934 
935         {
936             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetMscRateANGLE, thread, dpyPacked);
937             ANGLE_EGL_VALIDATE(thread, GetMscRateANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean,
938                                dpyPacked, surfacePacked, numerator, denominator);
939 
940             returnValue = GetMscRateANGLE(thread, dpyPacked, surfacePacked, numerator, denominator);
941         }
942 
943         ANGLE_CAPTURE_EGL(GetMscRateANGLE, true, thread, dpyPacked, surfacePacked, numerator,
944                           denominator, returnValue);
945     }
946     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
947     return returnValue;
948 }
949 
950 // EGL_ANGLE_vulkan_image
EGL_ExportVkImageANGLE(EGLDisplay dpy,EGLImage image,void * vk_image,void * vk_image_create_info)951 EGLBoolean EGLAPIENTRY EGL_ExportVkImageANGLE(EGLDisplay dpy,
952                                               EGLImage image,
953                                               void *vk_image,
954                                               void *vk_image_create_info)
955 {
956 
957     Thread *thread = egl::GetCurrentThread();
958     EGLBoolean returnValue;
959     {
960         ANGLE_SCOPED_GLOBAL_LOCK();
961         EGL_EVENT(ExportVkImageANGLE,
962                   "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR ", vk_image = 0x%016" PRIxPTR
963                   ", vk_image_create_info = 0x%016" PRIxPTR "",
964                   (uintptr_t)dpy, (uintptr_t)image, (uintptr_t)vk_image,
965                   (uintptr_t)vk_image_create_info);
966 
967         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
968         ImageID imagePacked     = PackParam<ImageID>(image);
969 
970         {
971             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ExportVkImageANGLE, thread, dpyPacked);
972             ANGLE_EGL_VALIDATE(thread, ExportVkImageANGLE, GetDisplayIfValid(dpyPacked), EGLBoolean,
973                                dpyPacked, imagePacked, vk_image, vk_image_create_info);
974 
975             returnValue =
976                 ExportVkImageANGLE(thread, dpyPacked, imagePacked, vk_image, vk_image_create_info);
977         }
978 
979         ANGLE_CAPTURE_EGL(ExportVkImageANGLE, true, thread, dpyPacked, imagePacked, vk_image,
980                           vk_image_create_info, returnValue);
981     }
982     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
983     return returnValue;
984 }
985 
986 // EGL_ANGLE_wait_until_work_scheduled
EGL_WaitUntilWorkScheduledANGLE(EGLDisplay dpy)987 void EGLAPIENTRY EGL_WaitUntilWorkScheduledANGLE(EGLDisplay dpy)
988 {
989 
990     Thread *thread = egl::GetCurrentThread();
991     {
992         ANGLE_SCOPED_GLOBAL_LOCK();
993         EGL_EVENT(WaitUntilWorkScheduledANGLE, "dpy = 0x%016" PRIxPTR "", (uintptr_t)dpy);
994 
995         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
996 
997         {
998             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitUntilWorkScheduledANGLE, thread, dpyPacked);
999             ANGLE_EGL_VALIDATE_VOID(thread, WaitUntilWorkScheduledANGLE,
1000                                     GetDisplayIfValid(dpyPacked), dpyPacked);
1001 
1002             WaitUntilWorkScheduledANGLE(thread, dpyPacked);
1003         }
1004 
1005         ANGLE_CAPTURE_EGL(WaitUntilWorkScheduledANGLE, true, thread, dpyPacked);
1006     }
1007     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1008 }
1009 
1010 // EGL_CHROMIUM_sync_control
EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,EGLSurface surface,EGLuint64KHR * ust,EGLuint64KHR * msc,EGLuint64KHR * sbc)1011 EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
1012                                                  EGLSurface surface,
1013                                                  EGLuint64KHR *ust,
1014                                                  EGLuint64KHR *msc,
1015                                                  EGLuint64KHR *sbc)
1016 {
1017 
1018     Thread *thread = egl::GetCurrentThread();
1019     EGLBoolean returnValue;
1020     {
1021         ANGLE_SCOPED_GLOBAL_LOCK();
1022         EGL_EVENT(GetSyncValuesCHROMIUM,
1023                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", ust = 0x%016" PRIxPTR
1024                   ", msc = 0x%016" PRIxPTR ", sbc = 0x%016" PRIxPTR "",
1025                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)ust, (uintptr_t)msc,
1026                   (uintptr_t)sbc);
1027 
1028         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1029         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1030 
1031         {
1032             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetSyncValuesCHROMIUM, thread, dpyPacked);
1033             ANGLE_EGL_VALIDATE(thread, GetSyncValuesCHROMIUM, GetDisplayIfValid(dpyPacked),
1034                                EGLBoolean, dpyPacked, surfacePacked, ust, msc, sbc);
1035 
1036             returnValue = GetSyncValuesCHROMIUM(thread, dpyPacked, surfacePacked, ust, msc, sbc);
1037         }
1038 
1039         ANGLE_CAPTURE_EGL(GetSyncValuesCHROMIUM, true, thread, dpyPacked, surfacePacked, ust, msc,
1040                           sbc, returnValue);
1041     }
1042     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1043     return returnValue;
1044 }
1045 
1046 // EGL_EXT_device_query
EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,EGLint attribute,EGLAttrib * value)1047 EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
1048                                                 EGLint attribute,
1049                                                 EGLAttrib *value)
1050 {
1051 
1052     Thread *thread = egl::GetCurrentThread();
1053     EGLBoolean returnValue;
1054     {
1055         ANGLE_SCOPED_GLOBAL_LOCK();
1056         EGL_EVENT(QueryDeviceAttribEXT,
1057                   "device = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
1058                   (uintptr_t)device, attribute, (uintptr_t)value);
1059 
1060         egl::Device *devicePacked = PackParam<egl::Device *>(device);
1061 
1062         {
1063             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDeviceAttribEXT, thread, attribute);
1064             ANGLE_EGL_VALIDATE(thread, QueryDeviceAttribEXT, nullptr, EGLBoolean, devicePacked,
1065                                attribute, value);
1066 
1067             returnValue = QueryDeviceAttribEXT(thread, devicePacked, attribute, value);
1068         }
1069 
1070         ANGLE_CAPTURE_EGL(QueryDeviceAttribEXT, true, thread, devicePacked, attribute, value,
1071                           returnValue);
1072     }
1073     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1074     return returnValue;
1075 }
1076 
EGL_QueryDeviceStringEXT(EGLDeviceEXT device,EGLint name)1077 const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
1078 {
1079 
1080     Thread *thread = egl::GetCurrentThread();
1081     const char *returnValue;
1082     {
1083         ANGLE_SCOPED_GLOBAL_LOCK();
1084         EGL_EVENT(QueryDeviceStringEXT, "device = 0x%016" PRIxPTR ", name = %d", (uintptr_t)device,
1085                   name);
1086 
1087         egl::Device *devicePacked = PackParam<egl::Device *>(device);
1088 
1089         {
1090             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDeviceStringEXT, thread);
1091             ANGLE_EGL_VALIDATE(thread, QueryDeviceStringEXT, nullptr, const char *, devicePacked,
1092                                name);
1093 
1094             returnValue = QueryDeviceStringEXT(thread, devicePacked, name);
1095         }
1096 
1097         ANGLE_CAPTURE_EGL(QueryDeviceStringEXT, true, thread, devicePacked, name, returnValue);
1098     }
1099     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1100     return returnValue;
1101 }
1102 
EGL_QueryDisplayAttribEXT(EGLDisplay dpy,EGLint attribute,EGLAttrib * value)1103 EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
1104 {
1105 
1106     Thread *thread = egl::GetCurrentThread();
1107     EGLBoolean returnValue;
1108     {
1109         ANGLE_SCOPED_GLOBAL_LOCK();
1110         EGL_EVENT(QueryDisplayAttribEXT,
1111                   "dpy = 0x%016" PRIxPTR ", attribute = %d, value = 0x%016" PRIxPTR "",
1112                   (uintptr_t)dpy, attribute, (uintptr_t)value);
1113 
1114         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1115 
1116         {
1117             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDisplayAttribEXT, thread, dpyPacked, attribute);
1118             ANGLE_EGL_VALIDATE(thread, QueryDisplayAttribEXT, GetDisplayIfValid(dpyPacked),
1119                                EGLBoolean, dpyPacked, attribute, value);
1120 
1121             returnValue = QueryDisplayAttribEXT(thread, dpyPacked, attribute, value);
1122         }
1123 
1124         ANGLE_CAPTURE_EGL(QueryDisplayAttribEXT, true, thread, dpyPacked, attribute, value,
1125                           returnValue);
1126     }
1127     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1128     return returnValue;
1129 }
1130 
1131 // EGL_EXT_image_dma_buf_import_modifiers
EGL_QueryDmaBufFormatsEXT(EGLDisplay dpy,EGLint max_formats,EGLint * formats,EGLint * num_formats)1132 EGLBoolean EGLAPIENTRY EGL_QueryDmaBufFormatsEXT(EGLDisplay dpy,
1133                                                  EGLint max_formats,
1134                                                  EGLint *formats,
1135                                                  EGLint *num_formats)
1136 {
1137 
1138     Thread *thread = egl::GetCurrentThread();
1139     EGLBoolean returnValue;
1140     {
1141         ANGLE_SCOPED_GLOBAL_LOCK();
1142         EGL_EVENT(QueryDmaBufFormatsEXT,
1143                   "dpy = 0x%016" PRIxPTR ", max_formats = %d, formats = 0x%016" PRIxPTR
1144                   ", num_formats = 0x%016" PRIxPTR "",
1145                   (uintptr_t)dpy, max_formats, (uintptr_t)formats, (uintptr_t)num_formats);
1146 
1147         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1148 
1149         {
1150             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDmaBufFormatsEXT, thread, dpyPacked);
1151             ANGLE_EGL_VALIDATE(thread, QueryDmaBufFormatsEXT, GetDisplayIfValid(dpyPacked),
1152                                EGLBoolean, dpyPacked, max_formats, formats, num_formats);
1153 
1154             returnValue =
1155                 QueryDmaBufFormatsEXT(thread, dpyPacked, max_formats, formats, num_formats);
1156         }
1157 
1158         ANGLE_CAPTURE_EGL(QueryDmaBufFormatsEXT, true, thread, dpyPacked, max_formats, formats,
1159                           num_formats, returnValue);
1160     }
1161     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1162     return returnValue;
1163 }
1164 
EGL_QueryDmaBufModifiersEXT(EGLDisplay dpy,EGLint format,EGLint max_modifiers,EGLuint64KHR * modifiers,EGLBoolean * external_only,EGLint * num_modifiers)1165 EGLBoolean EGLAPIENTRY EGL_QueryDmaBufModifiersEXT(EGLDisplay dpy,
1166                                                    EGLint format,
1167                                                    EGLint max_modifiers,
1168                                                    EGLuint64KHR *modifiers,
1169                                                    EGLBoolean *external_only,
1170                                                    EGLint *num_modifiers)
1171 {
1172 
1173     Thread *thread = egl::GetCurrentThread();
1174     EGLBoolean returnValue;
1175     {
1176         ANGLE_SCOPED_GLOBAL_LOCK();
1177         EGL_EVENT(QueryDmaBufModifiersEXT,
1178                   "dpy = 0x%016" PRIxPTR
1179                   ", format = %d, max_modifiers = %d, modifiers = 0x%016" PRIxPTR
1180                   ", external_only = 0x%016" PRIxPTR ", num_modifiers = 0x%016" PRIxPTR "",
1181                   (uintptr_t)dpy, format, max_modifiers, (uintptr_t)modifiers,
1182                   (uintptr_t)external_only, (uintptr_t)num_modifiers);
1183 
1184         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1185 
1186         {
1187             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDmaBufModifiersEXT, thread, dpyPacked);
1188             ANGLE_EGL_VALIDATE(thread, QueryDmaBufModifiersEXT, GetDisplayIfValid(dpyPacked),
1189                                EGLBoolean, dpyPacked, format, max_modifiers, modifiers,
1190                                external_only, num_modifiers);
1191 
1192             returnValue = QueryDmaBufModifiersEXT(thread, dpyPacked, format, max_modifiers,
1193                                                   modifiers, external_only, num_modifiers);
1194         }
1195 
1196         ANGLE_CAPTURE_EGL(QueryDmaBufModifiersEXT, true, thread, dpyPacked, format, max_modifiers,
1197                           modifiers, external_only, num_modifiers, returnValue);
1198     }
1199     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1200     return returnValue;
1201 }
1202 
1203 // EGL_EXT_platform_base
EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,EGLConfig config,void * native_pixmap,const EGLint * attrib_list)1204 EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
1205                                                           EGLConfig config,
1206                                                           void *native_pixmap,
1207                                                           const EGLint *attrib_list)
1208 {
1209 
1210     Thread *thread = egl::GetCurrentThread();
1211     EGLSurface returnValue;
1212     {
1213         ANGLE_SCOPED_GLOBAL_LOCK();
1214         EGL_EVENT(CreatePlatformPixmapSurfaceEXT,
1215                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1216                   ", native_pixmap = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1217                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap,
1218                   (uintptr_t)attrib_list);
1219 
1220         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1221         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1222         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1223 
1224         {
1225             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformPixmapSurfaceEXT, thread, dpyPacked);
1226             ANGLE_EGL_VALIDATE(thread, CreatePlatformPixmapSurfaceEXT, GetDisplayIfValid(dpyPacked),
1227                                EGLSurface, dpyPacked, configPacked, native_pixmap,
1228                                attrib_listPacked);
1229 
1230             returnValue = CreatePlatformPixmapSurfaceEXT(thread, dpyPacked, configPacked,
1231                                                          native_pixmap, attrib_listPacked);
1232         }
1233 
1234         ANGLE_CAPTURE_EGL(CreatePlatformPixmapSurfaceEXT, true, thread, dpyPacked, configPacked,
1235                           native_pixmap, attrib_listPacked, returnValue);
1236     }
1237     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1238     return returnValue;
1239 }
1240 
EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,EGLConfig config,void * native_window,const EGLint * attrib_list)1241 EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
1242                                                           EGLConfig config,
1243                                                           void *native_window,
1244                                                           const EGLint *attrib_list)
1245 {
1246 
1247     Thread *thread = egl::GetCurrentThread();
1248     EGLSurface returnValue;
1249     {
1250         ANGLE_SCOPED_GLOBAL_LOCK();
1251         EGL_EVENT(CreatePlatformWindowSurfaceEXT,
1252                   "dpy = 0x%016" PRIxPTR ", config = 0x%016" PRIxPTR
1253                   ", native_window = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1254                   (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window,
1255                   (uintptr_t)attrib_list);
1256 
1257         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1258         egl::Config *configPacked             = PackParam<egl::Config *>(config);
1259         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1260 
1261         {
1262             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreatePlatformWindowSurfaceEXT, thread, dpyPacked);
1263             ANGLE_EGL_VALIDATE(thread, CreatePlatformWindowSurfaceEXT, GetDisplayIfValid(dpyPacked),
1264                                EGLSurface, dpyPacked, configPacked, native_window,
1265                                attrib_listPacked);
1266 
1267             returnValue = CreatePlatformWindowSurfaceEXT(thread, dpyPacked, configPacked,
1268                                                          native_window, attrib_listPacked);
1269         }
1270 
1271         ANGLE_CAPTURE_EGL(CreatePlatformWindowSurfaceEXT, true, thread, dpyPacked, configPacked,
1272                           native_window, attrib_listPacked, returnValue);
1273     }
1274     egl::Display::GetCurrentThreadUnlockedTailCall()->run();
1275     return returnValue;
1276 }
1277 
EGL_GetPlatformDisplayEXT(EGLenum platform,void * native_display,const EGLint * attrib_list)1278 EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
1279                                                  void *native_display,
1280                                                  const EGLint *attrib_list)
1281 {
1282 
1283     Thread *thread = egl::GetCurrentThread();
1284     EGLDisplay returnValue;
1285     {
1286         ANGLE_SCOPED_GLOBAL_LOCK();
1287         EGL_EVENT(GetPlatformDisplayEXT,
1288                   "platform = 0x%X, native_display = 0x%016" PRIxPTR
1289                   ", attrib_list = 0x%016" PRIxPTR "",
1290                   platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
1291 
1292         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1293 
1294         {
1295             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetPlatformDisplayEXT, thread);
1296             ANGLE_EGL_VALIDATE(thread, GetPlatformDisplayEXT, nullptr, EGLDisplay, platform,
1297                                native_display, attrib_listPacked);
1298 
1299             returnValue =
1300                 GetPlatformDisplayEXT(thread, platform, native_display, attrib_listPacked);
1301         }
1302 
1303         ANGLE_CAPTURE_EGL(GetPlatformDisplayEXT, true, thread, platform, native_display,
1304                           attrib_listPacked, returnValue);
1305     }
1306     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1307     return returnValue;
1308 }
1309 
1310 // EGL_KHR_debug
EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,const EGLAttrib * attrib_list)1311 EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
1312                                               const EGLAttrib *attrib_list)
1313 {
1314 
1315     Thread *thread = egl::GetCurrentThread();
1316     EGLint returnValue;
1317     {
1318         ANGLE_SCOPED_GLOBAL_LOCK();
1319         EGL_EVENT(DebugMessageControlKHR,
1320                   "callback = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1321                   (uintptr_t)callback, (uintptr_t)attrib_list);
1322 
1323         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1324 
1325         {
1326             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DebugMessageControlKHR, thread);
1327             ANGLE_EGL_VALIDATE(thread, DebugMessageControlKHR, nullptr, EGLint, callback,
1328                                attrib_listPacked);
1329 
1330             returnValue = DebugMessageControlKHR(thread, callback, attrib_listPacked);
1331         }
1332 
1333         ANGLE_CAPTURE_EGL(DebugMessageControlKHR, true, thread, callback, attrib_listPacked,
1334                           returnValue);
1335     }
1336     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1337     return returnValue;
1338 }
1339 
EGL_LabelObjectKHR(EGLDisplay display,EGLenum objectType,EGLObjectKHR object,EGLLabelKHR label)1340 EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay display,
1341                                       EGLenum objectType,
1342                                       EGLObjectKHR object,
1343                                       EGLLabelKHR label)
1344 {
1345 
1346     Thread *thread = egl::GetCurrentThread();
1347     EGLint returnValue;
1348     {
1349         ANGLE_SCOPED_GLOBAL_LOCK();
1350         EGL_EVENT(LabelObjectKHR,
1351                   "display = 0x%016" PRIxPTR ", objectType = 0x%X, object = 0x%016" PRIxPTR
1352                   ", label = 0x%016" PRIxPTR "",
1353                   (uintptr_t)display, objectType, (uintptr_t)object, (uintptr_t)label);
1354 
1355         egl::Display *displayPacked = PackParam<egl::Display *>(display);
1356         ObjectType objectTypePacked = PackParam<ObjectType>(objectType);
1357 
1358         {
1359             ANGLE_EGL_SCOPED_CONTEXT_LOCK(LabelObjectKHR, thread, displayPacked);
1360             ANGLE_EGL_VALIDATE(thread, LabelObjectKHR, GetDisplayIfValid(displayPacked), EGLint,
1361                                displayPacked, objectTypePacked, object, label);
1362 
1363             returnValue = LabelObjectKHR(thread, displayPacked, objectTypePacked, object, label);
1364         }
1365 
1366         ANGLE_CAPTURE_EGL(LabelObjectKHR, true, thread, displayPacked, objectTypePacked, object,
1367                           label, returnValue);
1368     }
1369     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1370     return returnValue;
1371 }
1372 
EGL_QueryDebugKHR(EGLint attribute,EGLAttrib * value)1373 EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value)
1374 {
1375 
1376     Thread *thread = egl::GetCurrentThread();
1377     EGLBoolean returnValue;
1378     {
1379         ANGLE_SCOPED_GLOBAL_LOCK();
1380         EGL_EVENT(QueryDebugKHR, "attribute = %d, value = 0x%016" PRIxPTR "", attribute,
1381                   (uintptr_t)value);
1382 
1383         {
1384             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryDebugKHR, thread, attribute);
1385             ANGLE_EGL_VALIDATE(thread, QueryDebugKHR, nullptr, EGLBoolean, attribute, value);
1386 
1387             returnValue = QueryDebugKHR(thread, attribute, value);
1388         }
1389 
1390         ANGLE_CAPTURE_EGL(QueryDebugKHR, true, thread, attribute, value, returnValue);
1391     }
1392     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1393     return returnValue;
1394 }
1395 
1396 // EGL_KHR_fence_sync
EGL_ClientWaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags,EGLTimeKHR timeout)1397 EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
1398                                          EGLSyncKHR sync,
1399                                          EGLint flags,
1400                                          EGLTimeKHR timeout)
1401 {
1402 
1403     Thread *thread = egl::GetCurrentThread();
1404     EGLint returnValue;
1405     {
1406         ANGLE_SCOPED_GLOBAL_LOCK();
1407         EGL_EVENT(ClientWaitSyncKHR,
1408                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d, timeout = %llu",
1409                   (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
1410 
1411         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1412         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1413 
1414         {
1415             ANGLE_EGL_SCOPED_CONTEXT_LOCK(ClientWaitSyncKHR, thread, dpyPacked);
1416             ANGLE_EGL_VALIDATE(thread, ClientWaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint,
1417                                dpyPacked, syncPacked, flags, timeout);
1418 
1419             returnValue = ClientWaitSyncKHR(thread, dpyPacked, syncPacked, flags, timeout);
1420         }
1421 
1422         ANGLE_CAPTURE_EGL(ClientWaitSyncKHR, true, thread, dpyPacked, syncPacked, flags, timeout,
1423                           returnValue);
1424     }
1425     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1426     return returnValue;
1427 }
1428 
EGL_CreateSyncKHR(EGLDisplay dpy,EGLenum type,const EGLint * attrib_list)1429 EGLSyncKHR EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
1430 {
1431 
1432     Thread *thread = egl::GetCurrentThread();
1433     EGLSyncKHR returnValue;
1434     {
1435         ANGLE_SCOPED_GLOBAL_LOCK();
1436         EGL_EVENT(CreateSyncKHR,
1437                   "dpy = 0x%016" PRIxPTR ", type = 0x%X, attrib_list = 0x%016" PRIxPTR "",
1438                   (uintptr_t)dpy, type, (uintptr_t)attrib_list);
1439 
1440         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1441         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1442 
1443         {
1444             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateSyncKHR, thread, dpyPacked);
1445             ANGLE_EGL_VALIDATE(thread, CreateSyncKHR, GetDisplayIfValid(dpyPacked), EGLSyncKHR,
1446                                dpyPacked, type, attrib_listPacked);
1447 
1448             returnValue = CreateSyncKHR(thread, dpyPacked, type, attrib_listPacked);
1449         }
1450 
1451         ANGLE_CAPTURE_EGL(CreateSyncKHR, true, thread, dpyPacked, type, attrib_listPacked,
1452                           returnValue);
1453     }
1454     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1455     return returnValue;
1456 }
1457 
EGL_DestroySyncKHR(EGLDisplay dpy,EGLSyncKHR sync)1458 EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
1459 {
1460 
1461     Thread *thread = egl::GetCurrentThread();
1462     EGLBoolean returnValue;
1463     {
1464         ANGLE_SCOPED_GLOBAL_LOCK();
1465         EGL_EVENT(DestroySyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR "",
1466                   (uintptr_t)dpy, (uintptr_t)sync);
1467 
1468         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1469         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1470 
1471         {
1472             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroySyncKHR, thread, dpyPacked);
1473             ANGLE_EGL_VALIDATE(thread, DestroySyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1474                                dpyPacked, syncPacked);
1475 
1476             returnValue = DestroySyncKHR(thread, dpyPacked, syncPacked);
1477         }
1478 
1479         ANGLE_CAPTURE_EGL(DestroySyncKHR, true, thread, dpyPacked, syncPacked, returnValue);
1480     }
1481     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1482     return returnValue;
1483 }
1484 
EGL_GetSyncAttribKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint attribute,EGLint * value)1485 EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
1486                                             EGLSyncKHR sync,
1487                                             EGLint attribute,
1488                                             EGLint *value)
1489 {
1490 
1491     Thread *thread = egl::GetCurrentThread();
1492     EGLBoolean returnValue;
1493     {
1494         ANGLE_SCOPED_GLOBAL_LOCK();
1495         EGL_EVENT(GetSyncAttribKHR,
1496                   "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR
1497                   ", attribute = %d, value = 0x%016" PRIxPTR "",
1498                   (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
1499 
1500         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1501         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1502 
1503         {
1504             ANGLE_EGL_SCOPED_CONTEXT_LOCK(GetSyncAttribKHR, thread, dpyPacked, attribute);
1505             ANGLE_EGL_VALIDATE(thread, GetSyncAttribKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1506                                dpyPacked, syncPacked, attribute, value);
1507 
1508             returnValue = GetSyncAttribKHR(thread, dpyPacked, syncPacked, attribute, value);
1509         }
1510 
1511         ANGLE_CAPTURE_EGL(GetSyncAttribKHR, true, thread, dpyPacked, syncPacked, attribute, value,
1512                           returnValue);
1513     }
1514     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1515     return returnValue;
1516 }
1517 
1518 // EGL_KHR_image
EGL_CreateImageKHR(EGLDisplay dpy,EGLContext ctx,EGLenum target,EGLClientBuffer buffer,const EGLint * attrib_list)1519 EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
1520                                            EGLContext ctx,
1521                                            EGLenum target,
1522                                            EGLClientBuffer buffer,
1523                                            const EGLint *attrib_list)
1524 {
1525 
1526     Thread *thread = egl::GetCurrentThread();
1527     EGLImageKHR returnValue;
1528     {
1529         ANGLE_SCOPED_GLOBAL_LOCK();
1530         EGL_EVENT(CreateImageKHR,
1531                   "dpy = 0x%016" PRIxPTR ", ctx = 0x%016" PRIxPTR
1532                   ", target = 0x%X, buffer = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1533                   (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer,
1534                   (uintptr_t)attrib_list);
1535 
1536         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1537         gl::ContextID ctxPacked               = PackParam<gl::ContextID>(ctx);
1538         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1539 
1540         {
1541             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateImageKHR, thread, dpyPacked, ctxPacked);
1542             ANGLE_EGL_VALIDATE(thread, CreateImageKHR, GetDisplayIfValid(dpyPacked), EGLImageKHR,
1543                                dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
1544 
1545             returnValue =
1546                 CreateImageKHR(thread, dpyPacked, ctxPacked, target, buffer, attrib_listPacked);
1547         }
1548 
1549         ANGLE_CAPTURE_EGL(CreateImageKHR, true, thread, dpyPacked, ctxPacked, target, buffer,
1550                           attrib_listPacked, returnValue);
1551     }
1552     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1553     return returnValue;
1554 }
1555 
EGL_DestroyImageKHR(EGLDisplay dpy,EGLImageKHR image)1556 EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
1557 {
1558 
1559     Thread *thread = egl::GetCurrentThread();
1560     EGLBoolean returnValue;
1561     {
1562         ANGLE_SCOPED_GLOBAL_LOCK();
1563         EGL_EVENT(DestroyImageKHR, "dpy = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR "",
1564                   (uintptr_t)dpy, (uintptr_t)image);
1565 
1566         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1567         ImageID imagePacked     = PackParam<ImageID>(image);
1568 
1569         {
1570             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyImageKHR, thread, dpyPacked);
1571             ANGLE_EGL_VALIDATE(thread, DestroyImageKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1572                                dpyPacked, imagePacked);
1573 
1574             returnValue = DestroyImageKHR(thread, dpyPacked, imagePacked);
1575         }
1576 
1577         ANGLE_CAPTURE_EGL(DestroyImageKHR, true, thread, dpyPacked, imagePacked, returnValue);
1578     }
1579     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1580     return returnValue;
1581 }
1582 
1583 // EGL_KHR_lock_surface3
EGL_LockSurfaceKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * attrib_list)1584 EGLBoolean EGLAPIENTRY EGL_LockSurfaceKHR(EGLDisplay dpy,
1585                                           EGLSurface surface,
1586                                           const EGLint *attrib_list)
1587 {
1588 
1589     Thread *thread = egl::GetCurrentThread();
1590     EGLBoolean returnValue;
1591     {
1592         ANGLE_SCOPED_GLOBAL_LOCK();
1593         EGL_EVENT(LockSurfaceKHR,
1594                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
1595                   ", attrib_list = 0x%016" PRIxPTR "",
1596                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)attrib_list);
1597 
1598         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1599         SurfaceID surfacePacked               = PackParam<SurfaceID>(surface);
1600         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1601 
1602         {
1603             ANGLE_EGL_SCOPED_CONTEXT_LOCK(LockSurfaceKHR, thread, dpyPacked);
1604             ANGLE_EGL_VALIDATE(thread, LockSurfaceKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1605                                dpyPacked, surfacePacked, attrib_listPacked);
1606 
1607             returnValue = LockSurfaceKHR(thread, dpyPacked, surfacePacked, attrib_listPacked);
1608         }
1609 
1610         ANGLE_CAPTURE_EGL(LockSurfaceKHR, true, thread, dpyPacked, surfacePacked, attrib_listPacked,
1611                           returnValue);
1612     }
1613     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1614     return returnValue;
1615 }
1616 
EGL_QuerySurface64KHR(EGLDisplay dpy,EGLSurface surface,EGLint attribute,EGLAttribKHR * value)1617 EGLBoolean EGLAPIENTRY EGL_QuerySurface64KHR(EGLDisplay dpy,
1618                                              EGLSurface surface,
1619                                              EGLint attribute,
1620                                              EGLAttribKHR *value)
1621 {
1622 
1623     Thread *thread = egl::GetCurrentThread();
1624     EGLBoolean returnValue;
1625     {
1626         ANGLE_SCOPED_GLOBAL_LOCK();
1627         EGL_EVENT(QuerySurface64KHR,
1628                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
1629                   ", attribute = %d, value = 0x%016" PRIxPTR "",
1630                   (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
1631 
1632         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1633         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1634 
1635         {
1636             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QuerySurface64KHR, thread, dpyPacked, attribute);
1637             ANGLE_EGL_VALIDATE(thread, QuerySurface64KHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1638                                dpyPacked, surfacePacked, attribute, value);
1639 
1640             returnValue = QuerySurface64KHR(thread, dpyPacked, surfacePacked, attribute, value);
1641         }
1642 
1643         ANGLE_CAPTURE_EGL(QuerySurface64KHR, true, thread, dpyPacked, surfacePacked, attribute,
1644                           value, returnValue);
1645     }
1646     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1647     return returnValue;
1648 }
1649 
EGL_UnlockSurfaceKHR(EGLDisplay dpy,EGLSurface surface)1650 EGLBoolean EGLAPIENTRY EGL_UnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
1651 {
1652 
1653     Thread *thread = egl::GetCurrentThread();
1654     EGLBoolean returnValue;
1655     {
1656         ANGLE_SCOPED_GLOBAL_LOCK();
1657         EGL_EVENT(UnlockSurfaceKHR, "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR "",
1658                   (uintptr_t)dpy, (uintptr_t)surface);
1659 
1660         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1661         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1662 
1663         {
1664             ANGLE_EGL_SCOPED_CONTEXT_LOCK(UnlockSurfaceKHR, thread, dpyPacked);
1665             ANGLE_EGL_VALIDATE(thread, UnlockSurfaceKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1666                                dpyPacked, surfacePacked);
1667 
1668             returnValue = UnlockSurfaceKHR(thread, dpyPacked, surfacePacked);
1669         }
1670 
1671         ANGLE_CAPTURE_EGL(UnlockSurfaceKHR, true, thread, dpyPacked, surfacePacked, returnValue);
1672     }
1673     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1674     return returnValue;
1675 }
1676 
1677 // EGL_KHR_partial_update
EGL_SetDamageRegionKHR(EGLDisplay dpy,EGLSurface surface,EGLint * rects,EGLint n_rects)1678 EGLBoolean EGLAPIENTRY EGL_SetDamageRegionKHR(EGLDisplay dpy,
1679                                               EGLSurface surface,
1680                                               EGLint *rects,
1681                                               EGLint n_rects)
1682 {
1683 
1684     Thread *thread = egl::GetCurrentThread();
1685     EGLBoolean returnValue;
1686     {
1687         ANGLE_SCOPED_GLOBAL_LOCK();
1688         EGL_EVENT(SetDamageRegionKHR,
1689                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", rects = 0x%016" PRIxPTR
1690                   ", n_rects = %d",
1691                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
1692 
1693         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1694         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
1695 
1696         {
1697             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SetDamageRegionKHR, thread, dpyPacked);
1698             ANGLE_EGL_VALIDATE(thread, SetDamageRegionKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1699                                dpyPacked, surfacePacked, rects, n_rects);
1700 
1701             returnValue = SetDamageRegionKHR(thread, dpyPacked, surfacePacked, rects, n_rects);
1702         }
1703 
1704         ANGLE_CAPTURE_EGL(SetDamageRegionKHR, true, thread, dpyPacked, surfacePacked, rects,
1705                           n_rects, returnValue);
1706     }
1707     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1708     return returnValue;
1709 }
1710 
1711 // EGL_KHR_reusable_sync
EGL_SignalSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLenum mode)1712 EGLBoolean EGLAPIENTRY EGL_SignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode)
1713 {
1714 
1715     Thread *thread = egl::GetCurrentThread();
1716     EGLBoolean returnValue;
1717     {
1718         ANGLE_SCOPED_GLOBAL_LOCK();
1719         EGL_EVENT(SignalSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", mode = 0x%X",
1720                   (uintptr_t)dpy, (uintptr_t)sync, mode);
1721 
1722         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
1723         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
1724 
1725         {
1726             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SignalSyncKHR, thread, dpyPacked);
1727             ANGLE_EGL_VALIDATE(thread, SignalSyncKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1728                                dpyPacked, syncPacked, mode);
1729 
1730             returnValue = SignalSyncKHR(thread, dpyPacked, syncPacked, mode);
1731         }
1732 
1733         ANGLE_CAPTURE_EGL(SignalSyncKHR, true, thread, dpyPacked, syncPacked, mode, returnValue);
1734     }
1735     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1736     return returnValue;
1737 }
1738 
1739 // ClientWaitSyncKHR is already defined.
1740 
1741 // CreateSyncKHR is already defined.
1742 
1743 // DestroySyncKHR is already defined.
1744 
1745 // GetSyncAttribKHR is already defined.
1746 
1747 // EGL_KHR_stream
EGL_CreateStreamKHR(EGLDisplay dpy,const EGLint * attrib_list)1748 EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
1749 {
1750 
1751     Thread *thread = egl::GetCurrentThread();
1752     EGLStreamKHR returnValue;
1753     {
1754         ANGLE_SCOPED_GLOBAL_LOCK();
1755         EGL_EVENT(CreateStreamKHR, "dpy = 0x%016" PRIxPTR ", attrib_list = 0x%016" PRIxPTR "",
1756                   (uintptr_t)dpy, (uintptr_t)attrib_list);
1757 
1758         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
1759         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
1760 
1761         {
1762             ANGLE_EGL_SCOPED_CONTEXT_LOCK(CreateStreamKHR, thread, dpyPacked);
1763             ANGLE_EGL_VALIDATE(thread, CreateStreamKHR, GetDisplayIfValid(dpyPacked), EGLStreamKHR,
1764                                dpyPacked, attrib_listPacked);
1765 
1766             returnValue = CreateStreamKHR(thread, dpyPacked, attrib_listPacked);
1767         }
1768 
1769         ANGLE_CAPTURE_EGL(CreateStreamKHR, true, thread, dpyPacked, attrib_listPacked, returnValue);
1770     }
1771     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1772     return returnValue;
1773 }
1774 
EGL_DestroyStreamKHR(EGLDisplay dpy,EGLStreamKHR stream)1775 EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
1776 {
1777 
1778     Thread *thread = egl::GetCurrentThread();
1779     EGLBoolean returnValue;
1780     {
1781         ANGLE_SCOPED_GLOBAL_LOCK();
1782         EGL_EVENT(DestroyStreamKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
1783                   (uintptr_t)dpy, (uintptr_t)stream);
1784 
1785         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1786         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1787 
1788         {
1789             ANGLE_EGL_SCOPED_CONTEXT_LOCK(DestroyStreamKHR, thread, dpyPacked);
1790             ANGLE_EGL_VALIDATE(thread, DestroyStreamKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1791                                dpyPacked, streamPacked);
1792 
1793             returnValue = DestroyStreamKHR(thread, dpyPacked, streamPacked);
1794         }
1795 
1796         ANGLE_CAPTURE_EGL(DestroyStreamKHR, true, thread, dpyPacked, streamPacked, returnValue);
1797     }
1798     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1799     return returnValue;
1800 }
1801 
EGL_QueryStreamKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint * value)1802 EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
1803                                           EGLStreamKHR stream,
1804                                           EGLenum attribute,
1805                                           EGLint *value)
1806 {
1807 
1808     Thread *thread = egl::GetCurrentThread();
1809     EGLBoolean returnValue;
1810     {
1811         ANGLE_SCOPED_GLOBAL_LOCK();
1812         EGL_EVENT(QueryStreamKHR,
1813                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
1814                   ", attribute = 0x%X, value = 0x%016" PRIxPTR "",
1815                   (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
1816 
1817         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1818         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1819 
1820         {
1821             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStreamKHR, thread, dpyPacked, attribute);
1822             ANGLE_EGL_VALIDATE(thread, QueryStreamKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1823                                dpyPacked, streamPacked, attribute, value);
1824 
1825             returnValue = QueryStreamKHR(thread, dpyPacked, streamPacked, attribute, value);
1826         }
1827 
1828         ANGLE_CAPTURE_EGL(QueryStreamKHR, true, thread, dpyPacked, streamPacked, attribute, value,
1829                           returnValue);
1830     }
1831     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1832     return returnValue;
1833 }
1834 
EGL_QueryStreamu64KHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLuint64KHR * value)1835 EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
1836                                              EGLStreamKHR stream,
1837                                              EGLenum attribute,
1838                                              EGLuint64KHR *value)
1839 {
1840 
1841     Thread *thread = egl::GetCurrentThread();
1842     EGLBoolean returnValue;
1843     {
1844         ANGLE_SCOPED_GLOBAL_LOCK();
1845         EGL_EVENT(QueryStreamu64KHR,
1846                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
1847                   ", attribute = 0x%X, value = 0x%016" PRIxPTR "",
1848                   (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
1849 
1850         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1851         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1852 
1853         {
1854             ANGLE_EGL_SCOPED_CONTEXT_LOCK(QueryStreamu64KHR, thread, dpyPacked, attribute);
1855             ANGLE_EGL_VALIDATE(thread, QueryStreamu64KHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1856                                dpyPacked, streamPacked, attribute, value);
1857 
1858             returnValue = QueryStreamu64KHR(thread, dpyPacked, streamPacked, attribute, value);
1859         }
1860 
1861         ANGLE_CAPTURE_EGL(QueryStreamu64KHR, true, thread, dpyPacked, streamPacked, attribute,
1862                           value, returnValue);
1863     }
1864     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1865     return returnValue;
1866 }
1867 
EGL_StreamAttribKHR(EGLDisplay dpy,EGLStreamKHR stream,EGLenum attribute,EGLint value)1868 EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
1869                                            EGLStreamKHR stream,
1870                                            EGLenum attribute,
1871                                            EGLint value)
1872 {
1873 
1874     Thread *thread = egl::GetCurrentThread();
1875     EGLBoolean returnValue;
1876     {
1877         ANGLE_SCOPED_GLOBAL_LOCK();
1878         EGL_EVENT(StreamAttribKHR,
1879                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
1880                   ", attribute = 0x%X, value = %d",
1881                   (uintptr_t)dpy, (uintptr_t)stream, attribute, value);
1882 
1883         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1884         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1885 
1886         {
1887             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamAttribKHR, thread, dpyPacked, attribute);
1888             ANGLE_EGL_VALIDATE(thread, StreamAttribKHR, GetDisplayIfValid(dpyPacked), EGLBoolean,
1889                                dpyPacked, streamPacked, attribute, value);
1890 
1891             returnValue = StreamAttribKHR(thread, dpyPacked, streamPacked, attribute, value);
1892         }
1893 
1894         ANGLE_CAPTURE_EGL(StreamAttribKHR, true, thread, dpyPacked, streamPacked, attribute, value,
1895                           returnValue);
1896     }
1897     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1898     return returnValue;
1899 }
1900 
1901 // EGL_KHR_stream_consumer_gltexture
EGL_StreamConsumerAcquireKHR(EGLDisplay dpy,EGLStreamKHR stream)1902 EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
1903 {
1904 
1905     Thread *thread = egl::GetCurrentThread();
1906     EGLBoolean returnValue;
1907     {
1908         ANGLE_SCOPED_GLOBAL_LOCK();
1909         EGL_EVENT(StreamConsumerAcquireKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
1910                   (uintptr_t)dpy, (uintptr_t)stream);
1911 
1912         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1913         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1914 
1915         {
1916             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerAcquireKHR, thread, dpyPacked);
1917             ANGLE_EGL_VALIDATE(thread, StreamConsumerAcquireKHR, GetDisplayIfValid(dpyPacked),
1918                                EGLBoolean, dpyPacked, streamPacked);
1919 
1920             returnValue = StreamConsumerAcquireKHR(thread, dpyPacked, streamPacked);
1921         }
1922 
1923         ANGLE_CAPTURE_EGL(StreamConsumerAcquireKHR, true, thread, dpyPacked, streamPacked,
1924                           returnValue);
1925     }
1926     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1927     return returnValue;
1928 }
1929 
EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy,EGLStreamKHR stream)1930 EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
1931 {
1932 
1933     Thread *thread = egl::GetCurrentThread();
1934     EGLBoolean returnValue;
1935     {
1936         ANGLE_SCOPED_GLOBAL_LOCK();
1937         EGL_EVENT(StreamConsumerGLTextureExternalKHR,
1938                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "", (uintptr_t)dpy,
1939                   (uintptr_t)stream);
1940 
1941         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1942         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1943 
1944         {
1945             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerGLTextureExternalKHR, thread, dpyPacked);
1946             ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalKHR,
1947                                GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, streamPacked);
1948 
1949             returnValue = StreamConsumerGLTextureExternalKHR(thread, dpyPacked, streamPacked);
1950         }
1951 
1952         ANGLE_CAPTURE_EGL(StreamConsumerGLTextureExternalKHR, true, thread, dpyPacked, streamPacked,
1953                           returnValue);
1954     }
1955     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1956     return returnValue;
1957 }
1958 
EGL_StreamConsumerReleaseKHR(EGLDisplay dpy,EGLStreamKHR stream)1959 EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
1960 {
1961 
1962     Thread *thread = egl::GetCurrentThread();
1963     EGLBoolean returnValue;
1964     {
1965         ANGLE_SCOPED_GLOBAL_LOCK();
1966         EGL_EVENT(StreamConsumerReleaseKHR, "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR "",
1967                   (uintptr_t)dpy, (uintptr_t)stream);
1968 
1969         egl::Display *dpyPacked   = PackParam<egl::Display *>(dpy);
1970         egl::Stream *streamPacked = PackParam<egl::Stream *>(stream);
1971 
1972         {
1973             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerReleaseKHR, thread, dpyPacked);
1974             ANGLE_EGL_VALIDATE(thread, StreamConsumerReleaseKHR, GetDisplayIfValid(dpyPacked),
1975                                EGLBoolean, dpyPacked, streamPacked);
1976 
1977             returnValue = StreamConsumerReleaseKHR(thread, dpyPacked, streamPacked);
1978         }
1979 
1980         ANGLE_CAPTURE_EGL(StreamConsumerReleaseKHR, true, thread, dpyPacked, streamPacked,
1981                           returnValue);
1982     }
1983     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
1984     return returnValue;
1985 }
1986 
1987 // EGL_KHR_swap_buffers_with_damage
EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,EGLSurface surface,const EGLint * rects,EGLint n_rects)1988 EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
1989                                                     EGLSurface surface,
1990                                                     const EGLint *rects,
1991                                                     EGLint n_rects)
1992 {
1993     ANGLE_EGLBOOLEAN_TRY(EGL_PrepareSwapBuffersANGLE(dpy, surface));
1994     Thread *thread = egl::GetCurrentThread();
1995     EGLBoolean returnValue;
1996     {
1997         ANGLE_SCOPED_GLOBAL_LOCK();
1998         EGL_EVENT(SwapBuffersWithDamageKHR,
1999                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR ", rects = 0x%016" PRIxPTR
2000                   ", n_rects = %d",
2001                   (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
2002 
2003         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2004         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2005 
2006         {
2007             ANGLE_EGL_SCOPED_CONTEXT_LOCK(SwapBuffersWithDamageKHR, thread, dpyPacked);
2008             ANGLE_EGL_VALIDATE(thread, SwapBuffersWithDamageKHR, GetDisplayIfValid(dpyPacked),
2009                                EGLBoolean, dpyPacked, surfacePacked, rects, n_rects);
2010 
2011             returnValue =
2012                 SwapBuffersWithDamageKHR(thread, dpyPacked, surfacePacked, rects, n_rects);
2013         }
2014 
2015         ANGLE_CAPTURE_EGL(SwapBuffersWithDamageKHR, true, thread, dpyPacked, surfacePacked, rects,
2016                           n_rects, returnValue);
2017     }
2018     egl::Display::GetCurrentThreadUnlockedTailCall()->run();
2019     return returnValue;
2020 }
2021 
2022 // EGL_KHR_wait_sync
EGL_WaitSyncKHR(EGLDisplay dpy,EGLSyncKHR sync,EGLint flags)2023 EGLint EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
2024 {
2025 
2026     Thread *thread = egl::GetCurrentThread();
2027     EGLint returnValue;
2028     {
2029         ANGLE_SCOPED_GLOBAL_LOCK();
2030         EGL_EVENT(WaitSyncKHR, "dpy = 0x%016" PRIxPTR ", sync = 0x%016" PRIxPTR ", flags = %d",
2031                   (uintptr_t)dpy, (uintptr_t)sync, flags);
2032 
2033         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2034         egl::SyncID syncPacked  = PackParam<egl::SyncID>(sync);
2035 
2036         {
2037             ANGLE_EGL_SCOPED_CONTEXT_LOCK(WaitSyncKHR, thread, dpyPacked);
2038             ANGLE_EGL_VALIDATE(thread, WaitSyncKHR, GetDisplayIfValid(dpyPacked), EGLint, dpyPacked,
2039                                syncPacked, flags);
2040 
2041             returnValue = WaitSyncKHR(thread, dpyPacked, syncPacked, flags);
2042         }
2043 
2044         ANGLE_CAPTURE_EGL(WaitSyncKHR, true, thread, dpyPacked, syncPacked, flags, returnValue);
2045     }
2046     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2047     return returnValue;
2048 }
2049 
2050 // EGL_NV_post_sub_buffer
EGL_PostSubBufferNV(EGLDisplay dpy,EGLSurface surface,EGLint x,EGLint y,EGLint width,EGLint height)2051 EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
2052                                            EGLSurface surface,
2053                                            EGLint x,
2054                                            EGLint y,
2055                                            EGLint width,
2056                                            EGLint height)
2057 {
2058 
2059     Thread *thread = egl::GetCurrentThread();
2060     EGLBoolean returnValue;
2061     {
2062         ANGLE_SCOPED_GLOBAL_LOCK();
2063         EGL_EVENT(PostSubBufferNV,
2064                   "dpy = 0x%016" PRIxPTR ", surface = 0x%016" PRIxPTR
2065                   ", x = %d, y = %d, width = %d, height = %d",
2066                   (uintptr_t)dpy, (uintptr_t)surface, x, y, width, height);
2067 
2068         egl::Display *dpyPacked = PackParam<egl::Display *>(dpy);
2069         SurfaceID surfacePacked = PackParam<SurfaceID>(surface);
2070 
2071         {
2072             ANGLE_EGL_SCOPED_CONTEXT_LOCK(PostSubBufferNV, thread, dpyPacked);
2073             ANGLE_EGL_VALIDATE(thread, PostSubBufferNV, GetDisplayIfValid(dpyPacked), EGLBoolean,
2074                                dpyPacked, surfacePacked, x, y, width, height);
2075 
2076             returnValue = PostSubBufferNV(thread, dpyPacked, surfacePacked, x, y, width, height);
2077         }
2078 
2079         ANGLE_CAPTURE_EGL(PostSubBufferNV, true, thread, dpyPacked, surfacePacked, x, y, width,
2080                           height, returnValue);
2081     }
2082     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2083     return returnValue;
2084 }
2085 
2086 // EGL_NV_stream_consumer_gltexture_yuv
EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,EGLStreamKHR stream,const EGLAttrib * attrib_list)2087 EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
2088                                                                     EGLStreamKHR stream,
2089                                                                     const EGLAttrib *attrib_list)
2090 {
2091 
2092     Thread *thread = egl::GetCurrentThread();
2093     EGLBoolean returnValue;
2094     {
2095         ANGLE_SCOPED_GLOBAL_LOCK();
2096         EGL_EVENT(StreamConsumerGLTextureExternalAttribsNV,
2097                   "dpy = 0x%016" PRIxPTR ", stream = 0x%016" PRIxPTR
2098                   ", attrib_list = 0x%016" PRIxPTR "",
2099                   (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
2100 
2101         egl::Display *dpyPacked               = PackParam<egl::Display *>(dpy);
2102         egl::Stream *streamPacked             = PackParam<egl::Stream *>(stream);
2103         const AttributeMap &attrib_listPacked = PackParam<const AttributeMap &>(attrib_list);
2104 
2105         {
2106             ANGLE_EGL_SCOPED_CONTEXT_LOCK(StreamConsumerGLTextureExternalAttribsNV, thread,
2107                                           dpyPacked);
2108             ANGLE_EGL_VALIDATE(thread, StreamConsumerGLTextureExternalAttribsNV,
2109                                GetDisplayIfValid(dpyPacked), EGLBoolean, dpyPacked, streamPacked,
2110                                attrib_listPacked);
2111 
2112             returnValue = StreamConsumerGLTextureExternalAttribsNV(thread, dpyPacked, streamPacked,
2113                                                                    attrib_listPacked);
2114         }
2115 
2116         ANGLE_CAPTURE_EGL(StreamConsumerGLTextureExternalAttribsNV, true, thread, dpyPacked,
2117                           streamPacked, attrib_listPacked, returnValue);
2118     }
2119     ASSERT(!egl::Display::GetCurrentThreadUnlockedTailCall()->any());
2120     return returnValue;
2121 }
2122 
2123 }  // extern "C"
2124