• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Contains a list of EGL functions to generate dispatch functions for.
3
4This is used from gen_egl_dispatch.py.
5
6EGL_FUNCTIONS is a sequence of (name, eglData) pairs, where name is the name
7of the function, and eglData is a dictionary containing data about that
8function.
9
10The values in the eglData dictionary are:
11- method (string):
12    How to select a vendor library. See "Method values" below.
13
14- prefix (string):
15    This string is prepended to the name of the dispatch function. If
16    unspecified, the default is "" (an empty string).
17
18- static (boolean)
19  If True, this function should be declared static.
20
21- "public" (boolean)
22    If True, the function should be exported from the library. Vendor libraries
23    generally should not use this.
24
25- extension (string):
26    If specified, this is the name of a macro to check for before defining a
27    function. Used for checking for extension macros and such.
28
29- retval (string):
30    If specified, this is a C expression with the default value to return if we
31    can't find a function to call. By default, it will try to guess from the
32    return type: EGL_NO_whatever for the various handle types, NULL for
33    pointers, and zero for everything else.
34
35method values:
36- "custom"
37    The dispatch stub will be hand-written instead of generated.
38
39- "none"
40    No dispatch function exists at all, but the function should still have an
41    entry in the index array. This is for other functions that a stub may need
42    to call that are implemented in libEGL itself.
43
44- "display"
45    Select a vendor from an EGLDisplay argument.
46
47- "device"
48    Select a vendor from an EGLDeviceEXT argument.
49
50- "current"
51    Select the vendor that owns the current context.
52"""
53
54def _eglFunc(name, method, static=None, public=False, inheader=None, prefix="dispatch_", extension=None, retval=None):
55    """
56    A convenience function to define an entry in the EGL function list.
57    """
58    if static is None:
59        static = (not public and method != "custom")
60    if inheader is None:
61        inheader = (not static)
62    values = {
63        "method" : method,
64        "prefix" : prefix,
65        "extension" : extension,
66        "retval" : retval,
67        "static" : static,
68        "public" : public,
69        "inheader" : inheader,
70    }
71    return (name, values)
72
73EGL_FUNCTIONS = (
74    # EGL_VERSION_1_0
75    _eglFunc("eglChooseConfig",                      "none"),
76    _eglFunc("eglCopyBuffers",                       "none"),
77    _eglFunc("eglCreateContext",                     "none"),
78    _eglFunc("eglCreatePbufferSurface",              "none"),
79    _eglFunc("eglCreatePixmapSurface",               "none"),
80    _eglFunc("eglCreateWindowSurface",               "none"),
81    _eglFunc("eglDestroyContext",                    "none"),
82    _eglFunc("eglDestroySurface",                    "none"),
83    _eglFunc("eglGetConfigAttrib",                   "none"),
84    _eglFunc("eglGetConfigs",                        "none"),
85    _eglFunc("eglQueryContext",                      "none"),
86    _eglFunc("eglQuerySurface",                      "none"),
87    _eglFunc("eglSwapBuffers",                       "none"),
88    _eglFunc("eglWaitGL",                            "none"),
89    _eglFunc("eglWaitNative",                        "none"),
90    _eglFunc("eglTerminate",                         "none"),
91    _eglFunc("eglInitialize",                        "none"),
92
93    _eglFunc("eglGetCurrentDisplay",                 "none"),
94    _eglFunc("eglGetCurrentSurface",                 "none"),
95    _eglFunc("eglGetDisplay",                        "none"),
96    _eglFunc("eglGetError",                          "none"),
97    _eglFunc("eglGetProcAddress",                    "none"),
98    _eglFunc("eglMakeCurrent",                       "none"),
99    _eglFunc("eglQueryString",                       "none"),
100
101    # EGL_VERSION_1_1
102    _eglFunc("eglBindTexImage",                      "none"),
103    _eglFunc("eglReleaseTexImage",                   "none"),
104    _eglFunc("eglSurfaceAttrib",                     "none"),
105    _eglFunc("eglSwapInterval",                      "none"),
106
107    # EGL_VERSION_1_2
108    _eglFunc("eglCreatePbufferFromClientBuffer",     "none"),
109    _eglFunc("eglWaitClient",                        "none"),
110    _eglFunc("eglBindAPI",                           "none"),
111    _eglFunc("eglQueryAPI",                          "none"),
112    _eglFunc("eglReleaseThread",                     "none"),
113
114    # EGL_VERSION_1_4
115    _eglFunc("eglGetCurrentContext",                 "none"),
116
117    # EGL_VERSION_1_5
118    _eglFunc("eglCreateSync",                        "none"),
119    _eglFunc("eglDestroySync",                       "none"),
120    _eglFunc("eglClientWaitSync",                    "none"),
121    _eglFunc("eglGetSyncAttrib",                     "none"),
122    _eglFunc("eglCreateImage",                       "none"),
123    _eglFunc("eglDestroyImage",                      "none"),
124    _eglFunc("eglCreatePlatformWindowSurface",       "none"),
125    _eglFunc("eglCreatePlatformPixmapSurface",       "none"),
126    _eglFunc("eglWaitSync",                          "none"),
127    _eglFunc("eglGetPlatformDisplay",                "none"),
128
129    # EGL_EXT_platform_base
130    _eglFunc("eglCreatePlatformWindowSurfaceEXT",    "display"),
131    _eglFunc("eglCreatePlatformPixmapSurfaceEXT",    "display"),
132    _eglFunc("eglGetPlatformDisplayEXT",             "none"),
133
134    # TODO: Most of these extensions should be provided by the vendor
135    # libraries, not by libEGL. They're here now to make testing everything
136    # else easier.
137
138    # EGL_EXT_swap_buffers_with_damage
139    _eglFunc("eglSwapBuffersWithDamageEXT",          "display"),
140
141    # KHR_EXT_swap_buffers_with_damage
142    _eglFunc("eglSwapBuffersWithDamageKHR",          "display"),
143
144    # EGL_KHR_cl_event2
145    _eglFunc("eglCreateSync64KHR",                   "display"),
146
147    # EGL_KHR_fence_sync
148    _eglFunc("eglCreateSyncKHR",                     "display"),
149    _eglFunc("eglDestroySyncKHR",                    "display"),
150    _eglFunc("eglClientWaitSyncKHR",                 "display"),
151    _eglFunc("eglGetSyncAttribKHR",                  "display"),
152
153    # EGL_KHR_image
154    _eglFunc("eglCreateImageKHR",                    "display"),
155    _eglFunc("eglDestroyImageKHR",                   "display"),
156
157    # EGL_KHR_image_base
158    # eglCreateImageKHR already defined in EGL_KHR_image
159    # eglDestroyImageKHR already defined in EGL_KHR_image
160
161    # EGL_KHR_reusable_sync
162    _eglFunc("eglSignalSyncKHR",                     "display"),
163    # eglCreateSyncKHR already defined in EGL_KHR_fence_sync
164    # eglDestroySyncKHR already defined in EGL_KHR_fence_sync
165    # eglClientWaitSyncKHR already defined in EGL_KHR_fence_sync
166    # eglGetSyncAttribKHR already defined in EGL_KHR_fence_sync
167
168    # EGL_KHR_wait_sync
169    _eglFunc("eglWaitSyncKHR",                       "display"),
170
171    # EGL_MESA_drm_image
172    _eglFunc("eglCreateDRMImageMESA",                "display"),
173    _eglFunc("eglExportDRMImageMESA",                "display"),
174
175    # EGL_MESA_image_dma_buf_export
176    _eglFunc("eglExportDMABUFImageQueryMESA",        "display"),
177    _eglFunc("eglExportDMABUFImageMESA",             "display"),
178
179    # EGL_NOK_swap_region
180    _eglFunc("eglSwapBuffersRegionNOK",              "display"),
181
182    # EGL_NV_post_sub_buffer
183    _eglFunc("eglPostSubBufferNV",                   "display"),
184
185    # EGL_WL_bind_wayland_display
186    _eglFunc("eglCreateWaylandBufferFromImageWL",    "display"),
187    _eglFunc("eglUnbindWaylandDisplayWL",            "display"),
188    _eglFunc("eglQueryWaylandBufferWL",              "display"),
189    _eglFunc("eglBindWaylandDisplayWL",              "display"),
190
191    # EGL_CHROMIUM_get_sync_values
192    _eglFunc("eglGetSyncValuesCHROMIUM",             "display"),
193
194    # EGL_ANDROID_native_fence_sync
195    _eglFunc("eglDupNativeFenceFDANDROID",           "display"),
196
197    # EGL_ANDROID_blob_cache
198    _eglFunc("eglSetBlobCacheFuncsANDROID",          "display"),
199
200    # EGL_EXT_image_dma_buf_import_modifiers
201    _eglFunc("eglQueryDmaBufFormatsEXT",             "display"),
202    _eglFunc("eglQueryDmaBufModifiersEXT",           "display"),
203
204    # EGL_EXT_device_base
205    _eglFunc("eglQueryDeviceAttribEXT",              "device"),
206    _eglFunc("eglQueryDeviceStringEXT",              "device"),
207    _eglFunc("eglQueryDevicesEXT",                   "none"),
208    _eglFunc("eglQueryDisplayAttribEXT",             "display"),
209
210    # EGL_MESA_query_driver
211    _eglFunc("eglGetDisplayDriverName",              "display"),
212    _eglFunc("eglGetDisplayDriverConfig",            "display"),
213
214    # EGL_KHR_partial_update
215    _eglFunc("eglSetDamageRegionKHR",                "display"),
216
217)
218
219