Debian Codegraph @

src/egl/generate/eglFunctionList.py

raw
1 # (C) Copyright 2016, NVIDIA CORPORATION.
2 # All Rights Reserved.
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # on the rights to use, copy, modify, merge, publish, distribute, sub
8 # license, and/or sell copies of the Software, and to permit persons to whom
9 # the Software is furnished to do so, subject to the following conditions:
10 #
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
13 # Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 # IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 # IN THE SOFTWARE.
22 #
23 # Authors:
24 # Kyle Brenneman <[email protected]>
25
26 """
27 Contains a list of EGL functions to generate dispatch functions for.
28
29 This is used from gen_egl_dispatch.py.
30
31 EGL_FUNCTIONS is a sequence of (name, eglData) pairs, where name is the name
32 of the function, and eglData is a dictionary containing data about that
33 function.
34
35 The values in the eglData dictionary are:
36 - method (string):
37 How to select a vendor library. See "Method values" below.
38
39 - prefix (string):
40 This string is prepended to the name of the dispatch function. If
41 unspecified, the default is "" (an empty string).
42
43 - static (boolean)
44 If True, this function should be declared static.
45
46 - "public" (boolean)
47 If True, the function should be exported from the library. Vendor libraries
48 generally should not use this.
49
50 - extension (string):
51 If specified, this is the name of a macro to check for before defining a
52 function. Used for checking for extension macros and such.
53
54 - retval (string):
55 If specified, this is a C expression with the default value to return if we
56 can't find a function to call. By default, it will try to guess from the
57 return type: EGL_NO_whatever for the various handle types, NULL for
58 pointers, and zero for everything else.
59
60 method values:
61 - "custom"
62 The dispatch stub will be hand-written instead of generated.
63
64 - "none"
65 No dispatch function exists at all, but the function should still have an
66 entry in the index array. This is for other functions that a stub may need
67 to call that are implemented in libEGL itself.
68
69 - "display"
70 Select a vendor from an EGLDisplay argument.
71
72 - "device"
73 Select a vendor from an EGLDeviceEXT argument.
74
75 - "current"
76 Select the vendor that owns the current context.
77 """
78
79
80 def _eglFunc(name, method, static=None, public=False, inheader=None, prefix="dispatch_", extension=None, retval=None):
81 """
82 A convenience function to define an entry in the EGL function list.
83 """
84 if static is None:
85 static = (not public and method != "custom")
86 if inheader is None:
87 inheader = (not static)
88 values = {
89 "method": method,
90 "prefix": prefix,
91 "extension": extension,
92 "retval": retval,
93 "static": static,
94 "public": public,
95 "inheader": inheader,
96 }
97 return (name, values)
98
99
100 EGL_FUNCTIONS = (
101 # EGL_VERSION_1_0
102 _eglFunc("eglChooseConfig", "none"),
103 _eglFunc("eglCopyBuffers", "none"),
104 _eglFunc("eglCreateContext", "none"),
105 _eglFunc("eglCreatePbufferSurface", "none"),
106 _eglFunc("eglCreatePixmapSurface", "none"),
107 _eglFunc("eglCreateWindowSurface", "none"),
108 _eglFunc("eglDestroyContext", "none"),
109 _eglFunc("eglDestroySurface", "none"),
110 _eglFunc("eglGetConfigAttrib", "none"),
111 _eglFunc("eglGetConfigs", "none"),
112 _eglFunc("eglQueryContext", "none"),
113 _eglFunc("eglQuerySurface", "none"),
114 _eglFunc("eglSwapBuffers", "none"),
115 _eglFunc("eglWaitGL", "none"),
116 _eglFunc("eglWaitNative", "none"),
117 _eglFunc("eglTerminate", "none"),
118 _eglFunc("eglInitialize", "none"),
119
120 _eglFunc("eglGetCurrentDisplay", "none"),
121 _eglFunc("eglGetCurrentSurface", "none"),
122 _eglFunc("eglGetDisplay", "none"),
123 _eglFunc("eglGetError", "none"),
124 _eglFunc("eglGetProcAddress", "none"),
125 _eglFunc("eglMakeCurrent", "none"),
126 _eglFunc("eglQueryString", "none"),
127
128 # EGL_VERSION_1_1
129 _eglFunc("eglBindTexImage", "none"),
130 _eglFunc("eglReleaseTexImage", "none"),
131 _eglFunc("eglSurfaceAttrib", "none"),
132 _eglFunc("eglSwapInterval", "none"),
133
134 # EGL_VERSION_1_2
135 _eglFunc("eglCreatePbufferFromClientBuffer", "none"),
136 _eglFunc("eglWaitClient", "none"),
137 _eglFunc("eglBindAPI", "none"),
138 _eglFunc("eglQueryAPI", "none"),
139 _eglFunc("eglReleaseThread", "none"),
140
141 # EGL_VERSION_1_4
142 _eglFunc("eglGetCurrentContext", "none"),
143
144 # EGL_VERSION_1_5
145 _eglFunc("eglCreateSync", "none"),
146 _eglFunc("eglDestroySync", "none"),
147 _eglFunc("eglClientWaitSync", "none"),
148 _eglFunc("eglGetSyncAttrib", "none"),
149 _eglFunc("eglCreateImage", "none"),
150 _eglFunc("eglDestroyImage", "none"),
151 _eglFunc("eglCreatePlatformWindowSurface", "none"),
152 _eglFunc("eglCreatePlatformPixmapSurface", "none"),
153 _eglFunc("eglWaitSync", "none"),
154 _eglFunc("eglGetPlatformDisplay", "none"),
155
156 # EGL_EXT_platform_base
157 _eglFunc("eglCreatePlatformWindowSurfaceEXT", "display"),
158 _eglFunc("eglCreatePlatformPixmapSurfaceEXT", "display"),
159 _eglFunc("eglGetPlatformDisplayEXT", "none"),
160
161 # TODO: Most of these extensions should be provided by the vendor
162 # libraries, not by libEGL. They're here now to make testing everything
163 # else easier.
164
165 # EGL_EXT_swap_buffers_with_damage
166 _eglFunc("eglSwapBuffersWithDamageEXT", "display"),
167
168 # KHR_EXT_swap_buffers_with_damage
169 _eglFunc("eglSwapBuffersWithDamageKHR", "display"),
170
171 # EGL_KHR_cl_event2
172 _eglFunc("eglCreateSync64KHR", "display"),
173
174 # EGL_KHR_fence_sync
175 _eglFunc("eglCreateSyncKHR", "display"),
176 _eglFunc("eglDestroySyncKHR", "display"),
177 _eglFunc("eglClientWaitSyncKHR", "display"),
178 _eglFunc("eglGetSyncAttribKHR", "display"),
179
180 # EGL_KHR_image
181 _eglFunc("eglCreateImageKHR", "display"),
182 _eglFunc("eglDestroyImageKHR", "display"),
183
184 # EGL_KHR_image_base
185 # eglCreateImageKHR already defined in EGL_KHR_image
186 # eglDestroyImageKHR already defined in EGL_KHR_image
187
188 # EGL_KHR_reusable_sync
189 _eglFunc("eglSignalSyncKHR", "display"),
190 # eglCreateSyncKHR already defined in EGL_KHR_fence_sync
191 # eglDestroySyncKHR already defined in EGL_KHR_fence_sync
192 # eglClientWaitSyncKHR already defined in EGL_KHR_fence_sync
193 # eglGetSyncAttribKHR already defined in EGL_KHR_fence_sync
194
195 # EGL_KHR_wait_sync
196 _eglFunc("eglWaitSyncKHR", "display"),
197
198 # EGL_MESA_image_dma_buf_export
199 _eglFunc("eglExportDMABUFImageQueryMESA", "display"),
200 _eglFunc("eglExportDMABUFImageMESA", "display"),
201
202 # EGL_WL_bind_wayland_display
203 _eglFunc("eglCreateWaylandBufferFromImageWL", "display"),
204 _eglFunc("eglUnbindWaylandDisplayWL", "display"),
205 _eglFunc("eglQueryWaylandBufferWL", "display"),
206 _eglFunc("eglBindWaylandDisplayWL", "display"),
207
208 # EGL_CHROMIUM_get_sync_values
209 _eglFunc("eglGetSyncValuesCHROMIUM", "display"),
210
211 # EGL_ANGLE_sync_control_rate
212 _eglFunc("eglGetMscRateANGLE", "display"),
213
214 # EGL_ANDROID_native_fence_sync
215 _eglFunc("eglDupNativeFenceFDANDROID", "display"),
216
217 # EGL_ANDROID_blob_cache
218 _eglFunc("eglSetBlobCacheFuncsANDROID", "display"),
219
220 # EGL_EXT_image_dma_buf_import_modifiers
221 _eglFunc("eglQueryDmaBufFormatsEXT", "display"),
222 _eglFunc("eglQueryDmaBufModifiersEXT", "display"),
223
224 # EGL_EXT_device_base
225 _eglFunc("eglQueryDeviceAttribEXT", "device"),
226 _eglFunc("eglQueryDeviceStringEXT", "device"),
227 _eglFunc("eglQueryDevicesEXT", "none"),
228 _eglFunc("eglQueryDisplayAttribEXT", "display"),
229
230 # EGL_MESA_query_driver
231 _eglFunc("eglGetDisplayDriverName", "display"),
232 _eglFunc("eglGetDisplayDriverConfig", "display"),
233
234 # EGL_KHR_partial_update
235 _eglFunc("eglSetDamageRegionKHR", "display"),
236
237 # EGL_MESA_gl_interop
238 _eglFunc("eglGLInteropQueryDeviceInfoMESA", "display"),
239 _eglFunc("eglGLInteropExportObjectMESA", "display"),
240 _eglFunc("eglGLInteropFlushObjectsMESA", "display"),
241
242 # EGL_EXT_surface_compression
243 _eglFunc("eglQuerySupportedCompressionRatesEXT", "display"),
244
245 # EGL_EXT_device_persistent_id
246 _eglFunc("eglQueryDeviceBinaryEXT", "device"),
247 )