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