1 /**************************************************************************
3 * Copyright 2008 VMware, Inc.
4 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
5 * Copyright 2010-2011 LunarG, Inc.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
31 #ifndef EGLAPI_INCLUDED
32 #define EGLAPI_INCLUDED
34 #include "egltypedefs.h"
41 * A generic function ptr type
43 typedef void (*_EGLProc
)(void);
46 struct mesa_glinterop_device_info
;
47 struct mesa_glinterop_export_in
;
48 struct mesa_glinterop_export_out
;
51 * The API dispatcher jumps through these functions
56 EGLBoolean (*Initialize
)(_EGLDriver
*, _EGLDisplay
*disp
);
57 EGLBoolean (*Terminate
)(_EGLDriver
*, _EGLDisplay
*disp
);
58 const char *(*QueryDriverName
)(_EGLDisplay
*disp
);
59 char *(*QueryDriverConfig
)(_EGLDisplay
*disp
);
62 EGLBoolean (*GetConfigs
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
63 EGLConfig
*configs
, EGLint config_size
,
65 EGLBoolean (*ChooseConfig
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
66 const EGLint
*attrib_list
, EGLConfig
*configs
,
67 EGLint config_size
, EGLint
*num_config
);
68 EGLBoolean (*GetConfigAttrib
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
69 _EGLConfig
*config
, EGLint attribute
,
73 _EGLContext
*(*CreateContext
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
74 _EGLConfig
*config
, _EGLContext
*share_list
,
75 const EGLint
*attrib_list
);
76 EGLBoolean (*DestroyContext
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
78 /* this is the only function (other than Initialize) that may be called
79 * with an uninitialized display
81 EGLBoolean (*MakeCurrent
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
82 _EGLSurface
*draw
, _EGLSurface
*read
,
84 EGLBoolean (*QueryContext
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
85 _EGLContext
*ctx
, EGLint attribute
,
89 _EGLSurface
*(*CreateWindowSurface
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
90 _EGLConfig
*config
, void *native_window
,
91 const EGLint
*attrib_list
);
92 _EGLSurface
*(*CreatePixmapSurface
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
93 _EGLConfig
*config
, void *native_pixmap
,
94 const EGLint
*attrib_list
);
95 _EGLSurface
*(*CreatePbufferSurface
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
97 const EGLint
*attrib_list
);
98 EGLBoolean (*DestroySurface
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
99 _EGLSurface
*surface
);
100 EGLBoolean (*QuerySurface
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
101 _EGLSurface
*surface
, EGLint attribute
,
103 EGLBoolean (*SurfaceAttrib
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
104 _EGLSurface
*surface
, EGLint attribute
,
106 EGLBoolean (*BindTexImage
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
107 _EGLSurface
*surface
, EGLint buffer
);
108 EGLBoolean (*ReleaseTexImage
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
109 _EGLSurface
*surface
, EGLint buffer
);
110 EGLBoolean (*SwapInterval
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
111 _EGLSurface
*surf
, EGLint interval
);
112 EGLBoolean (*SwapBuffers
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
114 EGLBoolean (*CopyBuffers
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
115 _EGLSurface
*surface
, void *native_pixmap_target
);
116 EGLBoolean (*SetDamageRegion
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
117 _EGLSurface
*surface
, EGLint
*rects
, EGLint n_rects
);
120 EGLBoolean (*WaitClient
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
122 EGLBoolean (*WaitNative
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
125 /* this function may be called from multiple threads at the same time */
126 _EGLProc (*GetProcAddress
)(_EGLDriver
*drv
, const char *procname
);
128 _EGLSurface
*(*CreatePbufferFromClientBuffer
)(_EGLDriver
*drv
,
131 EGLClientBuffer buffer
,
133 const EGLint
*attrib_list
);
135 _EGLImage
*(*CreateImageKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
136 _EGLContext
*ctx
, EGLenum target
,
137 EGLClientBuffer buffer
,
138 const EGLint
*attr_list
);
139 EGLBoolean (*DestroyImageKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
142 _EGLSync
*(*CreateSyncKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, EGLenum type
,
143 const EGLAttrib
*attrib_list
);
144 EGLBoolean (*DestroySyncKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
146 EGLint (*ClientWaitSyncKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
147 _EGLSync
*sync
, EGLint flags
, EGLTime timeout
);
148 EGLint (*WaitSyncKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, _EGLSync
*sync
);
149 EGLBoolean (*SignalSyncKHR
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
150 _EGLSync
*sync
, EGLenum mode
);
151 EGLBoolean (*GetSyncAttrib
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
152 _EGLSync
*sync
, EGLint attribute
,
154 EGLint (*DupNativeFenceFDANDROID
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
157 EGLBoolean (*SwapBuffersRegionNOK
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
158 _EGLSurface
*surf
, EGLint numRects
,
159 const EGLint
*rects
);
161 _EGLImage
*(*CreateDRMImageMESA
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
162 const EGLint
*attr_list
);
163 EGLBoolean (*ExportDRMImageMESA
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
164 _EGLImage
*img
, EGLint
*name
,
165 EGLint
*handle
, EGLint
*stride
);
167 EGLBoolean (*BindWaylandDisplayWL
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
168 struct wl_display
*display
);
169 EGLBoolean (*UnbindWaylandDisplayWL
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
170 struct wl_display
*display
);
171 EGLBoolean (*QueryWaylandBufferWL
)(_EGLDriver
*drv
, _EGLDisplay
*displ
,
172 struct wl_resource
*buffer
,
173 EGLint attribute
, EGLint
*value
);
175 struct wl_buffer
*(*CreateWaylandBufferFromImageWL
)(_EGLDriver
*drv
,
179 EGLBoolean (*SwapBuffersWithDamageEXT
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
180 _EGLSurface
*surface
,
181 const EGLint
*rects
, EGLint n_rects
);
183 EGLBoolean (*PostSubBufferNV
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
184 _EGLSurface
*surface
, EGLint x
, EGLint y
,
185 EGLint width
, EGLint height
);
187 EGLint (*QueryBufferAge
)(_EGLDriver
*drv
,
188 _EGLDisplay
*disp
, _EGLSurface
*surface
);
189 EGLBoolean (*GetSyncValuesCHROMIUM
)(_EGLDisplay
*disp
, _EGLSurface
*surface
,
190 EGLuint64KHR
*ust
, EGLuint64KHR
*msc
,
193 EGLBoolean (*ExportDMABUFImageQueryMESA
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
194 _EGLImage
*img
, EGLint
*fourcc
,
196 EGLuint64KHR
*modifiers
);
197 EGLBoolean (*ExportDMABUFImageMESA
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
198 _EGLImage
*img
, EGLint
*fds
,
199 EGLint
*strides
, EGLint
*offsets
);
201 int (*GLInteropQueryDeviceInfo
)(_EGLDisplay
*disp
, _EGLContext
*ctx
,
202 struct mesa_glinterop_device_info
*out
);
203 int (*GLInteropExportObject
)(_EGLDisplay
*disp
, _EGLContext
*ctx
,
204 struct mesa_glinterop_export_in
*in
,
205 struct mesa_glinterop_export_out
*out
);
207 EGLBoolean (*QueryDmaBufFormatsEXT
)(_EGLDriver
*drv
, _EGLDisplay
*disp
,
208 EGLint max_formats
, EGLint
*formats
,
209 EGLint
*num_formats
);
210 EGLBoolean (*QueryDmaBufModifiersEXT
) (_EGLDriver
*drv
, _EGLDisplay
*disp
,
211 EGLint format
, EGLint max_modifiers
,
212 EGLuint64KHR
*modifiers
,
213 EGLBoolean
*external_only
,
214 EGLint
*num_modifiers
);
216 void (*SetBlobCacheFuncsANDROID
) (_EGLDriver
*drv
, _EGLDisplay
*disp
,
217 EGLSetBlobFuncANDROID set
,
218 EGLGetBlobFuncANDROID get
);
225 #endif /* EGLAPI_INCLUDED */