egl: drop unused _EGLDriver from {Bind,Release}TexImage()
[mesa.git] / src / egl / main / egldriver.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 EGLDRIVER_INCLUDED
32 #define EGLDRIVER_INCLUDED
33
34
35 #include "c99_compat.h"
36
37 #include "egltypedefs.h"
38 #include <stdbool.h>
39 #include <stddef.h>
40
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /**
47 * Define an inline driver typecast function.
48 *
49 * Note that this macro defines a function and should not be ended with a
50 * semicolon when used.
51 */
52 #define _EGL_DRIVER_TYPECAST(drvtype, egltype, code) \
53 static inline struct drvtype *drvtype(const egltype *obj) \
54 { return (struct drvtype *) code; }
55
56
57 /**
58 * Define the driver typecast functions for _EGLDriver, _EGLDisplay,
59 * _EGLContext, _EGLSurface, and _EGLConfig.
60 *
61 * Note that this macro defines several functions and should not be ended with
62 * a semicolon when used.
63 */
64 #define _EGL_DRIVER_STANDARD_TYPECASTS(drvname) \
65 _EGL_DRIVER_TYPECAST(drvname ## _driver, _EGLDriver, obj) \
66 /* note that this is not a direct cast */ \
67 _EGL_DRIVER_TYPECAST(drvname ## _display, _EGLDisplay, obj->DriverData) \
68 _EGL_DRIVER_TYPECAST(drvname ## _context, _EGLContext, obj) \
69 _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \
70 _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj)
71
72 /**
73 * A generic function ptr type
74 */
75 typedef void (*_EGLProc)(void);
76
77 struct wl_display;
78 struct mesa_glinterop_device_info;
79 struct mesa_glinterop_export_in;
80 struct mesa_glinterop_export_out;
81
82 /**
83 * The API dispatcher jumps through these functions
84 */
85 struct _egl_driver
86 {
87 /* driver funcs */
88 EGLBoolean (*Initialize)(_EGLDisplay *disp);
89 EGLBoolean (*Terminate)(_EGLDisplay *disp);
90 const char *(*QueryDriverName)(_EGLDisplay *disp);
91 char *(*QueryDriverConfig)(_EGLDisplay *disp);
92
93 /* context funcs */
94 _EGLContext *(*CreateContext)(_EGLDisplay *disp, _EGLConfig *config,
95 _EGLContext *share_list, const EGLint *attrib_list);
96 EGLBoolean (*DestroyContext)(_EGLDisplay *disp, _EGLContext *ctx);
97 /* this is the only function (other than Initialize) that may be called
98 * with an uninitialized display
99 */
100 EGLBoolean (*MakeCurrent)(_EGLDisplay *disp,
101 _EGLSurface *draw, _EGLSurface *read,
102 _EGLContext *ctx);
103
104 /* surface funcs */
105 _EGLSurface *(*CreateWindowSurface)(_EGLDisplay *disp, _EGLConfig *config,
106 void *native_window, const EGLint *attrib_list);
107 _EGLSurface *(*CreatePixmapSurface)(_EGLDisplay *disp, _EGLConfig *config,
108 void *native_pixmap, const EGLint *attrib_list);
109 _EGLSurface *(*CreatePbufferSurface)(_EGLDisplay *disp, _EGLConfig *config,
110 const EGLint *attrib_list);
111 EGLBoolean (*DestroySurface)(_EGLDisplay *disp, _EGLSurface *surface);
112 EGLBoolean (*QuerySurface)(_EGLDisplay *disp, _EGLSurface *surface,
113 EGLint attribute, EGLint *value);
114 EGLBoolean (*BindTexImage)(_EGLDisplay *disp, _EGLSurface *surface,
115 EGLint buffer);
116 EGLBoolean (*ReleaseTexImage)(_EGLDisplay *disp, _EGLSurface *surface,
117 EGLint buffer);
118 EGLBoolean (*SwapInterval)(const _EGLDriver *drv, _EGLDisplay *disp,
119 _EGLSurface *surf, EGLint interval);
120 EGLBoolean (*SwapBuffers)(const _EGLDriver *drv, _EGLDisplay *disp,
121 _EGLSurface *draw);
122 EGLBoolean (*CopyBuffers)(const _EGLDriver *drv, _EGLDisplay *disp,
123 _EGLSurface *surface, void *native_pixmap_target);
124 EGLBoolean (*SetDamageRegion)(const _EGLDriver *drv, _EGLDisplay *disp,
125 _EGLSurface *surface, EGLint *rects, EGLint n_rects);
126
127 /* misc functions */
128 EGLBoolean (*WaitClient)(const _EGLDriver *drv, _EGLDisplay *disp,
129 _EGLContext *ctx);
130 EGLBoolean (*WaitNative)(const _EGLDriver *drv, _EGLDisplay *disp,
131 EGLint engine);
132
133 /* this function may be called from multiple threads at the same time */
134 _EGLProc (*GetProcAddress)(const _EGLDriver *drv, const char *procname);
135
136 _EGLImage *(*CreateImageKHR)(const _EGLDriver *drv, _EGLDisplay *disp,
137 _EGLContext *ctx, EGLenum target,
138 EGLClientBuffer buffer,
139 const EGLint *attr_list);
140 EGLBoolean (*DestroyImageKHR)(const _EGLDriver *drv, _EGLDisplay *disp,
141 _EGLImage *image);
142
143 _EGLSync *(*CreateSyncKHR)(const _EGLDriver *drv, _EGLDisplay *disp, EGLenum type,
144 const EGLAttrib *attrib_list);
145 EGLBoolean (*DestroySyncKHR)(const _EGLDriver *drv, _EGLDisplay *disp,
146 _EGLSync *sync);
147 EGLint (*ClientWaitSyncKHR)(const _EGLDriver *drv, _EGLDisplay *disp,
148 _EGLSync *sync, EGLint flags, EGLTime timeout);
149 EGLint (*WaitSyncKHR)(const _EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync);
150 EGLBoolean (*SignalSyncKHR)(const _EGLDriver *drv, _EGLDisplay *disp,
151 _EGLSync *sync, EGLenum mode);
152 EGLint (*DupNativeFenceFDANDROID)(const _EGLDriver *drv, _EGLDisplay *disp,
153 _EGLSync *sync);
154
155 EGLBoolean (*SwapBuffersRegionNOK)(const _EGLDriver *drv, _EGLDisplay *disp,
156 _EGLSurface *surf, EGLint numRects,
157 const EGLint *rects);
158
159 _EGLImage *(*CreateDRMImageMESA)(const _EGLDriver *drv, _EGLDisplay *disp,
160 const EGLint *attr_list);
161 EGLBoolean (*ExportDRMImageMESA)(const _EGLDriver *drv, _EGLDisplay *disp,
162 _EGLImage *img, EGLint *name,
163 EGLint *handle, EGLint *stride);
164
165 EGLBoolean (*BindWaylandDisplayWL)(const _EGLDriver *drv, _EGLDisplay *disp,
166 struct wl_display *display);
167 EGLBoolean (*UnbindWaylandDisplayWL)(const _EGLDriver *drv, _EGLDisplay *disp,
168 struct wl_display *display);
169 EGLBoolean (*QueryWaylandBufferWL)(const _EGLDriver *drv, _EGLDisplay *displ,
170 struct wl_resource *buffer,
171 EGLint attribute, EGLint *value);
172
173 struct wl_buffer *(*CreateWaylandBufferFromImageWL)(const _EGLDriver *drv,
174 _EGLDisplay *disp,
175 _EGLImage *img);
176
177 EGLBoolean (*SwapBuffersWithDamageEXT)(const _EGLDriver *drv, _EGLDisplay *disp,
178 _EGLSurface *surface,
179 const EGLint *rects, EGLint n_rects);
180
181 EGLBoolean (*PostSubBufferNV)(const _EGLDriver *drv, _EGLDisplay *disp,
182 _EGLSurface *surface, EGLint x, EGLint y,
183 EGLint width, EGLint height);
184
185 EGLint (*QueryBufferAge)(const _EGLDriver *drv,
186 _EGLDisplay *disp, _EGLSurface *surface);
187 EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *disp, _EGLSurface *surface,
188 EGLuint64KHR *ust, EGLuint64KHR *msc,
189 EGLuint64KHR *sbc);
190
191 EGLBoolean (*ExportDMABUFImageQueryMESA)(const _EGLDriver *drv, _EGLDisplay *disp,
192 _EGLImage *img, EGLint *fourcc,
193 EGLint *nplanes,
194 EGLuint64KHR *modifiers);
195 EGLBoolean (*ExportDMABUFImageMESA)(const _EGLDriver *drv, _EGLDisplay *disp,
196 _EGLImage *img, EGLint *fds,
197 EGLint *strides, EGLint *offsets);
198
199 int (*GLInteropQueryDeviceInfo)(_EGLDisplay *disp, _EGLContext *ctx,
200 struct mesa_glinterop_device_info *out);
201 int (*GLInteropExportObject)(_EGLDisplay *disp, _EGLContext *ctx,
202 struct mesa_glinterop_export_in *in,
203 struct mesa_glinterop_export_out *out);
204
205 EGLBoolean (*QueryDmaBufFormatsEXT)(const _EGLDriver *drv, _EGLDisplay *disp,
206 EGLint max_formats, EGLint *formats,
207 EGLint *num_formats);
208 EGLBoolean (*QueryDmaBufModifiersEXT) (const _EGLDriver *drv, _EGLDisplay *disp,
209 EGLint format, EGLint max_modifiers,
210 EGLuint64KHR *modifiers,
211 EGLBoolean *external_only,
212 EGLint *num_modifiers);
213
214 void (*SetBlobCacheFuncsANDROID) (const _EGLDriver *drv, _EGLDisplay *disp,
215 EGLSetBlobFuncANDROID set,
216 EGLGetBlobFuncANDROID get);
217 };
218
219
220 extern bool
221 _eglInitializeDisplay(_EGLDisplay *disp);
222
223
224 extern __eglMustCastToProperFunctionPointerType
225 _eglGetDriverProc(const char *procname);
226
227
228 #ifdef __cplusplus
229 }
230 #endif
231
232
233 #endif /* EGLDRIVER_INCLUDED */