egl: Add _eglConvertIntsToAttribs()
[mesa.git] / src / egl / main / eglapi.h
1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
5 * Copyright 2010-2011 LunarG, Inc.
6 * All Rights Reserved.
7 *
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:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
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.
27 *
28 **************************************************************************/
29
30
31 #ifndef EGLAPI_INCLUDED
32 #define EGLAPI_INCLUDED
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40 * A generic function ptr type
41 */
42 typedef void (*_EGLProc)(void);
43
44 struct wl_display;
45 struct mesa_glinterop_device_info;
46 struct mesa_glinterop_export_in;
47 struct mesa_glinterop_export_out;
48
49 /**
50 * The API dispatcher jumps through these functions
51 */
52 struct _egl_api
53 {
54 /* driver funcs */
55 EGLBoolean (*Initialize)(_EGLDriver *, _EGLDisplay *dpy);
56 EGLBoolean (*Terminate)(_EGLDriver *, _EGLDisplay *dpy);
57
58 /* config funcs */
59 EGLBoolean (*GetConfigs)(_EGLDriver *drv, _EGLDisplay *dpy,
60 EGLConfig *configs, EGLint config_size,
61 EGLint *num_config);
62 EGLBoolean (*ChooseConfig)(_EGLDriver *drv, _EGLDisplay *dpy,
63 const EGLint *attrib_list, EGLConfig *configs,
64 EGLint config_size, EGLint *num_config);
65 EGLBoolean (*GetConfigAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
66 _EGLConfig *config, EGLint attribute,
67 EGLint *value);
68
69 /* context funcs */
70 _EGLContext *(*CreateContext)(_EGLDriver *drv, _EGLDisplay *dpy,
71 _EGLConfig *config, _EGLContext *share_list,
72 const EGLint *attrib_list);
73 EGLBoolean (*DestroyContext)(_EGLDriver *drv, _EGLDisplay *dpy,
74 _EGLContext *ctx);
75 /* this is the only function (other than Initialize) that may be called
76 * with an uninitialized display
77 */
78 EGLBoolean (*MakeCurrent)(_EGLDriver *drv, _EGLDisplay *dpy,
79 _EGLSurface *draw, _EGLSurface *read,
80 _EGLContext *ctx);
81 EGLBoolean (*QueryContext)(_EGLDriver *drv, _EGLDisplay *dpy,
82 _EGLContext *ctx, EGLint attribute,
83 EGLint *value);
84
85 /* surface funcs */
86 _EGLSurface *(*CreateWindowSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
87 _EGLConfig *config, void *native_window,
88 const EGLint *attrib_list);
89 _EGLSurface *(*CreatePixmapSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
90 _EGLConfig *config, void *native_pixmap,
91 const EGLint *attrib_list);
92 _EGLSurface *(*CreatePbufferSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
93 _EGLConfig *config,
94 const EGLint *attrib_list);
95 EGLBoolean (*DestroySurface)(_EGLDriver *drv, _EGLDisplay *dpy,
96 _EGLSurface *surface);
97 EGLBoolean (*QuerySurface)(_EGLDriver *drv, _EGLDisplay *dpy,
98 _EGLSurface *surface, EGLint attribute,
99 EGLint *value);
100 EGLBoolean (*SurfaceAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
101 _EGLSurface *surface, EGLint attribute,
102 EGLint value);
103 EGLBoolean (*BindTexImage)(_EGLDriver *drv, _EGLDisplay *dpy,
104 _EGLSurface *surface, EGLint buffer);
105 EGLBoolean (*ReleaseTexImage)(_EGLDriver *drv, _EGLDisplay *dpy,
106 _EGLSurface *surface, EGLint buffer);
107 EGLBoolean (*SwapInterval)(_EGLDriver *drv, _EGLDisplay *dpy,
108 _EGLSurface *surf, EGLint interval);
109 EGLBoolean (*SwapBuffers)(_EGLDriver *drv, _EGLDisplay *dpy,
110 _EGLSurface *draw);
111 EGLBoolean (*CopyBuffers)(_EGLDriver *drv, _EGLDisplay *dpy,
112 _EGLSurface *surface, void *native_pixmap_target);
113
114 /* misc functions */
115 EGLBoolean (*WaitClient)(_EGLDriver *drv, _EGLDisplay *dpy,
116 _EGLContext *ctx);
117 EGLBoolean (*WaitNative)(_EGLDriver *drv, _EGLDisplay *dpy,
118 EGLint engine);
119
120 /* this function may be called from multiple threads at the same time */
121 _EGLProc (*GetProcAddress)(_EGLDriver *drv, const char *procname);
122
123 _EGLSurface *(*CreatePbufferFromClientBuffer)(_EGLDriver *drv,
124 _EGLDisplay *dpy,
125 EGLenum buftype,
126 EGLClientBuffer buffer,
127 _EGLConfig *config,
128 const EGLint *attrib_list);
129
130 _EGLImage *(*CreateImageKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
131 _EGLContext *ctx, EGLenum target,
132 EGLClientBuffer buffer,
133 const EGLint *attr_list);
134 EGLBoolean (*DestroyImageKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
135 _EGLImage *image);
136
137 _EGLSync *(*CreateSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type,
138 const EGLint *attrib_list,
139 const EGLAttrib *attrib_list64);
140 EGLBoolean (*DestroySyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
141 _EGLSync *sync);
142 EGLint (*ClientWaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
143 _EGLSync *sync, EGLint flags, EGLTime timeout);
144 EGLint (*WaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync);
145 EGLBoolean (*SignalSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
146 _EGLSync *sync, EGLenum mode);
147 EGLBoolean (*GetSyncAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
148 _EGLSync *sync, EGLint attribute,
149 EGLAttrib *value);
150
151 EGLBoolean (*SwapBuffersRegionNOK)(_EGLDriver *drv, _EGLDisplay *disp,
152 _EGLSurface *surf, EGLint numRects,
153 const EGLint *rects);
154
155 _EGLImage *(*CreateDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
156 const EGLint *attr_list);
157 EGLBoolean (*ExportDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
158 _EGLImage *img, EGLint *name,
159 EGLint *handle, EGLint *stride);
160
161 EGLBoolean (*BindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
162 struct wl_display *display);
163 EGLBoolean (*UnbindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
164 struct wl_display *display);
165 EGLBoolean (*QueryWaylandBufferWL)(_EGLDriver *drv, _EGLDisplay *displ,
166 struct wl_resource *buffer,
167 EGLint attribute, EGLint *value);
168
169 struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDriver *drv,
170 _EGLDisplay *disp,
171 _EGLImage *img);
172
173 EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDriver *drv, _EGLDisplay *dpy,
174 _EGLSurface *surface,
175 const EGLint *rects, EGLint n_rects);
176
177 EGLBoolean (*PostSubBufferNV)(_EGLDriver *drv, _EGLDisplay *disp,
178 _EGLSurface *surface, EGLint x, EGLint y,
179 EGLint width, EGLint height);
180
181 EGLint (*QueryBufferAge)(_EGLDriver *drv,
182 _EGLDisplay *dpy, _EGLSurface *surface);
183 EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *dpy, _EGLSurface *surface,
184 EGLuint64KHR *ust, EGLuint64KHR *msc,
185 EGLuint64KHR *sbc);
186
187 EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDriver *drv, _EGLDisplay *disp,
188 _EGLImage *img, EGLint *fourcc,
189 EGLint *nplanes,
190 EGLuint64KHR *modifiers);
191 EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
192 _EGLImage *img, EGLint *fds,
193 EGLint *strides, EGLint *offsets);
194
195 int (*GLInteropQueryDeviceInfo)(_EGLDisplay *dpy, _EGLContext *ctx,
196 struct mesa_glinterop_device_info *out);
197 int (*GLInteropExportObject)(_EGLDisplay *dpy, _EGLContext *ctx,
198 struct mesa_glinterop_export_in *in,
199 struct mesa_glinterop_export_out *out);
200 };
201
202 EGLint _eglConvertIntsToAttribs(const EGLint *int_list,
203 EGLAttrib **out_attrib_list);
204
205 #ifdef __cplusplus
206 }
207 #endif
208
209 #endif /* EGLAPI_INCLUDED */