Merge remote-tracking branch 'public/master' into vulkan
[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
46 /**
47 * The API dispatcher jumps through these functions
48 */
49 struct _egl_api
50 {
51 /* driver funcs */
52 EGLBoolean (*Initialize)(_EGLDriver *, _EGLDisplay *dpy);
53 EGLBoolean (*Terminate)(_EGLDriver *, _EGLDisplay *dpy);
54
55 /* config funcs */
56 EGLBoolean (*GetConfigs)(_EGLDriver *drv, _EGLDisplay *dpy,
57 EGLConfig *configs, EGLint config_size,
58 EGLint *num_config);
59 EGLBoolean (*ChooseConfig)(_EGLDriver *drv, _EGLDisplay *dpy,
60 const EGLint *attrib_list, EGLConfig *configs,
61 EGLint config_size, EGLint *num_config);
62 EGLBoolean (*GetConfigAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
63 _EGLConfig *config, EGLint attribute,
64 EGLint *value);
65
66 /* context funcs */
67 _EGLContext *(*CreateContext)(_EGLDriver *drv, _EGLDisplay *dpy,
68 _EGLConfig *config, _EGLContext *share_list,
69 const EGLint *attrib_list);
70 EGLBoolean (*DestroyContext)(_EGLDriver *drv, _EGLDisplay *dpy,
71 _EGLContext *ctx);
72 /* this is the only function (other than Initialize) that may be called
73 * with an uninitialized display
74 */
75 EGLBoolean (*MakeCurrent)(_EGLDriver *drv, _EGLDisplay *dpy,
76 _EGLSurface *draw, _EGLSurface *read,
77 _EGLContext *ctx);
78 EGLBoolean (*QueryContext)(_EGLDriver *drv, _EGLDisplay *dpy,
79 _EGLContext *ctx, EGLint attribute,
80 EGLint *value);
81
82 /* surface funcs */
83 _EGLSurface *(*CreateWindowSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
84 _EGLConfig *config, void *native_window,
85 const EGLint *attrib_list);
86 _EGLSurface *(*CreatePixmapSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
87 _EGLConfig *config, void *native_pixmap,
88 const EGLint *attrib_list);
89 _EGLSurface *(*CreatePbufferSurface)(_EGLDriver *drv, _EGLDisplay *dpy,
90 _EGLConfig *config,
91 const EGLint *attrib_list);
92 EGLBoolean (*DestroySurface)(_EGLDriver *drv, _EGLDisplay *dpy,
93 _EGLSurface *surface);
94 EGLBoolean (*QuerySurface)(_EGLDriver *drv, _EGLDisplay *dpy,
95 _EGLSurface *surface, EGLint attribute,
96 EGLint *value);
97 EGLBoolean (*SurfaceAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
98 _EGLSurface *surface, EGLint attribute,
99 EGLint value);
100 EGLBoolean (*BindTexImage)(_EGLDriver *drv, _EGLDisplay *dpy,
101 _EGLSurface *surface, EGLint buffer);
102 EGLBoolean (*ReleaseTexImage)(_EGLDriver *drv, _EGLDisplay *dpy,
103 _EGLSurface *surface, EGLint buffer);
104 EGLBoolean (*SwapInterval)(_EGLDriver *drv, _EGLDisplay *dpy,
105 _EGLSurface *surf, EGLint interval);
106 EGLBoolean (*SwapBuffers)(_EGLDriver *drv, _EGLDisplay *dpy,
107 _EGLSurface *draw);
108 EGLBoolean (*CopyBuffers)(_EGLDriver *drv, _EGLDisplay *dpy,
109 _EGLSurface *surface, void *native_pixmap_target);
110
111 /* misc functions */
112 EGLBoolean (*WaitClient)(_EGLDriver *drv, _EGLDisplay *dpy,
113 _EGLContext *ctx);
114 EGLBoolean (*WaitNative)(_EGLDriver *drv, _EGLDisplay *dpy,
115 EGLint engine);
116
117 /* this function may be called from multiple threads at the same time */
118 _EGLProc (*GetProcAddress)(_EGLDriver *drv, const char *procname);
119
120 _EGLSurface *(*CreatePbufferFromClientBuffer)(_EGLDriver *drv,
121 _EGLDisplay *dpy,
122 EGLenum buftype,
123 EGLClientBuffer buffer,
124 _EGLConfig *config,
125 const EGLint *attrib_list);
126
127 _EGLImage *(*CreateImageKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
128 _EGLContext *ctx, EGLenum target,
129 EGLClientBuffer buffer,
130 const EGLint *attr_list);
131 EGLBoolean (*DestroyImageKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
132 _EGLImage *image);
133
134 _EGLSync *(*CreateSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type,
135 const EGLint *attrib_list,
136 const EGLAttrib *attrib_list64);
137 EGLBoolean (*DestroySyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
138 _EGLSync *sync);
139 EGLint (*ClientWaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
140 _EGLSync *sync, EGLint flags, EGLTime timeout);
141 EGLint (*WaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync);
142 EGLBoolean (*SignalSyncKHR)(_EGLDriver *drv, _EGLDisplay *dpy,
143 _EGLSync *sync, EGLenum mode);
144 EGLBoolean (*GetSyncAttrib)(_EGLDriver *drv, _EGLDisplay *dpy,
145 _EGLSync *sync, EGLint attribute,
146 EGLAttrib *value);
147
148 EGLBoolean (*SwapBuffersRegionNOK)(_EGLDriver *drv, _EGLDisplay *disp,
149 _EGLSurface *surf, EGLint numRects,
150 const EGLint *rects);
151
152 _EGLImage *(*CreateDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
153 const EGLint *attr_list);
154 EGLBoolean (*ExportDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
155 _EGLImage *img, EGLint *name,
156 EGLint *handle, EGLint *stride);
157
158 EGLBoolean (*BindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
159 struct wl_display *display);
160 EGLBoolean (*UnbindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp,
161 struct wl_display *display);
162 EGLBoolean (*QueryWaylandBufferWL)(_EGLDriver *drv, _EGLDisplay *displ,
163 struct wl_resource *buffer,
164 EGLint attribute, EGLint *value);
165
166 struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDriver *drv,
167 _EGLDisplay *disp,
168 _EGLImage *img);
169
170 EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDriver *drv, _EGLDisplay *dpy,
171 _EGLSurface *surface,
172 const EGLint *rects, EGLint n_rects);
173
174 EGLBoolean (*PostSubBufferNV)(_EGLDriver *drv, _EGLDisplay *disp,
175 _EGLSurface *surface, EGLint x, EGLint y,
176 EGLint width, EGLint height);
177
178 EGLint (*QueryBufferAge)(_EGLDriver *drv,
179 _EGLDisplay *dpy, _EGLSurface *surface);
180 EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *dpy, _EGLSurface *surface,
181 EGLuint64KHR *ust, EGLuint64KHR *msc,
182 EGLuint64KHR *sbc);
183
184 EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDriver *drv, _EGLDisplay *disp,
185 _EGLImage *img, EGLint *fourcc,
186 EGLint *nplanes,
187 EGLuint64KHR *modifiers);
188 EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp,
189 _EGLImage *img, EGLint *fds,
190 EGLint *strides, EGLint *offsets);
191 };
192
193
194 #ifdef __cplusplus
195 }
196 #endif
197
198 #endif /* EGLAPI_INCLUDED */